1 """@namespace IMP.pmi.restraints.crosslinking_new
2 Restraints for handling crosslinking data. This temporary module will be soon
3 deprecated and merged with IMP.pmi.restraints.crosslinking
6 from __future__
import print_function
16 class DisulfideCrossLinkRestraint(object):
17 def __init__(self, representation,
25 self.m = representation.prot.get_model()
31 self.linear.set_slope(0.0)
35 self.psi_dictionary={}
36 self.sigma_dictionary={}
37 self.psi_is_sampled =
False
38 self.sigma_is_sampled =
False
41 ps1 = IMP.pmi.tools.select_by_tuple(
44 resolution=resolution)
46 ps2 = IMP.pmi.tools.select_by_tuple(
49 resolution=resolution)
51 if len(ps1) > 1
or len(ps1) == 0:
52 raise ValueError(
"DisulfideBondRestraint: ERROR> first selection pattern selects multiple particles or sero particles")
54 if len(ps2) > 1
or len(ps2) == 0:
55 raise ValueError(
"DisulfideBondRestraint: ERROR> second selection pattern selects multiple particles or sero particles")
62 sigma=self.create_sigma(
"SIGMA_DISULFIDE_BOND")
63 psi=self.create_psi(
"PSI_DISULFIDE_BOND")
65 p1i = p1.get_particle_index()
66 p2i = p2.get_particle_index()
75 dr.add_contribution((p1i, p2i), (si, si), psii)
79 pr.set_name(
"DISULFIDE_BOND_"+self.label)
80 self.rslin.add_restraint(pr)
83 self.rs.add_restraint(lw)
85 self.xl[
"Particle1"]=p1
86 self.xl[
"Particle2"]=p2
87 self.xl[
"Sigma"]=sigma
90 def add_to_model(self):
94 def get_hierarchies(self):
97 def get_restraint_sets(self):
100 def get_restraint(self):
103 def get_restraint_for_rmf(self):
106 def get_restraints(self):
108 for r
in self.rs.get_restraints():
109 rlist.append(IMP.core.PairRestraint.get_from(r))
112 def set_psi_is_sampled(self, is_sampled=True):
113 self.psi_is_sampled = is_sampled
115 def set_sigma_is_sampled(self, is_sampled=True):
116 self.sigma_is_sampled = is_sampled
119 def create_sigma(self, name):
120 ''' a nuisance on the structural uncertainty '''
121 if name
in self.sigma_dictionary:
122 return self.sigma_dictionary[name][0]
125 sigmaminnuis = 0.0000001
126 sigmamaxnuis = 1000.0
130 sigma = IMP.pmi.tools.SetupNuisance(self.m, sigmainit,
131 sigmaminnuis, sigmamaxnuis, self.sigma_is_sampled).get_particle()
132 self.sigma_dictionary[name] = (
135 self.sigma_is_sampled)
139 def create_psi(self, name):
140 ''' a nuisance on the inconsistency '''
141 if name
in self.psi_dictionary:
142 return self.psi_dictionary[name][0]
145 psiminnuis = 0.0000001
146 psimaxnuis = 0.4999999
150 psi = IMP.pmi.tools.SetupNuisance(self.m, psiinit,
151 psiminnuis, psimaxnuis,
152 self.psi_is_sampled).get_particle()
153 self.psi_dictionary[name] = (
161 def get_output(self):
163 score = self.rs.unprotected_evaluate(
None)
164 output[
"_TotalScore"] = str(score)
165 output[
"DisulfideBondRestraint_Data_Score_" + self.label] = str(score)
166 output[
"DisulfideBondRestraint_Linear_Score_" +
167 self.label] = self.rslin.unprotected_evaluate(
None)
170 def get_particles_to_sample(self):
171 raise NotImplementedError(
" ")
174 @
IMP.deprecated_object(
"2.5",
"Use IMP.pmi.restraints.crosslinking.CrossLinkingMassSpectrometryRestraint instead.")
177 def __init__(self, *args, **kwargs):
Setup cross-link distance restraints from mass spectrometry data.
A restraint for ambiguous cross-linking MS data and multiple state approach.
Various classes to hold sets of particles.
Object used to hold a set of restraints.
Ints get_index(const ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
def deprecated_object
Python decorator to mark a class as deprecated.
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...
Calculate the -Log of a list of restraints.
Restraints for handling crosslinking data.
Applies a PairScore to a Pair.
Functionality for loading, creating, manipulating and scoring atomic structures.