IMP logo
IMP Reference Guide  2.18.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 sys
17 import warnings
18 
19 
20 class ConnectivityRestraint(object):
21 
22  '''
23  generate a connectivity restraint between domains
24  setting up the restraint
25  example:
26  sel1 = IMP.atom.Selection(root_hier, molecule="Rpb3",
27  residue_indexes=range(1,100))
28  sel2 = IMP.atom.Selection(root_hier, molecule="Rpb4",
29  residue_indexes=range(1,100))
30  cr=restraints.ConnectivityRestraint((sel1, sel2), label='CR1')
31  cr.add_to_model()
32  Multistate support =No
33  Resolution=Yes
34  '''
35 
36  def __init__(self, domains, kappa=10.0, resolution=None, label="None"):
37  self.weight = 1.0
38  self.kappa = kappa
39  self.label = label
40 
42  domains, self.kappa, self.label)
43  self.m = cr.get_model()
44  self.rs = IMP.RestraintSet(self.m, label)
45  self.rs.add_restraint(cr)
46 
47  def set_label(self, label):
48  self.label = label
49  self.rs.set_name(label)
50  for r in self.rs.get_restraints():
51  r.set_name(label)
52 
53  def add_to_model(self):
55 
56  def get_restraint(self):
57  return self.rs
58 
59  def get_restraints(self):
60  rlist = []
61  for r in self.rs.get_restraints():
62  rlist.append(IMP.core.PairRestraint.get_from(r))
63  return rlist
64 
65  def set_weight(self, weight):
66  self.weight = weight
67  self.rs.set_weight(weight)
68 
69  def get_output(self):
70  output = {}
71  score = self.weight * self.rs.unprotected_evaluate(None)
72  output["_TotalScore"] = str(score)
73  output["ConnectivityRestraint_" + self.label] = str(score)
74  return output
75 
76 #
77 
78 
79 class CompositeRestraint(object):
80 
81  '''
82  handleparticles a list of particles
83  compositeparticles is a list of list of particles
84  '''
85 
86  def __init__(self, handle_particles, composite_particles, cut_off=5.0,
87  lam=1.0, plateau=0.0, resolution=None, label="None"):
88  # composite particles: all particles beside the handle
89  self.label = label
90 
91  hs = IMP.pmi.tools.input_adaptor(handle_particles, resolution,
92  flatten=True)
93  self.handleparticles = [h.get_particle() for h in hs]
94  self.m = self.handleparticles[0].get_model()
95  self.rs = IMP.RestraintSet(self.m, 'cr')
96 
97  self.compositeparticles = []
98  compositeparticle_list = []
99  for cp in composite_particles:
100  hs = IMP.pmi.tools.input_adaptor(cp, resolution, flatten=True)
101  tmplist = [h.get_particle() for h in hs]
102  compositeparticle_list.append(tmplist)
103  self.compositeparticles += tmplist
104 
106  self.m, self.handleparticles, cut_off, lam, True, plateau)
107 
108  for ps in compositeparticle_list:
109  # composite particles is a list of list of particles
110  ln.add_composite_particle(ps)
111 
112  self.rs.add_restraint(ln)
113 
114  def set_label(self, label):
115  self.label = label
116 
117  def get_handle_particles(self):
118  return self.handleparticles
119 
120  def get_composite_particles(self):
121  return self.compositeparticles
122 
123  def get_restraint(self):
124  return self.rs
125 
126  def add_to_model(self):
127  IMP.pmi.tools.add_restraint_to_model(self.m, self.rs)
128 
129  def get_output(self):
130  output = {}
131  score = self.rs.unprotected_evaluate(None)
132  output["_TotalScore"] = str(score)
133  output["CompositeRestraint_" + self.label] = str(score)
134  return output
135 
136 
137 #
139 
140  '''
141  this restraint allows ambiguous cross-linking between multiple copies
142  excluding between symmetric copies
143  It allows name ambiguity
144  '''
145 
146  def __init__(self, root_hier, restraints_file, cut_off=5.0, lam=1.0,
147  plateau=0.01, resolution=None, label="None"):
148  self.weight = 1.0
149  self.m = root_hier.get_model()
150  self.rs = IMP.RestraintSet(self.m, 'data')
151  self.label = "None"
152  self.pairs = []
153 
154  self.outputlevel = "low"
155  self.cut_off = cut_off
156  self.lam = lam
157  self.plateau = plateau
158 
159  fl = IMP.pmi.tools.open_file_or_inline_text(restraints_file)
160 
161  for line in fl:
162 
163  tokens = line.split()
164  # skip character
165  if (tokens[0] == "#"):
166  continue
167  r1 = int(tokens[2])
168  c1 = tokens[0]
169  r2 = int(tokens[3])
170  c2 = tokens[1]
171 
172  ps1 = IMP.atom.Selection(root_hier, resolution=resolution,
173  molecule=c1, residue_index=r1)
174  ps1 = ps1.get_selected_particles()
175  hrc1 = [p.get_name() for p in ps1]
176 
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 cross-link 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
391  dr = IMP.core.PairRestraint(self.m, df, (p1, p2))
392  self.rs.add_restraint(dr)
393  self.pairs.append((p1, p2, dr, r1, c1, r2, c2))
394 
395  # Lower-bound restraint
396  lowerdist = self.get_lower_bond(pcc)
397  limit = 0.5 * self.strength * 15.0 ** 2 + 10.0
399  lowerdist, self.strength, 15, limit)
400 
401  # This is harmonic for the X-link
403  dr2 = IMP.core.PairRestraint(self.m, df2, (p1, p2))
404  self.rs.add_restraint(dr2)
405  self.pairs.append((p1, p2, dr2, r1, c1, r2, c2))
406 
407  def get_upper_bond(self, pearsoncc):
408  # return (pearsoncc-1.)/-0.0075
409  return (pearsoncc - .5) / (-0.005415)
410 
411  def get_lower_bond(self, pearsoncc):
412  return (pearsoncc - 1.) / -0.0551
413 
414  def set_label(self, label):
415  self.label = label
416 
417  def add_to_model(self):
418  IMP.pmi.tools.add_restraint_to_model(self.m, self.rs)
419 
420  def get_hierarchies(self):
421  return self.prot
422 
423  def get_restraint_sets(self):
424  return self.rs
425 
426  def set_output_level(self, level="low"):
427  # this might be "low" or "high"
428  self.outputlevel = level
429 
430  def get_output(self):
431  # content of the cross-link database pairs
432  # self.pairs.append((p1,p2,dr,r1,c1,r2,c2))
433  output = {}
434  score = self.rs.unprotected_evaluate(None)
435  output["_TotalScore"] = str(score)
436  output["SimplifiedPEMAP_Score_" + self.label] = str(score)
437  for i in range(len(self.pairs)):
438 
439  p0 = self.pairs[i][0]
440  p1 = self.pairs[i][1]
441  crosslinker = 'standard'
442  ln = self.pairs[i][2]
443  resid1 = self.pairs[i][3]
444  chain1 = self.pairs[i][4]
445  resid2 = self.pairs[i][5]
446  chain2 = self.pairs[i][6]
447 
448  label = str(resid1) + ":" + chain1 + "_" + \
449  str(resid2) + ":" + chain2
450  output["SimplifiedPEMAP_Score_" + crosslinker + "_" +
451  label] = str(ln.unprotected_evaluate(None))
452 
453  d0 = IMP.core.XYZ(p0)
454  d1 = IMP.core.XYZ(p1)
455  output["SimplifiedPEMAP_Distance_" +
456  label] = str(IMP.core.get_distance(d0, d1))
457 
458  return output
459 
460 
462 
463  '''
464  generates and wraps a IMP.pmi.ConnectivityRestraint between domains
465  example:
466  cr=restraints.ConnectivityNetworkRestraint(
467  simo,["CCC",(1,100,"TTT"),(100,150,"AAA")])
468  cr.add_to_model()
469  cr.set_label("CR1")
470 
471  Multistate support =No
472  Selection type=selection tuple
473  Resolution=Yes
474  '''
475 
476  def __init__(self, objects, kappa=10.0, resolution=1.0, label="None"):
477 
478  self.weight = 1.0
479  self.kappa = kappa
480  self.label = label
481  if self.label == "None":
482  self.label = str(selection_tuples) # noqa: F821
483 
484  hiers = []
485 
486  for obj in objects:
487  hiers.append(IMP.pmi.tools.input_adaptor(
488  obj, resolution, flatten=True))
489  self.m = hiers[0][0].get_model()
490 
491  cr = ConnectivityNetworkRestraint(self.m)
492  for hs in hiers:
493  cr.add_particles([h.get_particle() for h in hs])
494  self.rs = IMP.RestraintSet(self.m, label)
495  self.rs.add_restraint(cr)
496 
497  def set_label(self, label):
498  self.label = label
499  self.rs.set_name(label)
500  for r in self.rs.get_restraints():
501  r.set_name(label)
502 
503  def add_to_model(self):
504  IMP.pmi.tools.add_restraint_to_model(self.m, self.rs)
505 
506  def get_restraint(self):
507  return self.rs
508 
509  def get_restraints(self):
510  rlist = []
511  for r in self.rs.get_restraints():
512  rlist.append(IMP.core.PairRestraint.get_from(r))
513  return rlist
514 
515  def set_weight(self, weight):
516  self.weight = weight
517  self.rs.set_weight(weight)
518 
519  def get_output(self):
520  output = {}
521  score = self.weight * self.rs.unprotected_evaluate(None)
522  output["_TotalScore"] = str(score)
523  output["ConnectivityNetworkRestraint_" + self.label] = str(score)
524  return output
525 
526 
528 
529  '''
530  a python restraint that computes the score for a composite of proteins
531  Authors: G. Bouvier, R. Pellarin. Pasteur Institute.
532  '''
533 
534  def __init__(self, m, slope=1.0, theta=0.0, plateau=0.0000000001,
535  linear_slope=0.015):
536  '''
537  input a list of particles, the slope and theta of the sigmoid potential
538  theta is the cutoff distance for a protein-protein contact
539  '''
540  # Import networkx here so that we don't introduce it as a dependency
541  # for *every* proteomics restraint, only this one
542  import networkx
543  self.networkx = networkx
544  IMP.Restraint.__init__(self, m, "ConnectivityNetworkRestraint %1%")
545  self.slope = slope
546  self.theta = theta
547  self.linear_slope = linear_slope
548  self.plateau = plateau
549  self.particles_blocks = []
550  self.particle_list = []
551 
552  def get_number_of_particle_blocks(self):
553  return len(self.particles_blocks)
554 
555  def get_number_of_particles_for_block(self, block_index):
556  return len(self.particles_blocks[block_index])
557 
558  def add_particles(self, particles):
559  self.particles_blocks.append(particles)
560  self.particle_list += particles
561 
562  def get_full_graph(self):
563  '''
564  get the full graph of distances between every particle pair
565  '''
566  import scipy.spatial
567  pdist_array = numpy.array(
569  self.particles_blocks))
570  pdist_mat = scipy.spatial.distance.squareform(pdist_array)
571  pdist_mat[pdist_mat < 0] = 0
572  graph = self.networkx.Graph(pdist_mat)
573  return graph
574 
576  """
577  return the minimum spanning tree
578  """
579  graph = self.get_full_graph()
580  graph = self.networkx.minimum_spanning_tree(graph)
581  return graph
582 
583  def sigmoid(self, x):
584  '''
585  a sigmoid function that scores the probability of a contact
586  between two proteins
587  '''
588  # return 1 - (x)**self.slope/ float(((x)**self.slope +
589  # self.theta**self.slope))
590  argvalue = (x - self.theta) / self.slope
591  return 1.0 - (1.0 - self.plateau) / (1.0 + math.exp(-argvalue))
592 
593  def unprotected_evaluate(self, da):
594  graph = self.get_minimum_spanning_tree()
595  score = 0.0
596  for e in graph.edges():
597  dist = graph.get_edge_data(*e)['weight']
598  prob = self.sigmoid(dist)
599  score += -numpy.log(prob)
600  score += self.linear_slope * dist
601  return score
602 
603  def do_get_inputs(self):
604  return self.particle_list
605 
606 
607 class FuzzyBoolean(object):
608 
609  '''
610  Fully Ambiguous Restraint that can be built using boolean logic
611  R. Pellarin. Pasteur Institute.
612  '''
613 
614  def __init__(self, p1, operator=None, p2=None):
615  '''
616  input a list of particles, the slope and theta of the sigmoid potential
617  theta is the cutoff distance for a protein-protein contact
618  '''
619  if isinstance(p1, FuzzyBoolean) and isinstance(p2, FuzzyBoolean):
620  self.operations = [p1, operator, p2]
621  self.value = None
622  else:
623  self.operations = []
624  self.value = p1
625 
626  def __or__(self, FuzzyBoolean2):
627  return FuzzyBoolean(self, self.or_, FuzzyBoolean2)
628 
629  def __and__(self, FuzzyBoolean2):
630  return FuzzyBoolean(self, self.and_, FuzzyBoolean2)
631 
632  def and_(self, a, b):
633  return a * b
634 
635  def or_(self, a, b):
636  return 1.0 - (1.0 - a) * (1.0 - b)
637 
638  def evaluate(self):
639 
640  if len(self.operations) == 0:
641  return self.value
642  FuzzyBoolean1, op, FuzzyBoolean2 = self.operations
643 
644  return op(FuzzyBoolean1.evaluate(), FuzzyBoolean2.evaluate())
645 
646 
648 
649  '''
650  Fully Ambiguous Restraint that can be built using boolean logic
651  R. Pellarin. Pasteur Institute.
652  '''
653  plateau = 0.00000000000001
654  theta = 5.0
655  slope = 2.0
656  innerslope = 0.01
657 
658  def __init__(self, m, p1, p2, operator=None):
659  '''
660  input a list of particles, the slope and theta of the sigmoid potential
661  theta is the cutoff distance for a protein-protein contact
662  '''
663  IMP.Restraint.__init__(self, m, "FuzzyRestraint %1%")
664  self.m = m
665  self.min = sys.float_info.min
666  if isinstance(p1, FuzzyRestraint) and isinstance(p2, FuzzyRestraint):
667  self.operations = [p1, operator, p2]
668  self.particle_pair = None
669  elif isinstance(p1, FuzzyRestraint) and p2 is None:
670  self.operations = [p1, operator, None]
671  self.particle_pair = None
672  else:
673  self.operations = []
674  self.particle_pair = (p1, p2)
675 
676  def __or__(self, FuzzyRestraint2):
677  return FuzzyRestraint(self.m, self, FuzzyRestraint2, self.or_)
678 
679  def __and__(self, FuzzyRestraint2):
680  return FuzzyRestraint(self.m, self, FuzzyRestraint2, self.and_)
681 
682  def __invert__(self):
683  return FuzzyRestraint(self.m, self, None, self.invert_)
684 
685  def and_(self, a, b):
686  c = a + b
687  return c
688 
689  def or_(self, a, b):
690  c = math.exp(-a) + math.exp(-b) - math.exp(-a - b)
691  return -math.log(c)
692 
693  def invert_(self, a):
694  c = 1.0 - math.exp(-a)
695  return -math.log(c)
696 
697  def evaluate(self):
698  if len(self.operations) == 0:
699  return self.distance()
700  FuzzyRestraint1, op, FuzzyRestraint2 = self.operations
701 
702  if FuzzyRestraint2 is not None:
703  return op(FuzzyRestraint1.evaluate(), FuzzyRestraint2.evaluate())
704  else:
705  return op(FuzzyRestraint1.evaluate())
706 
707  def distance(self):
708  d1 = IMP.core.XYZ(self.particle_pair[0])
709  d2 = IMP.core.XYZ(self.particle_pair[1])
710  d = IMP.core.get_distance(d1, d2)
711  argvalue = (d-self.theta)/self.slope
712  return (-math.log(1.0 - (1.0-self.plateau) / (1.0+math.exp(-argvalue)))
713  + self.innerslope*d)
714 
715  def add_to_model(self):
717 
718  def unprotected_evaluate(self, da):
719  return self.evaluate()
720 
721  def __str__(self):
722  if len(self.operations) == 0:
723  return str(self.particle_pair)
724  FuzzyRestraint1, op, FuzzyRestraint2 = self.operations
725  if FuzzyRestraint2 is not None:
726  return str(FuzzyRestraint1) + str(op) + str(FuzzyRestraint2)
727  else:
728  return str(FuzzyRestraint1) + str(op)
729 
730  def do_get_inputs(self):
731  if len(self.operations) == 0:
732  return list(self.particle_pair)
733  FuzzyRestraint1, op, FuzzyRestraint2 = self.operations
734  if FuzzyRestraint2 is not None:
735  return list(set(FuzzyRestraint1.do_get_inputs()
736  + FuzzyRestraint2.do_get_inputs()))
737  else:
738  return list(set(FuzzyRestraint1.do_get_inputs()))
A function that is harmonic over an 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:37
def input_adaptor
Adapt things for PMI (degrees of freedom, restraints, ...) Returns list of list of hierarchies...
Definition: tools.py:946
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:91
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: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:53
A decorator for a particle with x,y,z coordinates and a radius.
Definition: XYZR.h:27