IMP logo
IMP Reference Guide  2.6.0
The Integrative Modeling Platform
pmi/restraints/__init__.py
1 """@namespace IMP.pmi.restraints
2  Classes to handle different kinds of restraints.
3 
4 PMI restraints generally wrap IMP restraints. Typical features in PMI restraints are:
5  - Easy setup: for example, you can usually create one with a PMI [Molecule](@ref IMP::pmi::topology::Molecule) or a slice from one.
6  - Fast setup from data files. For example you can set up the [CrossLinkingMassSpectrometryRestraint](@ref IMP::pmi::restraints::crosslinking::CrossLinkingMassSpectrometryRestraint) by reading in a crosslink file into a [database](@ref IMP::pmi::io::crosslink::CrossLinkDataBase).
7  - Useful output: reporting functions which are put into log files when running [ReplicaExchange](@ref IMP::pmi::macros::ReplicaExchange0).
8 """
9 
10 import IMP
11 import IMP.pmi
12 import IMP.pmi.tools
13 
14 class _NuisancesBase(object):
15  ''' This base class is used to provide nuisance setup and interface
16  for the ISD cross-link restraints '''
17  sigma_dictionary={}
18  psi_dictionary={}
19 
20  def create_length(self):
21  ''' a nuisance on the length of the cross-link '''
22  lengthinit = 10.0
23  self.lengthissampled = True
24  lengthminnuis = 0.0000001
25  lengthmaxnuis = 1000.0
26  lengthmin = 6.0
27  lengthmax = 30.0
28  lengthtrans = 0.2
29  length = IMP.pmi.tools.SetupNuisance(self.m, lengthinit,
30  lengthminnuis,
31  lengthmaxnuis,
32  lengthissampled).get_particle()
33  self.rslen.add_restraint(
35  self.m,
36  length,
37  1000000000.0,
38  lengthmax,
39  lengthmin))
40 
41  def create_sigma(self, resolution):
42  ''' a nuisance on the structural uncertainty '''
43  if isinstance(resolution,str):
44  sigmainit = 2.0
45  else:
46  sigmainit = resolution + 2.0
47  self.sigmaissampled = True
48  sigmaminnuis = 0.0000001
49  sigmamaxnuis = 1000.0
50  sigmamin = 0.01
51  sigmamax = 100.0
52  sigmatrans = 0.5
53  sigma = IMP.pmi.tools.SetupNuisance(self.m, sigmainit,
54  sigmaminnuis, sigmamaxnuis, self.sigmaissampled).get_particle()
55  self.sigma_dictionary[resolution] = (
56  sigma,
57  sigmatrans,
58  self.sigmaissampled)
59  self.rssig.add_restraint(
61  self.m,
62  sigma,
63  1000000000.0,
64  sigmamax,
65  sigmamin))
66  # self.rssig.add_restraint(IMP.isd.JeffreysRestraint(self.sigma))
67 
68  def get_sigma(self, resolution):
69  if not resolution in self.sigma_dictionary:
70  self.create_sigma(resolution)
71  return self.sigma_dictionary[resolution]
72 
73  def create_psi(self, value):
74  ''' a nuisance on the inconsistency '''
75  if isinstance(value,str):
76  psiinit = 0.5
77  else:
78  psiinit = value
79  self.psiissampled = True
80  psiminnuis = 0.0000001
81  psimaxnuis = 0.4999999
82  psimin = 0.01
83  psimax = 0.49
84  psitrans = 0.1
85  psi = IMP.pmi.tools.SetupNuisance(self.m, psiinit,
86  psiminnuis, psimaxnuis,
87  self.psiissampled).get_particle()
88  self.psi_dictionary[value] = (
89  psi,
90  psitrans,
91  self.psiissampled)
92  self.rspsi.add_restraint(
94  self.m,
95  psi,
96  1000000000.0,
97  psimax,
98  psimin))
99  self.rspsi.add_restraint(IMP.isd.JeffreysRestraint(self.m, psi))
100 
101  def get_psi(self, value):
102  if not value in self.psi_dictionary:
103  self.create_psi(value)
104  return self.psi_dictionary[value]
Miscellaneous utilities.
Definition: tools.py:1
Uniform distribution with harmonic boundaries.
Definition: UniformPrior.h:20
Python classes to represent, score, sample and analyze models.