IMP logo
IMP Reference Guide  2.20.0
The Integrative Modeling Platform
/restraints/npc.py
1 """@namespace IMP.pmi1.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 import IMP.pmi1.tools
18 
19 
21  """Create XYRadial Position Restraint
22  """
23  def __init__(self,
24  representation,
25  protein,
26  lower_bound = 0.0,
27  upper_bound = 0.0,
28  consider_radius = False,
29  sigma = 1.0,
30  term = 'C'):
31  """Constructor
32  @param representation representation
33  """
34 
35  self.m = representation.prot.get_model()
36  self.rs = IMP.RestraintSet(self.m, 'XYRadialPositionRestraint')
37  self.weight=1.0
38  self.label = "None"
39 
40  xyr = IMP.npc.XYRadialPositionRestraint(self.m, lower_bound, upper_bound, consider_radius, sigma)
41  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=1)
42  if (term == 'C'):
43  terminal = residues[-1]
44  #print (terminal, type(terminal))
45  xyr.add_particle(terminal)
46  elif (term == 'N'):
47  terminal = residues[0]
48  #print (terminal, type(terminal))
49  xyr.add_particle(terminal)
50  else:
51  for residue in residues:
52  #print (residue, type(residue))
53  xyr.add_particle(residue)
54 
55  self.dataset = None
56  if representation:
57  for p, state in representation._protocol_output:
58  p.add_xyradial_restraint(state, residues, lower_bound,
59  upper_bound, sigma, self)
60 
61  self.rs.add_restraint(xyr)
62 
63  def set_label(self, label):
64  self.label = label
65 
66  def add_to_model(self):
68 
69  def get_restraint(self):
70  return self.rs
71 
72  def set_weight(self, weight):
73  self.weight = weight
74  self.rs.set_weight(self.weight)
75 
76  def get_output(self):
77  self.m.update()
78  output = {}
79  score = self.weight * self.rs.unprotected_evaluate(None)
80  output["_TotalScore"] = str(score)
81  output["XYRadialPositionRestraint_" + self.label] = str(score)
82  return output
83 
84  def evaluate(self):
85  return self.weight * self.rs.unprotected_evaluate(None)
86 
88  """Create XYRadial Position Lower restraints
89  """
90  def __init__(self,
91  representation,
92  protein,
93  lower_bound = 0.0,
94  consider_radius = False,
95  sigma = 1.0):
96  """Constructor
97  @param representation representation
98  """
99 
100  self.m = representation.prot.get_model()
101  self.rs = IMP.RestraintSet(self.m, 'XYRadialPositionLowerRestraint')
102  self.weight=1.0
103  self.label = "None"
104 
105  xyr = IMP.npc.XYRadialPositionLowerRestraint(self.m, lower_bound, consider_radius, sigma)
106  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=1)
107  cterminal = residues[-1] #nterminal = residues[0]
108  #print (cterminal, type(cterminal))
109 
110  xyr.add_particle(cterminal)
111  self.rs.add_restraint(xyr)
112 
113  def set_label(self, label):
114  self.label = label
115 
116  def add_to_model(self):
118 
119  def get_restraint(self):
120  return self.rs
121 
122  def set_weight(self, weight):
123  self.weight = weight
124  self.rs.set_weight(self.weight)
125 
126  def get_output(self):
127  self.m.update()
128  output = {}
129  score = self.weight * self.rs.unprotected_evaluate(None)
130  output["_TotalScore"] = str(score)
131  output["XYRadialPositionLowerRestraint_" + self.label] = str(score)
132  return output
133 
134  def evaluate(self):
135  return self.weight * self.rs.unprotected_evaluate(None)
136 
138  """Create XYRadial Position Upper restraints
139  """
140  def __init__(self,
141  representation,
142  protein,
143  upper_bound = 0.0,
144  consider_radius = False,
145  sigma = 1.0):
146  """Constructor
147  @param representation representation
148  """
149 
150  self.m = representation.prot.get_model()
151  self.rs = IMP.RestraintSet(self.m, 'XYRadialPositionUpperRestraint')
152  self.weight=1.0
153  self.label = "None"
154 
155  xyr = IMP.npc.XYRadialPositionUpperRestraint(self.m, upper_bound, consider_radius, sigma)
156  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=1)
157  cterminal = residues[-1] #nterminal = residues[0]
158  #print (cterminal, type(cterminal))
159 
160  xyr.add_particle(cterminal)
161  self.rs.add_restraint(xyr)
162 
163  def set_label(self, label):
164  self.label = label
165 
166  def add_to_model(self):
168 
169  def get_restraint(self):
170  return self.rs
171 
172  def set_weight(self, weight):
173  self.weight = weight
174  self.rs.set_weight(self.weight)
175 
176  def get_output(self):
177  self.m.update()
178  output = {}
179  score = self.weight * self.rs.unprotected_evaluate(None)
180  output["_TotalScore"] = str(score)
181  output["XYRadialPositionUpperRestraint_" + self.label] = str(score)
182  return output
183 
184  def evaluate(self):
185  return self.weight * self.rs.unprotected_evaluate(None)
186 
187 
189  """Create Z-Axial Position restraints
190  """
191  def __init__(self,
192  representation,
193  protein,
194  lower_bound = 0.0,
195  upper_bound = 0.0,
196  consider_radius = False,
197  sigma = 1.0,
198  term = 'C'):
199  """Constructor
200  @param representation representation
201  """
202 
203  self.m = representation.prot.get_model()
204  self.rs = IMP.RestraintSet(self.m, 'ZAxialPositionRestraint')
205  self.weight=1.0
206  self.label = "None"
207 
208  zax = IMP.npc.ZAxialPositionRestraint(self.m, lower_bound, upper_bound, consider_radius, sigma)
209  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=1)
210  if term == 'C':
211  residues = residues[-1:]
212  elif term == 'N':
213  residues = residues[:1]
214  for residue in residues:
215  zax.add_particle(residue)
216 
217  self.dataset = None
218  if representation:
219  for p, state in representation._protocol_output:
220  p.add_zaxial_restraint(state, residues, lower_bound,
221  upper_bound, sigma, self)
222 
223  self.rs.add_restraint(zax)
224 
225  def set_label(self, label):
226  self.label = label
227 
228  def add_to_model(self):
230 
231  def get_restraint(self):
232  return self.rs
233 
234  def set_weight(self, weight):
235  self.weight = weight
236  self.rs.set_weight(self.weight)
237 
238  def get_output(self):
239  self.m.update()
240  output = {}
241  score = self.weight * self.rs.unprotected_evaluate(None)
242  output["_TotalScore"] = str(score)
243  output["ZAxialPositionRestraint_" + self.label] = str(score)
244  return output
245 
246  def evaluate(self):
247  return self.weight * self.rs.unprotected_evaluate(None)
248 
250  """Create Z-Axial Position Lower restraints
251  """
252  def __init__(self,
253  representation,
254  protein,
255  lower_bound = 0.0,
256  consider_radius = False,
257  sigma = 1.0):
258  """Constructor
259  @param representation representation
260  """
261 
262  self.m = representation.prot.get_model()
263  self.rs = IMP.RestraintSet(self.m, 'ZAxialPositionLowerRestraint')
264  self.weight=1.0
265  self.label = "None"
266 
267  zax = IMP.npc.ZAxialPositionLowerRestraint(self.m, lower_bound, consider_radius, sigma)
268  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=1)
269  cterminal = residues[-1] #nterminal = residues[0]
270  #print (cterminal, type(cterminal))
271 
272  zax.add_particle(cterminal)
273  self.rs.add_restraint(zax)
274 
275  def set_label(self, label):
276  self.label = label
277 
278  def add_to_model(self):
280 
281  def get_restraint(self):
282  return self.rs
283 
284  def set_weight(self, weight):
285  self.weight = weight
286  self.rs.set_weight(self.weight)
287 
288  def get_output(self):
289  self.m.update()
290  output = {}
291  score = self.weight * self.rs.unprotected_evaluate(None)
292  output["_TotalScore"] = str(score)
293  output["ZAxialPositionLowerRestraint_" + self.label] = str(score)
294  return output
295 
296  def evaluate(self):
297  return self.weight * self.rs.unprotected_evaluate(None)
298 
300  """Create Z-Axial Position Upper restraints
301  """
302  def __init__(self,
303  representation,
304  protein,
305  upper_bound = 0.0,
306  consider_radius = False,
307  sigma = 1.0):
308  """Constructor
309  @param representation representation
310  """
311 
312  self.m = representation.prot.get_model()
313  self.rs = IMP.RestraintSet(self.m, 'ZAxialPositionUpperRestraint')
314  self.weight=1.0
315  self.label = "None"
316 
317  zax = IMP.npc.ZAxialPositionUpperRestraint(self.m, upper_bound, consider_radius, sigma)
318  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=1)
319  cterminal = residues[-1] #nterminal = residues[0]
320  #print (cterminal, type(cterminal))
321 
322  zax.add_particle(cterminal)
323  self.rs.add_restraint(zax)
324 
325  def set_label(self, label):
326  self.label = label
327 
328  def add_to_model(self):
330 
331  def get_restraint(self):
332  return self.rs
333 
334  def set_weight(self, weight):
335  self.weight = weight
336  self.rs.set_weight(self.weight)
337 
338  def get_output(self):
339  self.m.update()
340  output = {}
341  score = self.weight * self.rs.unprotected_evaluate(None)
342  output["_TotalScore"] = str(score)
343  output["ZAxialPositionUpperRestraint_" + self.label] = str(score)
344  return output
345 
346  def evaluate(self):
347  return self.weight * self.rs.unprotected_evaluate(None)
348 
349 
351  """Create Y-Axial Position restraints
352  """
353  def __init__(self,
354  representation,
355  protein,
356  lower_bound = 0.0,
357  upper_bound = 0.0,
358  consider_radius = False,
359  sigma = 1.0,
360  term = 'C'):
361  """Constructor
362  @param representation representation
363  """
364 
365  self.m = representation.prot.get_model()
366  self.rs = IMP.RestraintSet(self.m, 'YAxialPositionRestraint')
367  self.weight=1.0
368  self.label = "None"
369 
370  yax = IMP.npc.YAxialPositionRestraint(self.m, lower_bound, upper_bound, consider_radius, sigma)
371  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=1)
372  if (term == 'C'):
373  terminal = residues[-1]
374  #print (terminal, type(terminal))
375  yax.add_particle(terminal)
376  elif (term == 'N'):
377  terminal = residues[0]
378  #print (terminal, type(terminal))
379  yax.add_particle(terminal)
380  else:
381  for residue in residues:
382  #print (residue, type(residue))
383  yax.add_particle(residue)
384 
385  self.dataset = None
386  if representation:
387  for p, state in representation._protocol_output:
388  p.add_yaxial_restraint(state, residues, lower_bound,
389  upper_bound, sigma, self)
390 
391  self.rs.add_restraint(yax)
392 
393  def set_label(self, label):
394  self.label = label
395 
396  def add_to_model(self):
398 
399  def get_restraint(self):
400  return self.rs
401 
402  def set_weight(self, weight):
403  self.weight = weight
404  self.rs.set_weight(self.weight)
405 
406  def get_output(self):
407  self.m.update()
408  output = {}
409  score = self.weight * self.rs.unprotected_evaluate(None)
410  output["_TotalScore"] = str(score)
411  output["YAxialPositionRestraint_" + self.label] = str(score)
412  return output
413 
414  def evaluate(self):
415  return self.weight * self.rs.unprotected_evaluate(None)
416 
418  """Create Y-Axial Position Lower restraints
419  """
420  def __init__(self,
421  representation,
422  protein,
423  lower_bound = 0.0,
424  consider_radius = False,
425  sigma = 1.0):
426  """Constructor
427  @param representation representation
428  """
429 
430  self.m = representation.prot.get_model()
431  self.rs = IMP.RestraintSet(self.m, 'YAxialPositionLowerRestraint')
432  self.weight=1.0
433  self.label = "None"
434 
435  yax = IMP.npc.YAxialPositionLowerRestraint(self.m, lower_bound, consider_radius, sigma)
436  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=1)
437  cterminal = residues[-1] #nterminal = residues[0]
438  #print (cterminal, type(cterminal))
439 
440  yax.add_particle(cterminal)
441  self.rs.add_restraint(yax)
442 
443  def set_label(self, label):
444  self.label = label
445 
446  def add_to_model(self):
448 
449  def get_restraint(self):
450  return self.rs
451 
452  def set_weight(self, weight):
453  self.weight = weight
454  self.rs.set_weight(self.weight)
455 
456  def get_output(self):
457  self.m.update()
458  output = {}
459  score = self.weight * self.rs.unprotected_evaluate(None)
460  output["_TotalScore"] = str(score)
461  output["YAxialPositionLowerRestraint_" + self.label] = str(score)
462  return output
463 
464  def evaluate(self):
465  return self.weight * self.rs.unprotected_evaluate(None)
466 
468  """Create Y-Axial Position Upper restraints
469  """
470  def __init__(self,
471  representation,
472  protein,
473  upper_bound = 0.0,
474  consider_radius = False,
475  sigma = 1.0):
476  """Constructor
477  @param representation representation
478  """
479 
480  self.m = representation.prot.get_model()
481  self.rs = IMP.RestraintSet(self.m, 'YAxialPositionUpperRestraint')
482  self.weight=1.0
483  self.label = "None"
484 
485  yax = IMP.npc.YAxialPositionUpperRestraint(self.m, upper_bound, consider_radius, sigma)
486  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=1)
487  cterminal = residues[-1] #nterminal = residues[0]
488  #print (cterminal, type(cterminal))
489 
490  yax.add_particle(cterminal)
491  self.rs.add_restraint(yax)
492 
493  def set_label(self, label):
494  self.label = label
495 
496  def add_to_model(self):
498 
499  def get_restraint(self):
500  return self.rs
501 
502  def set_weight(self, weight):
503  self.weight = weight
504  self.rs.set_weight(self.weight)
505 
506  def get_output(self):
507  self.m.update()
508  output = {}
509  score = self.weight * self.rs.unprotected_evaluate(None)
510  output["_TotalScore"] = str(score)
511  output["YAxialPositionUpperRestraint_" + self.label] = str(score)
512  return output
513 
514  def evaluate(self):
515  return self.weight * self.rs.unprotected_evaluate(None)
516 
517 
519  """Create Membrane Surface Location Restraint
520  """
521  def __init__(self,
522  representation,
523  protein,
524  tor_R = 540.0,
525  tor_r = 127.5,
526  tor_th = 45.0,
527  sigma = 0.2,
528  resolution = 1):
529  """Constructor
530  @param representation representation
531  """
532 
533  self.m = representation.prot.get_model()
534  self.rs = IMP.RestraintSet(self.m, 'MembraneSurfaceLocationRestraint')
535  self.weight=1.0
536  self.label = "None"
537 
538  msl = IMP.npc.MembraneSurfaceLocationRestraint(self.m, tor_R, tor_r, tor_th, sigma)
539  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=resolution)
540  for residue in residues:
541  #print (residue, type(residue))
542  msl.add_particle(residue)
543 
544  self.dataset = None
545  if representation:
546  for p, state in representation._protocol_output:
547  p.add_membrane_surface_location_restraint(
548  state, residues, tor_R, tor_r, tor_th, sigma, self)
549 
550  self.rs.add_restraint(msl)
551 
552  def set_label(self, label):
553  self.label = label
554 
555  def add_to_model(self):
557 
558  def get_restraint(self):
559  return self.rs
560 
561  def set_weight(self, weight):
562  self.weight = weight
563  self.rs.set_weight(self.weight)
564 
565  def get_output(self):
566  self.m.update()
567  output = {}
568  score = self.weight * self.rs.unprotected_evaluate(None)
569  output["_TotalScore"] = str(score)
570  output["MembraneSurfaceLocationRestraint_" + self.label] = str(score)
571  return output
572 
573  def evaluate(self):
574  return self.weight * self.rs.unprotected_evaluate(None)
575 
576 
578  """Create Membrane Surface Location CONDITIONAL Restraint
579  for Nup120 ALPS Motifs - Mutually Exclusive from (135,152,'Nup120') and (197,216,'Nup120').
580  It returns a minimum penalty score from two potential ALPS motifs.
581  """
582  def __init__(self,
583  representation,
584  protein1,
585  protein2,
586  tor_R = 540.0,
587  tor_r = 127.5,
588  tor_th = 45.0,
589  sigma = 0.2,
590  resolution = 1):
591  """Constructor
592  @param representation representation
593  """
594 
595  self.m = representation.prot.get_model()
596  self.rs = IMP.RestraintSet(self.m, 'MembraneSurfaceLocationConditionalRestraint')
597  self.weight=1.0
598  self.label = "None"
599 
600  msl = IMP.npc.MembraneSurfaceLocationConditionalRestraint(self.m, tor_R, tor_r, tor_th, sigma)
601  residues1 = IMP.pmi1.tools.select_by_tuple(representation, protein1, resolution=resolution)
602  for residue in residues1:
603  #print (residue, type(residue))
604  msl.add_particle1(residue)
605  residues2 = IMP.pmi1.tools.select_by_tuple(representation, protein2, resolution=resolution)
606  for residue in residues2:
607  #print (residue, type(residue))
608  msl.add_particle2(residue)
609 
610  # Approximate as two membrane restraints
611  self.dataset = None
612  if representation:
613  for p, state in representation._protocol_output:
614  for residues in residues1, residues2:
615  p.add_membrane_surface_location_restraint(
616  state, residues, tor_R, tor_r, tor_th, sigma, self)
617 
618  self.rs.add_restraint(msl)
619 
620  def set_label(self, label):
621  self.label = label
622 
623  def add_to_model(self):
625 
626  def get_restraint(self):
627  return self.rs
628 
629  def set_weight(self, weight):
630  self.weight = weight
631  self.rs.set_weight(self.weight)
632 
633  def get_output(self):
634  self.m.update()
635  output = {}
636  score = self.weight * self.rs.unprotected_evaluate(None)
637  output["_TotalScore"] = str(score)
638  output["MembraneSurfaceLocationConditionalRestraint_" + self.label] = str(score)
639  return output
640 
641  def evaluate(self):
642  return self.weight * self.rs.unprotected_evaluate(None)
643 
644 
646  """Create Membrane Exclusion Restraint
647  """
648  def __init__(self,
649  representation,
650  protein,
651  tor_R = 540.0,
652  tor_r = 127.5,
653  tor_th = 45.0,
654  sigma = 0.2,
655  resolution = 1):
656  """Constructor
657  @param representation representation
658  """
659 
660  self.m = representation.prot.get_model()
661  self.rs = IMP.RestraintSet(self.m, 'MembraneExclusionRestraint')
662  self.weight=1.0
663  self.label = "None"
664 
665  mex = IMP.npc.MembraneExclusionRestraint(self.m, tor_R, tor_r, tor_th, sigma)
666  residues = IMP.pmi1.tools.select_by_tuple(representation, protein, resolution=resolution)
667  for residue in residues:
668  #print (residue, type(residue))
669  mex.add_particle(residue)
670 
671  self.dataset = None
672  if representation:
673  for p, state in representation._protocol_output:
674  p.add_membrane_exclusion_restraint(
675  state, residues, tor_R, tor_r, tor_th, sigma, self)
676 
677  self.rs.add_restraint(mex)
678 
679  def set_label(self, label):
680  self.label = label
681 
682  def add_to_model(self):
684 
685  def get_restraint(self):
686  return self.rs
687 
688  def set_weight(self, weight):
689  self.weight = weight
690  self.rs.set_weight(self.weight)
691 
692  def get_output(self):
693  self.m.update()
694  output = {}
695  score = self.weight * self.rs.unprotected_evaluate(None)
696  output["_TotalScore"] = str(score)
697  output["MembraneExclusionRestraint_" + self.label] = str(score)
698  return output
699 
700  def evaluate(self):
701  return self.weight * self.rs.unprotected_evaluate(None)
Create XYRadial Position Lower restraints.
Restrain particles by their z coordinate.
Create Y-Axial Position Upper restraints.
Create Z-Axial Position Lower restraints.
Create XYRadial Position Restraint.
Restrain particles by their y coordinate.
Create Z-Axial Position restraints.
Create Membrane Surface Location CONDITIONAL Restraint for Nup120 ALPS Motifs - Mutually Exclusive fr...
Restrain particles by their distance from the z axis in the xy plane.
Create Z-Axial Position Upper restraints.
Try to keep one set of particles localized on a membrane surface.
Restrain particles by their z coordinate.
Object used to hold a set of restraints.
Definition: RestraintSet.h:41
Create Membrane Exclusion Restraint.
Miscellaneous utilities.
Definition: /tools.py:1
Create Y-Axial Position restraints.
Create Membrane Surface Location Restraint.
Try to keep particles away from a membrane.
Restrain particles by their distance from the z axis in the xy plane.
Try to keep particles localized on a membrane surface.
Create XYRadial Position Upper restraints.
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 particles by their y coordinate.
def add_restraint_to_model
Add a PMI restraint to the model.
Definition: /tools.py:53
Restrain particles by their y coordinate.
Create Y-Axial Position Lower restraints.