Download weight/esm-main/examples/protein-programming-language/programs/secondary_structure.py from OneScience-Group/ESM: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/OneScience-Group/ESM/resolve/main/weight/esm-main/examples/protein-programming-language/programs/secondary_structure.py
- Command line
-
hf download hf://OneScience-Group/ESM/weight/esm-main/examples/protein-programming-language/programs/secondary_structure.py
-
curl -L -o secondary_structure.py https://huggingface.co/OneScience-Group/ESM/resolve/main/weight/esm-main/examples/protein-programming-language/programs/secondary_structure.py
1.34 kB
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |
| # This source code is licensed under the MIT license found in the | |
| # LICENSE file in the root directory of this source tree. | |
| from language import ( | |
| FixedLengthSequenceSegment, | |
| MaximizePLDDT, | |
| MaximizePTM, | |
| MatchSecondaryStructure, | |
| MinimizeSurfaceHydrophobics, | |
| ProgramNode, | |
| ) | |
| def secondary_structure( | |
| node1_sse: str = 'a', | |
| node2_sse: str = 'b', | |
| ) -> ProgramNode: | |
| """ | |
| Free hallucinates a protein while controlling the secondary structure | |
| corresponding to different segments of the sequence. | |
| Specify `'a'` for alpha helix, `'b'` for beta sheet, and `'c'` for coils. | |
| """ | |
| node1 = ProgramNode( | |
| sequence_segment=FixedLengthSequenceSegment(50), | |
| energy_function_terms=[ | |
| MatchSecondaryStructure(node1_sse), | |
| #TODO(brianhie): Add globularity here. | |
| ] | |
| ) | |
| node2 = ProgramNode( | |
| sequence_segment=FixedLengthSequenceSegment(50), | |
| energy_function_terms=[ | |
| MatchSecondaryStructure(node2_sse), | |
| #TODO(brianhie): Add globularity here. | |
| ] | |
| ) | |
| return ProgramNode( | |
| energy_function_terms=[ | |
| MaximizePTM(), | |
| MaximizePLDDT(), | |
| MinimizeSurfaceHydrophobics(), | |
| ], | |
| children=[node1, node2,], | |
| ) | |