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