-
Notifications
You must be signed in to change notification settings - Fork 1
/
glycophorin_modeling.py
119 lines (96 loc) · 3.58 KB
/
glycophorin_modeling.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import IMP
import IMP.core
import IMP.algebra
import IMP.atom
import IMP.container
import IMP.pmi1
import IMP.pmi1.restraints.basic
import IMP.pmi1.restraints.stereochemistry
import IMP.pmi1.restraints.crosslinking
import IMP.pmi1.representation
import IMP.pmi1.macros
import os
log_objects = []
sample_objects = []
m = IMP.Model()
r = IMP.pmi1.representation.Representation(m)
r.create_component("chainA",color=0.25)
r.add_component_sequence("chainA", "./data/seq.fasta", id="chainA",offs=61)
a1=[]
for i in range(62,72+1):
a1+=r.add_component_beads("chainA",[(i,i)])
a2 =r.add_component_ideal_helix("chainA",resolutions=[1],resrange=(73,99))
a3=[]
for i in range(100,101+1):
a3+=r.add_component_beads("chainA",[(i,i)])
r.setup_component_geometry("chainA")
r.show_component_table("chainA")
r.create_component("chainB",color=0.5)
r.add_component_sequence("chainB","./data/seq.fasta", id="chainB",offs=61)
b1=[]
for i in range(62,72+1):
b1+=r.add_component_beads("chainB",[(i,i)])
b2=r.add_component_ideal_helix("chainB",resolutions=[1],resrange=(73,99))
b3=[]
for i in range(100,101+1):
b3+=r.add_component_beads("chainB",[(i,i)])
r.setup_component_geometry("chainB")
r.show_component_table("chainB")
r.set_rigid_body_from_hierarchies(a2)
r.set_rigid_body_from_hierarchies(b2)
r.set_chain_of_super_rigid_bodies([a1,a2,a3],2,5)
r.set_chain_of_super_rigid_bodies([b1,b2,b3],2,5)
r.set_super_rigid_bodies(["chainA"])
r.set_super_rigid_bodies(["chainB"])
r.setup_bonds()
r.set_floppy_bodies()
r.shuffle_configuration(10)
r.optimize_floppy_bodies(1000)
log_objects.append(r)
sample_objects.append(r)
listofexcludedpairs = []
lof = [(62, 75, "chainA"), (96, 101, "chainA"),
(62, 75, "chainB"), (96, 101, "chainB")]
# add bonds and angles
for l in lof:
rbr = IMP.pmi1.restraints.stereochemistry.ResidueBondRestraint(r, l)
rbr.add_to_model()
listofexcludedpairs += rbr.get_excluded_pairs()
log_objects.append(rbr)
rar = IMP.pmi1.restraints.stereochemistry.ResidueAngleRestraint(r, l)
rar.add_to_model()
listofexcludedpairs += rar.get_excluded_pairs()
log_objects.append(rar)
ev = IMP.pmi1.restraints.stereochemistry.ExcludedVolumeSphere(r,resolution=1.0)
ev.add_excluded_particle_pairs(listofexcludedpairs)
ev.add_to_model()
log_objects.append(ev)
eb = IMP.pmi1.restraints.basic.ExternalBarrier(r,50)
eb.add_to_model()
log_objects.append(eb)
xl = IMP.pmi1.restraints.crosslinking.CysteineCrossLinkRestraint([r],
filename="./data/expdata.txt", cbeta=True)
xl.add_to_model()
log_objects.append(xl)
sample_objects.append(xl)
mc=IMP.pmi1.macros.ReplicaExchange0(m,r,
monte_carlo_sample_objects=sample_objects,
output_objects=log_objects,
crosslink_restraints=None,
monte_carlo_temperature=1.0,
replica_exchange_minimum_temperature=1.0,
replica_exchange_maximum_temperature=2.5,
number_of_best_scoring_models=500,
monte_carlo_steps=10,
number_of_frames=10000,
write_initial_rmf=True,
initial_rmf_name_suffix="initial",
stat_file_name_suffix="stat",
best_pdb_name_suffix="model",
do_clean_first=True,
do_create_directories=True,
global_output_directory="./output/",
rmf_dir="/rmfs/",
best_pdb_dir="/pdbs/",
replica_stat_file_suffix="stat_replica" )
mc.execute_macro()