IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
npc.py
1"""@namespace IMP.pmi.restraints.npc
2Specialized restraints for modeling the Nuclear Pore Complex.
3
4These restraints have been used to model the Nuclear Pore Complex (NPC)
5but may be useful for other applications too. They model the NPC as lying
6in the xy plane, centered at the origin. (Transport through the pore
7corresponds to movement along the z axis.) The surface of the nuclear
8membrane is represented as the surface of a half torus, also lying in
9the xy plane and centered at the origin. Individual proteins
10(or parts of proteins, such as the N- or C- termini) are then localized to
11different regions of the complex (e.g. near the membrane or pore, or on
12the nuclear or cytoplasmic side) by simple restraints on their Cartesian
13coordinates.
14"""
15
16import IMP.npc
17
18
19class XYRadialPositionRestraint(IMP.pmi.restraints.RestraintBase):
20 """Restrain a protein's distance from the z axis to within a given range.
21 """
22 _include_in_rmf = True
23
24 def __init__(self, hier, protein, lower_bound=0.0, upper_bound=0.0,
25 consider_radius=False, sigma=1.0, term='C', label=None,
26 weight=1.0):
27 """Constructor
28 """
29
30 super().__init__(hier.get_model(), label=label, weight=weight)
31
33 self.model, lower_bound, upper_bound, consider_radius, sigma)
35 hier, protein, resolution=1)
36 if term == 'C':
37 terminal = residues[-1]
38 # print (terminal, type(terminal))
39 xyr.add_particle(terminal)
40 elif term == 'N':
41 terminal = residues[0]
42 # print (terminal, type(terminal))
43 xyr.add_particle(terminal)
44 else:
45 for residue in residues:
46 # print (residue, type(residue))
47 xyr.add_particle(residue)
48
49 self.dataset = None
50 for p, state in IMP.pmi.tools._all_protocol_outputs(hier):
51 p.add_xyradial_restraint(state, residues, lower_bound,
52 upper_bound, sigma, self)
53
54 self.rs.add_restraint(xyr)
55
56
57class XYRadialPositionLowerRestraint(IMP.pmi.restraints.RestraintBase):
58 """Restrain a protein's distance from the z axis to above a lower bound.
59 """
60 _include_in_rmf = True
61
62 def __init__(self, hier, protein, lower_bound=0.0,
63 consider_radius=False, sigma=1.0, label=None, weight=1.0):
64 """Constructor
65 """
66
67 super().__init__(hier.get_model(), label=label, weight=weight)
68
70 self.model, lower_bound, consider_radius, sigma)
72 hier, protein, resolution=1)
73
74 for residue in residues:
75 xyr.add_particle(residue)
76
77 self.rs.add_restraint(xyr)
78
79
80class XYRadialPositionUpperRestraint(IMP.pmi.restraints.RestraintBase):
81 """Restrain a protein's distance from the z axis to below an upper bound.
82 """
83 _include_in_rmf = True
84
85 def __init__(self, hier, protein, upper_bound=0.0,
86 consider_radius=False, sigma=1.0, label=None, weight=1.0):
87 """Constructor
88 """
89
90 super().__init__(hier.get_model(), label=label, weight=weight)
91
93 self.model, upper_bound, consider_radius, sigma)
95 hier, protein, resolution=1)
96
97 for residue in residues:
98 xyr.add_particle(residue)
99 self.rs.add_restraint(xyr)
100
101
102class ZAxialPositionRestraint(IMP.pmi.restraints.RestraintBase):
103 """Restrain a protein's z coordinate to within a given range.
104 """
105 _include_in_rmf = True
106
107 def __init__(self, hier, protein, lower_bound=0.0,
108 upper_bound=0.0, consider_radius=False, sigma=1.0, term='C',
109 label=None, weight=1.0):
110 """Constructor
111 """
112
113 super().__init__(hier.get_model(), label=label, weight=weight)
114
116 self.model, lower_bound, upper_bound, consider_radius, sigma)
118 hier, protein, resolution=1)
119 if term == 'C':
120 terminal = residues[-1]
121 # print (terminal, type(terminal))
122 zax.add_particle(terminal)
123 elif term == 'N':
124 terminal = residues[0]
125 # print (terminal, type(terminal))
126 zax.add_particle(terminal)
127 else:
128 for residue in residues:
129 # print (residue, type(residue))
130 zax.add_particle(residue)
131
132 self.dataset = None
133 for p, state in IMP.pmi.tools._all_protocol_outputs(hier):
134 p.add_zaxial_restraint(state, residues, lower_bound,
135 upper_bound, sigma, self)
136
137 self.rs.add_restraint(zax)
138
139
140class ZAxialPositionLowerRestraint(IMP.pmi.restraints.RestraintBase):
141 """Restrain a protein's z coordinate to above a lower bound.
142 """
143 _include_in_rmf = True
144
145 def __init__(self, hier, protein, lower_bound=0.0,
146 consider_radius=False, sigma=1.0, label=None, weight=1.0):
147 """Constructor
148 """
149
150 super().__init__(hier.get_model(), label=label, weight=weight)
151
153 self.model, lower_bound, consider_radius, sigma)
155 hier, protein, resolution=1)
156
157 for residue in residues:
158 zax.add_particle(residue)
159
160 self.rs.add_restraint(zax)
161
162
163class ZAxialPositionUpperRestraint(IMP.pmi.restraints.RestraintBase):
164 """Restrain a protein's z coordinate to below an upper bound.
165 """
166 _include_in_rmf = True
167
168 def __init__(self, hier, protein, upper_bound=0.0,
169 consider_radius=False, sigma=1.0, label=None, weight=1.0):
170 """Constructor
171 """
172
173 super().__init__(hier.get_model(), label=label, weight=weight)
174
176 self.model, upper_bound, consider_radius, sigma)
178 hier, protein, resolution=1)
179
180 for residue in residues:
181 zax.add_particle(residue)
182
183 self.rs.add_restraint(zax)
184
185
186class YAxialPositionRestraint(IMP.pmi.restraints.RestraintBase):
187 """Restrain a protein's y coordinate to within a given range.
188 """
189 _include_in_rmf = True
190
191 def __init__(self, hier, protein, lower_bound=0.0,
192 upper_bound=0.0, consider_radius=False, sigma=1.0, term='C',
193 label=None, weight=1.0):
194 """Constructor
195 """
196
197 super().__init__(hier.get_model(), label=label, weight=weight)
198
200 self.model, lower_bound, upper_bound, consider_radius, sigma)
202 hier, protein, resolution=1)
203 if term == 'C':
204 terminal = residues[-1]
205 # print (terminal, type(terminal))
206 yax.add_particle(terminal)
207 elif term == 'N':
208 terminal = residues[0]
209 # print (terminal, type(terminal))
210 yax.add_particle(terminal)
211 else:
212 for residue in residues:
213 # print (residue, type(residue))
214 yax.add_particle(residue)
215
216 self.dataset = None
217 for p, state in IMP.pmi.tools._all_protocol_outputs(hier):
218 p.add_yaxial_restraint(state, residues, lower_bound,
219 upper_bound, sigma, self)
220
221 self.rs.add_restraint(yax)
222
223
224class YAxialPositionLowerRestraint(IMP.pmi.restraints.RestraintBase):
225 """Restrain a protein's y coordinate to above a lower bound.
226 """
227 _include_in_rmf = True
228
229 def __init__(self, hier, protein, lower_bound=0.0,
230 consider_radius=False, sigma=1.0, label=None, weight=1.0):
231 """Constructor
232 """
233
234 super().__init__(hier.get_model(), label=label, weight=weight)
235
237 self.model, lower_bound, consider_radius, sigma)
239 hier, protein, resolution=1)
240
241 for residue in residues:
242 yax.add_particle(residue)
243
244 self.rs.add_restraint(yax)
245
246
247class YAxialPositionUpperRestraint(IMP.pmi.restraints.RestraintBase):
248 """Restrain a protein's y coordinate to below an upper bound.
249 """
250 _include_in_rmf = True
251
252 def __init__(self, hier, protein, upper_bound=0.0,
253 consider_radius=False, sigma=1.0, label=None, weight=1.0):
254 """Constructor
255 """
256
257 super().__init__(hier.get_model(), label=label, weight=weight)
258
260 self.model, upper_bound, consider_radius, sigma)
262 hier, protein, resolution=1)
263
264 for residue in residues:
265 yax.add_particle(residue)
266
267 self.rs.add_restraint(yax)
268
269
270class MembraneSurfaceLocationRestraint(IMP.pmi.restraints.RestraintBase):
271 """Localize protein on the surface of a half torus in the xy plane.
272 """
273 _include_in_rmf = True
274
275 def __init__(self, hier, protein,
276 tor_R=540.0, tor_r=127.5, tor_th=45.0, sigma=0.2,
277 resolution=1, label=None, weight=1.0):
278 """Constructor
279 """
280
281 super().__init__(hier.get_model(), label=label, weight=weight)
282
284 self.model, tor_R, tor_r, tor_th, sigma)
286 hier, protein, resolution=resolution)
287 for residue in residues:
288 # print (residue, type(residue))
289 msl.add_particle(residue)
290
291 self.dataset = None
292 for p, state in IMP.pmi.tools._all_protocol_outputs(hier):
293 p.add_membrane_surface_location_restraint(
294 state, residues, tor_R, tor_r, tor_th, sigma, self)
295
296 self.rs.add_restraint(msl)
297
298
300 IMP.pmi.restraints.RestraintBase):
301 """Localize one protein on the surface of a half torus in the xy plane.
302
303 Create Membrane Surface Location CONDITIONAL Restraint
304 for Nup120 ALPS Motifs - Mutually Exclusive from (135,152,'Nup120')
305 and (197,216,'Nup120').
306 It returns a minimum penalty score from two potential ALPS motifs.
307 """
308 _include_in_rmf = True
309
310 def __init__(self, hier, protein1, protein2,
311 tor_R=540.0, tor_r=127.5, tor_th=45.0, sigma=0.2,
312 resolution=1, label=None, weight=1.0):
313 """Constructor
314 """
315
316 super().__init__(hier.get_model(), label=label, weight=weight)
317
319 self.model, tor_R, tor_r, tor_th, sigma)
321 hier, protein1, resolution=resolution)
322 for residue in residues1:
323 # print (residue, type(residue))
324 msl.add_particle1(residue)
326 hier, protein2, resolution=resolution)
327 for residue in residues2:
328 # print (residue, type(residue))
329 msl.add_particle2(residue)
330
331 # Approximate as two membrane restraints
332 self.dataset = None
333 for p, state in IMP.pmi.tools._all_protocol_outputs(hier):
334 for residues in residues1, residues2:
335 p.add_membrane_surface_location_restraint(
336 state, residues, tor_R, tor_r, tor_th, sigma, self)
337
338 self.rs.add_restraint(msl)
339
340
341class MembraneExclusionRestraint(IMP.pmi.restraints.RestraintBase):
342 """Keep protein away from a half torus in the xy plane.
343 """
344 _include_in_rmf = True
345
346 def __init__(self, hier, protein=None,
347 tor_R=540.0, tor_r=127.5, tor_th=45.0, sigma=0.2,
348 resolution=1, label=None, weight=1.0):
349 """Constructor
350 """
351
352 super().__init__(hier.get_model(), label=label, weight=weight)
353
355 self.model, tor_R, tor_r, tor_th, sigma)
357 hier, protein, resolution=resolution)
358 for residue in residues:
359 mex.add_particle(residue)
360
361 self.dataset = None
362 for p, state in IMP.pmi.tools._all_protocol_outputs(hier):
363 p.add_membrane_exclusion_restraint(
364 state, residues, tor_R, tor_r, tor_th, sigma, self)
365
366 self.rs.add_restraint(mex)
Try to keep particles away from a membrane.
Try to keep one set of particles localized on a membrane surface.
Try to keep particles localized on a membrane surface.
Restrain particles by their distance from the z axis in the xy plane.
Restrain particles by their distance from the z axis in the xy plane.
Restrain particles by their distance from the z axis in the xy plane.
Restrain particles by their y coordinate.
Restrain particles by their y coordinate.
Restrain particles by their y coordinate.
Restrain particles by their z coordinate.
Restrain particles by their z coordinate.
Restrain particles by their z coordinate.
Keep protein away from a half torus in the xy plane.
Definition npc.py:341
__init__(self, hier, protein=None, tor_R=540.0, tor_r=127.5, tor_th=45.0, sigma=0.2, resolution=1, label=None, weight=1.0)
Constructor.
Definition npc.py:346
Localize one protein on the surface of a half torus in the xy plane.
Definition npc.py:299
__init__(self, hier, protein1, protein2, tor_R=540.0, tor_r=127.5, tor_th=45.0, sigma=0.2, resolution=1, label=None, weight=1.0)
Constructor.
Definition npc.py:310
Localize protein on the surface of a half torus in the xy plane.
Definition npc.py:270
__init__(self, hier, protein, tor_R=540.0, tor_r=127.5, tor_th=45.0, sigma=0.2, resolution=1, label=None, weight=1.0)
Constructor.
Definition npc.py:275
Restrain a protein's distance from the z axis to above a lower bound.
Definition npc.py:57
__init__(self, hier, protein, lower_bound=0.0, consider_radius=False, sigma=1.0, label=None, weight=1.0)
Constructor.
Definition npc.py:62
Restrain a protein's distance from the z axis to within a given range.
Definition npc.py:19
__init__(self, hier, protein, lower_bound=0.0, upper_bound=0.0, consider_radius=False, sigma=1.0, term='C', label=None, weight=1.0)
Constructor.
Definition npc.py:24
Restrain a protein's distance from the z axis to below an upper bound.
Definition npc.py:80
__init__(self, hier, protein, upper_bound=0.0, consider_radius=False, sigma=1.0, label=None, weight=1.0)
Constructor.
Definition npc.py:85
Restrain a protein's y coordinate to above a lower bound.
Definition npc.py:224
__init__(self, hier, protein, lower_bound=0.0, consider_radius=False, sigma=1.0, label=None, weight=1.0)
Constructor.
Definition npc.py:229
Restrain a protein's y coordinate to within a given range.
Definition npc.py:186
__init__(self, hier, protein, lower_bound=0.0, upper_bound=0.0, consider_radius=False, sigma=1.0, term='C', label=None, weight=1.0)
Constructor.
Definition npc.py:191
Restrain a protein's y coordinate to below an upper bound.
Definition npc.py:247
__init__(self, hier, protein, upper_bound=0.0, consider_radius=False, sigma=1.0, label=None, weight=1.0)
Constructor.
Definition npc.py:252
Restrain a protein's z coordinate to above a lower bound.
Definition npc.py:140
__init__(self, hier, protein, lower_bound=0.0, consider_radius=False, sigma=1.0, label=None, weight=1.0)
Constructor.
Definition npc.py:145
Restrain a protein's z coordinate to within a given range.
Definition npc.py:102
__init__(self, hier, protein, lower_bound=0.0, upper_bound=0.0, consider_radius=False, sigma=1.0, term='C', label=None, weight=1.0)
Constructor.
Definition npc.py:107
Restrain a protein's z coordinate to below an upper bound.
Definition npc.py:163
__init__(self, hier, protein, upper_bound=0.0, consider_radius=False, sigma=1.0, label=None, weight=1.0)
Constructor.
Definition npc.py:168
Restraints designed for modeling the Nuclear Pore Complex (NPC).
select_by_tuple_2(hier, tuple_selection, resolution)
New tuple format: molname OR (start,stop,molname,copynum,statenum) Copy and state are optional.
Definition pmi/tools.py:435