IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
config_example.py
1
2
3# This class specifies the parameters used during the Monte Carlo optimization
4class MonteCarloParams:
5
6 def __init__(self):
7
8 # Profile of the set of temperatures used. You can add as many as you
9 # want. You can see that here the profile is a tempering
10 self.temperatures = [30000, 15000, 10000, 5000, 1000]
11 # Monte Carlo iterations to use for each value of the temperature.
12 # The number of values must be the same as the number of temperatures.
13 self.iterations = [200, 200, 200, 200]
14 # Maximum translation allowed for the components for each value of
15 # the temperature
16 self.max_translations = [20, 15, 10, 5]
17 # Same as above but with the rotations (in radians)
18 self.max_rotations = [1, 0.5, 0.25, 0.1]
19 # The number of cycles. Is the number of times that the profile
20 # of temperatures, iterations, translations and rotations is repeated
21 # Yo can put as many as you want
22 self.cycles = 3
23 # This parameter indicates the probability for a component of doing
24 # a random movement instead of a relative movement. A value of 0.4
25 # means that a component will do a
26 # random move instead of moving to a relative position
27 # respect to its receptor 40% of the time.
28 # If no docking has been done between two structures, this parameter is
29 # ignored.
30 self.non_relative_move_prob = 0.4
31
32
33# This class specifies the parameters used for the DOMINO sampling
34class DominoSamplingPositions:
35
36 def __init__(self):
37 # This parameter is the file where the results of many different
38 # Monte Carlo runs are. The starting solutions for DOMINO are read from
39 # it. It must be in the SQLite database format, as generated by the
40 # MC sampling.
41 self.read = "monte_carlo_solutions.db"
42 # The maximum number of solutions from the file in self.read to combine
43 self.max_number = 50
44 # criteria to order the solutions
45 self.orderby = "em2d"
46 # Here, all the parameters together mean that the 50 best solutions from monte_carlo_solutions.db according to the em2d score are fed to
47 # DOMINO.
48
49# This class is for technical parameters for DOMINO.
50
51
52class DominoParams:
53
54 def __init__(self, ):
55 # Exploring all possible combinations of sampling positions
56 # is memory intensive. self.heap_solutions is the number of
57 # solutions that you keep each merging step in DOMINO.
58 # The larger the number, the better the space of combinations
59 # is explored, at the cost of larger running time
60 self.heap_solutions = 2000
61
62# This class is here to inject testing code in the modeling. Don't bother with
63# it unless you know the code for the application well.
64
65
66class TestParameters:
67
68 def __init__(self, ):
69 self.do_test = False
70 self.test_fn_assembly = ""
71
72
73# This class is used to measure the performance of the method with benchmark
74# structures. Same as above, ignore or delete it if you are modeling.
75class Benchmark:
76
77 def __init__(self, ):
78 self.fn_pdb_native = "3sfd.pdb"
79 # parameters for measuring the ccc with the 3D map
80 self.resolution = 8
81 self.voxel_size = 1.5
82 self.native_map_threshold = 0.25
83 # The component from the model is aligned to the native component before
84 # computing the measures for the benchmark
85 self.native_component = "3sfdB"
86 self.model_component = "3sfdB"
87
88
89# this is the main class containing all the parameters of the experiment
90class Experiment:
91
92 def __init__(self,):
93
94 # The name of the model. You use any name. It is not used by the logic
95 # of the application
96 self.model_name = ["3sfd"]
97 # The name of each of the components (subunits) of the assembly. The
98 # names of the subunits are heavily used by the code. Make sure that all
99 # the names are different.
100 self.names = ["3sfdA", "3sfdB", "3sfdC", "3sfdD"]
101 # The number of the pdbs containing the subunits. The name of the
102 # files does not need to match the names of the subunits in self.names
103 self.fn_pdbs = ["3sfdA.pdb", "3sfdB.pdb", "3sfdC.pdb", "3sfdD.pdb"]
104 # Some of the restraints (e.g., excluded volume), use a coarse
105 # representation of the components of the assembly. This value is
106 # the number of residues included in a bead of the coarse
107 # representation
108 self.n_residues = 10
109 # The components that are going to be anchored. i.e., the components
110 # that are going to be set at the origin and with a identity rotation.
111 # First start with all False until you perform the initial dockings of
112 # components, and the anchor the first receptor. You can override the
113 # selection of the anchored component if you want. The only condition
114 # is that the anchor can not move relative to other components.
115 # The program will crash otherwise.
116 self.anchor = [False, False, False, False]
117 # This option means that the coordinates of a component are fixed.
118 # It makes sense when using DOMINO. It keeps a component in its
119 # actual position, ignoring all the possible positions obtained using
120 # the Monte Carlo modelings.
121 self.fixed = [False, False, False, False]
122
123 # Pair score restraint. This restraint indicates that 2 components of
124 # the complex should be together. The order of the parameters for each
125 # restraint is:
126 # component1 - the id of the first component
127 # component2 - the id of the second component
128 # name - The name for the restraint. Make sure that the restraint
129 # does not contain hyphens. SQLite does not like them. Do not
130 # given the same name to different restraints.
131 # distance - The distance that the components should keep. It is the
132 # minimum distance between 2 particles of the complex. Distances
133 # equal or below this value are not penalized by the scoring function
134 # Weight - the weight for the restraint. The value of a restraint is
135 # multiplied by its weight before adding it to the total scoring
136 # function.
137 # stddev - This is the "standard deviation". The pair score restraint
138 # is an IMP.HarmonicUppperBound function. The stddev value is used to
139 # approximate the values of the HarmonicUppperBound to those of a
140 # Gaussian function of standard deviation stddev.
141
142 # component1,component2,name,distance,weight,pairs,stddev
143 self.pair_score_restraints = [["3sfdB", "3sfdA", "B_A", 0, 1, 1, 3.],
144 ["3sfdB", "3sfdC", "B_C", 0, 1, 1, 3.],
145 ["3sfdB", "3sfdD", "B_D", 0, 1, 1, 3.],
146 ["3sfdD", "3sfdC", "D_C", 0, 1, 1, 3.]
147
148 ]
149
150 # Excluded volume restraint. Restraint preventing the components from
151 # interpenetrating. This restraints sets an all against all excluded
152 # volument restraint. The meaning of the parameters is the same as above
153 #distance, weight,pairs,stddev
154 self.pairs_excluded_restraint = [0, 1, 0.1, 2]
155
156 # Geometric complementarity restraint:
157 # the parameters are the ids of the 2 components, the name of the restraint
158 # maximum distance - if 2 components are apart by more than this distance,
159 # the restraint returns the value 0
160 # max_penetration. It is maximum distance that 2 rigid bodies can interpenetrate
161 # before the restraint returns a infinite value. For values of
162 # the interpenetration lower than maximum penetration, the
163 # restraint returns increasing positive values.
164 # The value of the restraint is negative only when the subunits show
165 # some surface complementarity.
166 # Note: There is a known issue with this restraint. Sometimes the program will crash
167 # for no apparent reason, and seems to be structure specific. One of the first
168 # to do in this case is to remove this restraints.
169 # the weight parameter is the weight for the restraint.
170 # component1, component2, max distance,max penetration,weight.
171 self.complementarity_restraints = [
172 ["3sfdB", "3sfdA", "cB_A", 30, 15, 0.0001],
173 ["3sfdB",
174 "3sfdC",
175 "cB_C",
176 30,
177 15,
178 0.0001],
179 ["3sfdB",
180 "3sfdD",
181 "cB_D",
182 30,
183 15,
184 0.0001],
185 ]
186
187 # Em2DRestraint. Restraint measuring the similarity between a model and the
188 # EM class averages. The parameters are:
189 # the name of the restraint
190 # the selection file containing the names of the images to use as
191 # restraints.
192 # The pixel size of the images
193 # The resolution used to generate the projections of the model
194 # The number of images used for the coarse search part of the em2d calculation.
195 # The weight for the restraint
196 # and the maximum score tolerated for the restraint. If the value for the
197 # maximum score. 1000 is used here because the maximum value for the em2d score
198 # is 1 and the weight of the restraint is 1000.
199 self.em2d_restraints = [["em2d", "em_images/images.sel", 1.5, 5, 20, 1000, 1000]
200 ]
201
202 # Cross-linking restraints. The parameters
203 # the ids, chains and residue number of the subunits implied in the restraint
204 # The maximum distance between residues tolerated. If the distance
205 # is lower, the restraint has 0 value.
206 # For the value of the stddev parameter, see the help for the
207 # self.pair_score_restraints.
208 # You can add a last parameter to the list, the maximum value of the scoring function
209 # that you want to accept. It is only used during the DOMINO optimization
210 # component1,chain1,residue1, component2, chain2, residue2, distance,weight, stddev, max_score
211 self.xlink_restraints = [
212 ["3sfdB", "B", 23, "3sfdA", "A", 456, 30, 100, 2],
213 ["3sfdB",
214 "B",
215 241,
216 "3sfdC",
217 "C",
218 112,
219 30,
220 100,
221 2],
222 ["3sfdB",
223 "B",
224 205,
225 "3sfdD",
226 "D",
227 37,
228 30,
229 100,
230 2],
231 ["3sfdB",
232 "B",
233 177,
234 "3sfdD",
235 "D",
236 99,
237 30,
238 100,
239 2],
240 ["3sfdC",
241 "C",
242 95,
243 "3sfdD",
244 "D",
245 132,
246 30,
247 100,
248 2],
249 ["3sfdC",
250 "C",
251 9,
252 "3sfdD",
253 "D",
254 37,
255 30,
256 100,
257 2],
258 ["3sfdC",
259 "C",
260 78,
261 "3sfdD",
262 "D",
263 128,
264 30,
265 100,
266 2],
267 ]
268 # set the value to False of this parameter if you don't have the HEXDOCK docking program.
269 # self.have_hexdock = False
270
271 #
272 self.dock_transforms = [
273 ["3sfdB", "3sfdA", "relative_positions_3sfdB-3sfdA.txt"],
274 ["3sfdB", "3sfdC", "relative_positions_3sfdB-3sfdC.txt"],
275 ["3sfdB", "3sfdD", "relative_positions_3sfdB-3sfdD.txt"],
276 ["3sfdD", "3sfdC", "relative_positions_3sfdD-3sfdC.txt"],
277 ]
278
279 self.sampling_positions = DominoSamplingPositions()
280
281 self.monte_carlo = MonteCarloParams()
282 self.domino_params = DominoParams()
283
284 self.test_opts = TestParameters()
285 # benchmark
286 self.benchmark = Benchmark()
287
288 # results
289 # the maximum number of solutions to produce
290 self.n_solutions = 2000
291 self.orderby = "em2d"