forked from facebookresearch/esm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
symmetric_two_level_multimer.py
65 lines (56 loc) · 1.88 KB
/
symmetric_two_level_multimer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# 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,
MinimizeSurfaceHydrophobics,
ProgramNode,
SymmetryRing,
MaximizeGlobularity,
)
def symmetric_two_level_multimer(
num_chains: int,
num_protomers_per_chain: int,
protomer_sequence_length: int = 50,
) -> ProgramNode:
"""
Programs a homo-oligomeric protein with two-level symmetry.
The number of chains in the multimer is specified by `num_chains`.
A protomer sequence, with length `protomer_sequence_length`, is
repeated `num_protomers_per_chain` times.
For example, a two-chain protein with three protomers per chain
would repeat the protomer six times.
"""
# The basic repeated unit.
protomer_sequence = FixedLengthSequenceSegment(protomer_sequence_length)
def _make_protomer_node():
return ProgramNode(sequence_segment=protomer_sequence)
# Protomers are symmetrically combined into a chain.
def _make_chain_node():
return ProgramNode(
energy_function_terms=[
SymmetryRing(),
MaximizeGlobularity(),
],
energy_function_weights=[1., 0.05,],
children=[
_make_protomer_node()
for _ in range(num_protomers_per_chain)
],
)
# Chains are symmetrically combined into a multimer.
return ProgramNode(
energy_function_terms=[
MaximizePTM(),
MaximizePLDDT(),
SymmetryRing(),
MinimizeSurfaceHydrophobics(),
],
children=[
_make_chain_node()
for _ in range(num_chains)
],
children_are_different_chains=True,
)