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