IMP logo
IMP Reference Guide  2.8.0
The Integrative Modeling Platform
LognormalAmbiguousRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/isd/LognormalAmbiguousRestraint.h
3  * \brief A sigmoid shaped restraint between
4  * residues with discrete classifier
5  * and ambiguous assignment. To be used with
6  * cross-linking mass-spectrometry data.
7  *
8  * Copyright 2007-2017 IMP Inventors. All rights reserved.
9  *
10  */
11 
12 #ifndef IMPISD_LOGNORMAL_AMBIGUOUS_RESTRAINT_H
13 #define IMPISD_LOGNORMAL_AMBIGUOUS_RESTRAINT_H
14 
15 #include <IMP/isd/Scale.h>
16 #include "isd_config.h"
17 #include <IMP/Restraint.h>
18 #include <IMP/PairContainer.h>
19 
20 IMPISD_BEGIN_NAMESPACE
21 
22 /** A restraint for ambiguous cross-linking MS data.
23  \f$ z_i \f$ is the discrete classifier,
24  \f$ \sigma_G \f$ is the uncertainty estimate for good data points,
25  \f$ \sigma_B \f$ is the uncertainty estimate for bad data points,
26  \f$ k_i \f$ is the index of the restraint to be
27  picked up from the ambiguous set, and
28  \f$ \lambda_0 \f$ is the maximum length for the cross-linker.
29 
30  Usage: Construct the ambiguous set using
31  LognormalAmbiguousRestraint(\f$ z_i \f$, \f$ \sigma_G \f$,
32  \f$ \sigma_B \f$, \f$ k_i \f$, \f$ \lambda_0 \f$).
33  Pass individual cross-linked particles to
34  add_contribution(part0, part1).
35  The marginal likelihood is modeled by a sigmoid function:
36 
37  \f[p(D|X,I) = \frac{1}{\lambda_0+\sigma(\sqrt(\pi/2)-1)}
38  [1+\theta(r_k-\lambda_0+\sigma)[\exp(-\frac{(r_k-
39  \lambda_0+\sigma)^2}{2\sigma^2})]]
40  \f]
41 
42  where \f$ \sigma=z_i\sigma_G+(1-z_i)\sigma_B \f$
43  and \f$ r_k \f$ is the distance between part0 and part1.
44  */
45 class IMPISDEXPORT LognormalAmbiguousRestraint : public Restraint
46 {
50  Pointer<Particle> sigmaG_;
51  Particles omegas_;
52  Floats lexp_;
53 
54 public:
55  //! Create the restraint.
56  /** Restraints should store the particles they are to act on,
57  preferably in a Singleton or PairContainer as appropriate.
58  */
60  (Particle *p1, Particle *p2, Particle *ki, Particle *sigmaG);
61 
62 
63  // add a contribution: simple case
64  void add_contribution(double lexp, Particle *omega);
65 
66  unsigned get_number_of_contributions() const {return lexp_.size();}
67 
68  void draw_k_from_posterior(double kt);
69 
70  /* call for probability */
71  double get_probability() const
72  {
73  return exp(-unprotected_evaluate(NULL));
74  }
75 
76  virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum)
77  const IMP_OVERRIDE;
80 };
81 
82 IMPISD_END_NAMESPACE
83 
84 #endif /* IMPISD_LOGNORMAL_AMBIGUOUS_RESTRAINT_H */
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
A decorator for scale parameters particles.
A smart pointer to a reference counted object.
Definition: Pointer.h:87
A container for Pairs.
Class to handle individual particles of a Model object.
Definition: Particle.h:41
Abstract base class for all restraints.
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:52