IMP logo
IMP Reference Guide  2.12.0
The Integrative Modeling Platform
pmi/restraints/proteomics.py
1 """@namespace IMP.pmi.restraints.proteomics
2 Restraints for handling various kinds of proteomics data.
3 """
4 
5 from __future__ import print_function
6 import IMP
7 import IMP.core
8 import IMP.algebra
9 import IMP.atom
10 import IMP.container
11 import IMP.pmi
12 import IMP.pmi.tools
13 import IMP.pmi.output
14 import numpy
15 import math
16 import math
17 import sys
18 import warnings
19 
20 
21 class ConnectivityRestraint(object):
22 
23  '''
24  generate a connectivity restraint between domains
25  setting up the restraint
26  example:
27  sel1 = IMP.atom.Selection(root_hier, molecule="Rpb3",
28  residue_indexes=range(1,100))
29  sel2 = IMP.atom.Selection(root_hier, molecule="Rpb4",
30  residue_indexes=range(1,100))
31  cr=restraints.ConnectivityRestraint((sel1, sel2), label='CR1')
32  cr.add_to_model()
33  Multistate support =No
34  Resolution=Yes
35  '''
36 
37  def __init__(self, domains, kappa=10.0, resolution=None, label="None"):
38  self.weight = 1.0
39  self.kappa = kappa
40  self.label = label
41 
43  domains, self.kappa, self.label)
44  self.m = cr.get_model()
45  self.rs = IMP.RestraintSet(self.m, label)
46  self.rs.add_restraint(cr)
47 
48  def set_label(self, label):
49  self.label = label
50  self.rs.set_name(label)
51  for r in self.rs.get_restraints():
52  r.set_name(label)
53 
54  def add_to_model(self):
56 
57  def get_restraint(self):
58  return self.rs
59 
60  def get_restraints(self):
61  rlist = []
62  for r in self.rs.get_restraints():
63  rlist.append(IMP.core.PairRestraint.get_from(r))
64  return rlist
65 
66  def set_weight(self, weight):
67  self.weight = weight
68  self.rs.set_weight(weight)
69 
70  def get_output(self):
71  output = {}
72  score = self.weight * self.rs.unprotected_evaluate(None)
73  output["_TotalScore"] = str(score)
74  output["ConnectivityRestraint_" + self.label] = str(score)
75  return output
76 
77 #
78 
79 
80 class CompositeRestraint(object):
81 
82  '''
83  handleparticles a list of particles
84  compositeparticles is a list of list of particles
85  '''
86 
87  def __init__(self, handle_particles, composite_particles, cut_off=5.0,
88  lam=1.0, plateau=0.0, resolution=None, label="None"):
89  # composite particles: all particles beside the handle
90  self.label = label
91 
92  hs = IMP.pmi.tools.input_adaptor(handle_particles, resolution,
93  flatten=True)
94  self.handleparticles = [h.get_particle() for h in hs]
95  self.m = self.handleparticles[0].get_model()
96  self.rs = IMP.RestraintSet(self.m, 'cr')
97 
98  self.compositeparticles = []
99  compositeparticle_list = []
100  for cp in composite_particles:
101  hs = IMP.pmi.tools.input_adaptor(cp, resolution, flatten=True)
102  tmplist = [h.get_particle() for h in hs]
103  compositeparticle_list.append(tmplist)
104  self.compositeparticles += tmplist
105 
106  ln = IMP.pmi.CompositeRestraint(self.m, self.handleparticles, cut_off,
107  lam, True, plateau)
108 
109  for ps in compositeparticle_list:
110  # composite particles is a list of list of particles
111  ln.add_composite_particle(ps)
112 
113  self.rs.add_restraint(ln)
114 
115  def set_label(self, label):
116  self.label = label
117 
118  def get_handle_particles(self):
119  return self.handleparticles
120 
121  def get_composite_particles(self):
122  return self.compositeparticles
123 
124  def get_restraint(self):
125  return self.rs
126 
127  def add_to_model(self):
128  IMP.pmi.tools.add_restraint_to_model(self.m, self.rs)
129 
130  def get_output(self):
131  output = {}
132  score = self.rs.unprotected_evaluate(None)
133  output["_TotalScore"] = str(score)
134  output["CompositeRestraint_" + self.label] = str(score)
135  return output
136 
137 
138 #
140 
141  '''
142  this restraint allows ambiguous crosslinking between multiple copies
143  excluding between symmetric copies
144  It allows name ambiguity
145  '''
146 
147  def __init__(self, root_hier, restraints_file, cut_off=5.0, lam=1.0,
148  plateau=0.01, resolution=None, label="None"):
149  self.weight = 1.0
150  self.m = root_hier.get_model()
151  self.rs = IMP.RestraintSet(self.m, 'data')
152  self.label = "None"
153  self.pairs = []
154 
155  self.outputlevel = "low"
156  self.cut_off = cut_off
157  self.lam = lam
158  self.plateau = plateau
159 
160  fl = IMP.pmi.tools.open_file_or_inline_text(restraints_file)
161 
162  for line in fl:
163 
164  tokens = line.split()
165  # skip character
166  if (tokens[0] == "#"):
167  continue
168  r1 = int(tokens[2])
169  c1 = tokens[0]
170  r2 = int(tokens[3])
171  c2 = tokens[1]
172 
173  ps1 = IMP.atom.Selection(root_hier, resolution=resolution,
174  molecule=c1, residue_index=r1)
175  ps1 = ps1.get_selected_particles()
176  hrc1 = [p.get_name() for p in ps1]
177  def nosym_subset(ps):
178  return [p for p in ps if not IMP.pmi.Symmetric.get_is_setup(p)
179  or IMP.pmi.Symmetric(p).get_symmetric() == 0]
180  ps1nosym = nosym_subset(ps1)
181  hrc1nosym = [p.get_name() for p in ps1nosym]
182 
183  if len(ps1) == 0:
184  warnings.warn(
185  "AmbiguousCompositeRestraint: residue %d of chain %s "
186  "is not there" % (r1, c1), IMP.pmi.StructureWarning)
187  continue
188 
189  ps2 = IMP.atom.Selection(root_hier, resolution=resolution,
190  molecule=c2, residue_index=r2)
191  ps2 = ps2.get_selected_particles()
192  hrc2 = [p.get_name() for p in ps2]
193  ps2nosym = nosym_subset(ps2)
194  hrc2nosym = [p.get_name() for p in ps2nosym]
195 
196  if len(ps2) == 0:
197  warnings.warn(
198  "AmbiguousCompositeRestraint: residue %d of chain %s "
199  "is not there" % (r2, c2), IMP.pmi.StructureWarning)
200  continue
201 
203  self.m, ps1nosym, self.cut_off, self.lam, True, self.plateau)
204  cr.add_composite_particle(ps2)
205 
206  self.rs.add_restraint(cr)
207  self.pairs.append(
208  (ps1nosym,
209  hrc1nosym,
210  c1,
211  r1,
212  ps2,
213  hrc2,
214  c2,
215  r2,
216  cr))
217 
219  self.m, ps1, self.cut_off, self.lam, True, self.plateau)
220  cr.add_composite_particle(ps2nosym)
221 
222  self.rs.add_restraint(cr)
223  self.pairs.append(
224  (ps1,
225  hrc1,
226  c1,
227  r1,
228  ps2nosym,
229  hrc2nosym,
230  c2,
231  r2,
232  cr))
233 
234  def plot_restraint(
235  self,
236  maxdist=100,
237  npoints=100):
238 
239  p1 = IMP.Particle(self.m)
240  p2 = IMP.Particle(self.m)
244  self.m,
245  [p1],
246  self.cut_off,
247  self.lam,
248  True,
249  self.plateau)
250  cr.add_composite_particle([p2])
251  dists = []
252  scores = []
253  for i in range(npoints):
254  d2.set_coordinates(
255  IMP.algebra.Vector3D(maxdist / npoints * float(i), 0, 0))
256  dists.append(IMP.core.get_distance(d1, d2))
257  scores.append(cr.unprotected_evaluate(None))
258  IMP.pmi.output.plot_xy_data(dists, scores)
259 
260  def set_label(self, label):
261  self.label = label
262  self.rs.set_name(label)
263  for r in self.rs.get_restraints():
264  r.set_name(label)
265 
266  def add_to_model(self):
267  IMP.pmi.tools.add_restraint_to_model(self.m, self.rs)
268 
269  def get_hierarchies(self):
270  return self.prot
271 
272  def get_restraint_sets(self):
273  return self.rs
274 
275  def get_restraint(self):
276  return self.rs
277 
278  def set_output_level(self, level="low"):
279  # this might be "low" or "high"
280  self.outputlevel = level
281 
282  def set_weight(self, weight):
283  self.weight = weight
284  self.rs.set_weight(weight)
285 
286  def get_output(self):
287  # content of the crosslink database pairs
288  # self.pairs.append((p1,p2,dr,r1,c1,r2,c2))
289  output = {}
290  score = self.weight * self.rs.unprotected_evaluate(None)
291  output["_TotalScore"] = str(score)
292  output["AmbiguousCompositeRestraint_Score_" + self.label] = str(score)
293  for n, p in enumerate(self.pairs):
294 
295  ps1 = p[0]
296  hrc1 = p[1]
297  c1 = p[2]
298  r1 = p[3]
299  ps2 = p[4]
300  hrc2 = p[5]
301  c2 = p[6]
302  r2 = p[7]
303  cr = p[8]
304  for n1, p1 in enumerate(ps1):
305  name1 = hrc1[n1]
306 
307  for n2, p2 in enumerate(ps2):
308  name2 = hrc2[n2]
309  d1 = IMP.core.XYZR(p1)
310  d2 = IMP.core.XYZR(p2)
311  label = str(r1) + ":" + name1 + "_" + str(r2) + ":" + name2
312  output["AmbiguousCompositeRestraint_Distance_" +
313  label] = str(IMP.core.get_distance(d1, d2))
314 
315  label = str(r1) + ":" + c1 + "_" + str(r2) + ":" + c2
316  output["AmbiguousCompositeRestraint_Score_" +
317  label] = str(self.weight * cr.unprotected_evaluate(None))
318 
319  return output
320 
321 
322 #
323 class SimplifiedPEMAP(object):
324 
325  def __init__(self, root_hier, restraints_file, expdistance, strength,
326  resolution=None):
327  self.m = root_hier.get_model()
328  self.rs = IMP.RestraintSet(self.m, 'data')
329  self.label = "None"
330  self.pairs = []
331 
332  self.outputlevel = "low"
333  self.expdistance = expdistance
334  self.strength = strength
335 
336  fl = IMP.pmi.tools.open_file_or_inline_text(restraints_file)
337 
338  for line in fl:
339 
340  tokens = line.split()
341  # skip character
342  if (tokens[0] == "#"):
343  continue
344  r1 = int(tokens[2])
345  c1 = tokens[0]
346  r2 = int(tokens[3])
347  c2 = tokens[1]
348  pcc = float(tokens[4])
349 
350  ps1 = IMP.atom.Selection(root_hier, resolution=resolution,
351  molecule=c1, residue_index=r1,
352  copy_index=0)
353  ps1 = ps1.get_selected_particles()
354  if len(ps1) == 0:
355  warnings.warn(
356  "SimplifiedPEMAP: residue %d of chain %s is not there "
357  "(w/ %d %s)" % (r1, c1, r2, c2), IMP.pmi.StructureWarning)
358  continue
359  if len(ps1) > 1:
360  warnings.warn(
361  "SimplifiedPEMAP: residue %d of chain %s selected "
362  "multiple particles" % (r1, c1), IMP.pmi.StructureWarning)
363  continue
364 
365  ps2 = IMP.atom.Selection(root_hier, resolution=resolution,
366  molecule=c2, residue_index=r2,
367  copy_index=0)
368  ps2 = ps2.get_selected_particles()
369  if len(ps2) == 0:
370  warnings.warn(
371  "SimplifiedPEMAP: residue %d of chain %s is not there "
372  "(w/ %d %s)" % (r1, c1, r2, c2), IMP.pmi.StructureWarning)
373  continue
374  if len(ps2) > 1:
375  warnings.warn(
376  "SimplifiedPEMAP: residue %d of chain %s selected "
377  "multiple particles" % (r2, c2), IMP.pmi.StructureWarning)
378  continue
379 
380  p1 = ps1[0]
381  p2 = ps2[0]
382 
383  # This is harmonic potential for the pE-MAP data
384  upperdist = self.get_upper_bond(pcc)
385  limit = 0.5 * self.strength * 15.0 ** 2 + 10.0
387  upperdist, self.strength, 15, limit)
388 
389  # This is harmonic for the X-link
390  #hub= IMP.core.TruncatedHarmonicBound(17.0,self.strength,upperdist+15,limit)
391 
393  dr = IMP.core.PairRestraint(self.m, df, (p1, p2))
394  self.rs.add_restraint(dr)
395  self.pairs.append((p1, p2, dr, r1, c1, r2, c2))
396 
397  # Lower-bound restraint
398  lowerdist = self.get_lower_bond(pcc)
399  limit = 0.5 * self.strength * 15.0 ** 2 + 10.0
401  lowerdist, self.strength, 15, limit)
402 
403  # This is harmonic for the X-link
404  #hub2= IMP.core.TruncatedHarmonicBound(17.0,self.strength,upperdist+15,limit)
405 
407  dr2 = IMP.core.PairRestraint(self.m, df2, (p1, p2))
408  self.rs.add_restraint(dr2)
409  self.pairs.append((p1, p2, dr2, r1, c1, r2, c2))
410 
411  def get_upper_bond(self, pearsoncc):
412  # return (pearsoncc-1.)/-0.0075
413  return (pearsoncc - .5) / (-0.005415)
414 
415  def get_lower_bond(self, pearsoncc):
416  return (pearsoncc - 1.) / -0.0551
417 
418  def set_label(self, label):
419  self.label = label
420 
421  def add_to_model(self):
422  IMP.pmi.tools.add_restraint_to_model(self.m, self.rs)
423 
424  def get_hierarchies(self):
425  return self.prot
426 
427  def get_restraint_sets(self):
428  return self.rs
429 
430  def set_output_level(self, level="low"):
431  # this might be "low" or "high"
432  self.outputlevel = level
433 
434  def get_output(self):
435  # content of the crosslink database pairs
436  # self.pairs.append((p1,p2,dr,r1,c1,r2,c2))
437  output = {}
438  score = self.rs.unprotected_evaluate(None)
439  output["_TotalScore"] = str(score)
440  output["SimplifiedPEMAP_Score_" + self.label] = str(score)
441  for i in range(len(self.pairs)):
442 
443  p0 = self.pairs[i][0]
444  p1 = self.pairs[i][1]
445  crosslinker = 'standard'
446  ln = self.pairs[i][2]
447  resid1 = self.pairs[i][3]
448  chain1 = self.pairs[i][4]
449  resid2 = self.pairs[i][5]
450  chain2 = self.pairs[i][6]
451 
452  label = str(resid1) + ":" + chain1 + "_" + \
453  str(resid2) + ":" + chain2
454  output["SimplifiedPEMAP_Score_" + crosslinker + "_" +
455  label] = str(ln.unprotected_evaluate(None))
456 
457  d0 = IMP.core.XYZ(p0)
458  d1 = IMP.core.XYZ(p1)
459  output["SimplifiedPEMAP_Distance_" +
460  label] = str(IMP.core.get_distance(d0, d1))
461 
462  return output
463 
464 
466 
467  '''
468  generates and wraps a IMP.pmi.ConnectivityRestraint between domains
469  example:
470  cr=restraints.ConnectivityNetworkRestraint(simo,["CCC",(1,100,"TTT"),(100,150,"AAA")])
471  cr.add_to_model()
472  cr.set_label("CR1")
473 
474  Multistate support =No
475  Selection type=selection tuple
476  Resolution=Yes
477  '''
478 
479  def __init__(
480  self,
481  representation=None,
482  objects=None,
483  kappa=10.0,
484  resolution=1.0,
485  label="None"):
486 
487  self.weight = 1.0
488  self.kappa = kappa
489  self.label = label
490  if self.label == "None":
491  self.label = str(selection_tuples)
492 
493  hiers=[]
494 
495  if representation is None:
496  print(objects)
497  for obj in objects:
498  hiers.append(IMP.pmi.tools.input_adaptor(obj,
499  resolution,
500  flatten=True))
501  self.m=hiers[0][0].get_model()
502  else:
503  self.m = representation.m
504  for s in objects:
505  hiers.append(IMP.pmi.tools.select_by_tuple(representation, s,
506  resolution=resolution,
507  name_is_ambiguous=False))
508 
509  #particles=[h.get_particle() for h in hiers]
510  cr = ConnectivityNetworkRestraint(self.m)
511  for hs in hiers:
512  cr.add_particles([h.get_particle() for h in hs])
513  self.rs = IMP.RestraintSet(self.m, label)
514  self.rs.add_restraint(cr)
515 
516  def set_label(self, label):
517  self.label = label
518  self.rs.set_name(label)
519  for r in self.rs.get_restraints():
520  r.set_name(label)
521 
522  def add_to_model(self):
523  IMP.pmi.tools.add_restraint_to_model(self.m, self.rs)
524 
525  def get_restraint(self):
526  return self.rs
527 
528  def get_restraints(self):
529  rlist = []
530  for r in self.rs.get_restraints():
531  rlist.append(IMP.core.PairRestraint.get_from(r))
532  return rlist
533 
534  def set_weight(self, weight):
535  self.weight = weight
536  self.rs.set_weight(weight)
537 
538  def get_output(self):
539  output = {}
540  score = self.weight * self.rs.unprotected_evaluate(None)
541  output["_TotalScore"] = str(score)
542  output["ConnectivityNetworkRestraint_" + self.label] = str(score)
543  return output
544 
545 
547 
548  '''
549  a python restraint that computes the score for a composite of proteins
550  Authors: G. Bouvier, R. Pellarin. Pasteur Institute.
551  '''
552 
553  def __init__(self, m, slope=1.0, theta=0.0, plateau=0.0000000001, linear_slope=0.015):
554  '''
555  input a list of particles, the slope and theta of the sigmoid potential
556  theta is the cutoff distance for a protein-protein contact
557  '''
558  # Import networkx here so that we don't introduce it as a dependency
559  # for *every* proteomics restraint, only this one
560  import networkx
561  self.networkx = networkx
562  IMP.Restraint.__init__(self, m, "ConnectivityNetworkRestraint %1%")
563  self.slope = slope
564  self.theta = theta
565  self.linear_slope = linear_slope
566  self.plateau = plateau
567  self.particles_blocks = []
568  self.particle_list = []
569 
570  def get_number_of_particle_blocks(self):
571  return len(self.particles_blocks)
572 
573  def get_number_of_particles_for_block(self, block_index):
574  return len(self.particles_blocks[block_index])
575 
576  def add_particles(self, particles):
577  self.particles_blocks.append(particles)
578  self.particle_list += particles
579 
580  def get_full_graph(self):
581  '''
582  get the full graph of distances between every particle pair
583  '''
584  import scipy.spatial
585  pdist_array = numpy.array(
587  pdist_mat = scipy.spatial.distance.squareform(pdist_array)
588  pdist_mat[pdist_mat < 0] = 0
589  graph = self.networkx.Graph(pdist_mat)
590  return graph
591 
593  """
594  return the minimum spanning tree
595  """
596  graph = self.get_full_graph()
597  graph = self.networkx.minimum_spanning_tree(graph)
598  return graph
599 
600  def sigmoid(self, x):
601  '''
602  a sigmoid function that scores the probability of a contact
603  between two proteins
604  '''
605  # return 1 - (x)**self.slope/ float(((x)**self.slope +
606  # self.theta**self.slope))
607  argvalue = (x - self.theta) / self.slope
608  return 1.0 - (1.0 - self.plateau) / (1.0 + math.exp(-argvalue))
609 
610  def unprotected_evaluate(self, da):
611  graph = self.get_minimum_spanning_tree()
612  score = 0.0
613  for e in graph.edges():
614  dist = graph.get_edge_data(*e)['weight']
615  prob = self.sigmoid(dist)
616  score += -numpy.log(prob)
617  score += self.linear_slope * dist
618  return score
619 
620  def do_get_inputs(self):
621  return self.particle_list
622 
623 
624 class FuzzyBoolean(object):
625 
626  '''
627  Fully Ambiguous Restraint that can be built using boolean logic
628  R. Pellarin. Pasteur Institute.
629  '''
630 
631  def __init__(self, p1, operator=None, p2=None):
632  '''
633  input a list of particles, the slope and theta of the sigmoid potential
634  theta is the cutoff distance for a protein-protein contact
635  '''
636  if isinstance(p1, FuzzyBoolean) and isinstance(p2, FuzzyBoolean):
637  self.operations = [p1, operator, p2]
638  self.value = None
639  else:
640  self.operations = []
641  self.value = p1
642 
643  def __or__(self, FuzzyBoolean2):
644  return FuzzyBoolean(self, self.or_, FuzzyBoolean2)
645 
646  def __and__(self, FuzzyBoolean2):
647  return FuzzyBoolean(self, self.and_, FuzzyBoolean2)
648 
649  def and_(self, a, b):
650  return a * b
651 
652  def or_(self, a, b):
653  return 1.0 - (1.0 - a) * (1.0 - b)
654 
655  def evaluate(self):
656 
657  if len(self.operations) == 0:
658  return self.value
659  FuzzyBoolean1, op, FuzzyBoolean2 = self.operations
660 
661  return op(FuzzyBoolean1.evaluate(), FuzzyBoolean2.evaluate())
662 
663 
665 
666  '''
667  Fully Ambiguous Restraint that can be built using boolean logic
668  R. Pellarin. Pasteur Institute.
669  '''
670  plateau = 0.00000000000001
671  theta = 5.0
672  slope = 2.0
673  innerslope = 0.01
674 
675  def __init__(self, m, p1, p2, operator=None):
676  '''
677  input a list of particles, the slope and theta of the sigmoid potential
678  theta is the cutoff distance for a protein-protein contact
679  '''
680  IMP.Restraint.__init__(self, m, "FuzzyRestraint %1%")
681  self.m = m
682  self.min = sys.float_info.min
683  if isinstance(p1, FuzzyRestraint) and isinstance(p2, FuzzyRestraint):
684  self.operations = [p1, operator, p2]
685  self.particle_pair = None
686  elif isinstance(p1, FuzzyRestraint) and p2 is None:
687  self.operations = [p1, operator, None]
688  self.particle_pair = None
689  else:
690  self.operations = []
691  self.particle_pair = (p1, p2)
692 
693  def __or__(self, FuzzyRestraint2):
694  return FuzzyRestraint(self.m, self, FuzzyRestraint2, self.or_)
695 
696  def __and__(self, FuzzyRestraint2):
697  return FuzzyRestraint(self.m, self, FuzzyRestraint2, self.and_)
698 
699  def __invert__(self):
700  return FuzzyRestraint(self.m, self, None, self.invert_)
701 
702  def and_(self, a, b):
703  c = a + b
704  return c
705 
706  def or_(self, a, b):
707  c = math.exp(-a) + math.exp(-b) - math.exp(-a - b)
708  return -math.log(c)
709 
710  def invert_(self, a):
711  c = 1.0 - math.exp(-a)
712  return -math.log(c)
713 
714  def evaluate(self):
715  if len(self.operations) == 0:
716  return self.distance()
717  FuzzyRestraint1, op, FuzzyRestraint2 = self.operations
718 
719  if FuzzyRestraint2 is not None:
720  return op(FuzzyRestraint1.evaluate(), FuzzyRestraint2.evaluate())
721  else:
722  return op(FuzzyRestraint1.evaluate())
723 
724  def distance(self):
725  d1 = IMP.core.XYZ(self.particle_pair[0])
726  d2 = IMP.core.XYZ(self.particle_pair[1])
727  d = IMP.core.get_distance(d1, d2)
728  argvalue = (d-self.theta)/self.slope
729  return -math.log(1.0 -(1.0-self.plateau)/(1.0+math.exp(-argvalue)))+self.innerslope*d
730 
731  def add_to_model(self):
733 
734  def unprotected_evaluate(self, da):
735  return self.evaluate()
736 
737  def __str__(self):
738  if len(self.operations) == 0:
739  return str(self.particle_pair)
740  FuzzyRestraint1, op, FuzzyRestraint2 = self.operations
741  if FuzzyRestraint2 is not None:
742  return str(FuzzyRestraint1) +str(op)+str(FuzzyRestraint2)
743  else:
744  return str(FuzzyRestraint1) +str(op)
745 
746  def do_get_inputs(self):
747  if len(self.operations) == 0:
748  return list(self.particle_pair)
749  FuzzyRestraint1, op, FuzzyRestraint2 = self.operations
750  if FuzzyRestraint2 is not None:
751  return list(set(FuzzyRestraint1.do_get_inputs() +FuzzyRestraint2.do_get_inputs()))
752  else:
753  return list(set(FuzzyRestraint1.do_get_inputs()))
A function that is harmonic over an interval.
this restraint allows ambiguous crosslinking between multiple copies excluding between symmetric copi...
void add_particles(RMF::FileHandle fh, const ParticlesTemp &hs)
Various classes to hold sets of particles.
static XYZR setup_particle(Model *m, ParticleIndex pi)
Definition: XYZR.h:48
generate a connectivity restraint between domains setting up the restraint example: sel1 = IMP...
def get_full_graph
get the full graph of distances between every particle pair
Miscellaneous utilities.
Definition: tools.py:1
Add symmetric attribute to a particle.
Definition: Symmetric.h:23
A score on the distance between the surfaces of two spheres.
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
Definition: XYZR.h:89
generates and wraps a IMP.pmi.ConnectivityRestraint between domains example: cr=restraints.ConnectivityNetworkRestraint(simo,["CCC",(1,100,"TTT"),(100,150,"AAA")]) cr.add_to_model() cr.set_label("CR1")
Object used to hold a set of restraints.
Definition: RestraintSet.h:36
def input_adaptor
Adapt things for PMI (degrees of freedom, restraints, ...) Returns list of list of hierarchies...
Definition: tools.py:918
Warning related to handling of structures.
a python restraint that computes the score for a composite of proteins Authors: G.
def __init__
input a list of particles, the slope and theta of the sigmoid potential theta is the cutoff distance ...
def add_restraint_to_model
Add a PMI restraint to the model.
Definition: tools.py:89
static bool get_is_setup(Model *m, ParticleIndex pi)
Definition: Symmetric.h:29
A restraint for ambiguous cross-linking MS data and multiple state approach.
A decorator for a particle with x,y,z coordinates.
Definition: XYZ.h:30
handleparticles a list of particles compositeparticles is a list of list of particles ...
Classes for writing output files and processing them.
Definition: output.py:1
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
Fully Ambiguous Restraint that can be built using boolean logic R.
def __init__
input a list of particles, the slope and theta of the sigmoid potential theta is the cutoff distance ...
VectorD< 3 > Vector3D
Definition: VectorD.h:421
Class to handle individual particles of a Model object.
Definition: Particle.h:41
Floats get_list_of_bipartite_minimum_sphere_distance(const ParticlesTemps &pss)
Definition: pmi/utilities.h:71
def sigmoid
a sigmoid function that scores the probability of a contact between two proteins
Restraint * create_connectivity_restraint(const Selections &s, double x0, double k, std::string name="Connectivity%1%")
Create a restraint connecting the selections.
Applies a PairScore to a Pair.
Definition: PairRestraint.h:29
Python classes to represent, score, sample and analyze models.
Functionality for loading, creating, manipulating and scoring atomic structures.
Select hierarchy particles identified by the biological name.
Definition: Selection.h:66
Fully Ambiguous Restraint that can be built using boolean logic R.
def __init__
input a list of particles, the slope and theta of the sigmoid potential theta is the cutoff distance ...
virtual ModelObjectsTemp do_get_inputs() const =0
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:54
A decorator for a particle with x,y,z coordinates and a radius.
Definition: XYZR.h:27