IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
CysteineCrossLinkRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/isd/CysteineCrossLinkRestraint.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-2022 IMP Inventors. All rights reserved.
9  *
10  */
11 
12 #ifndef IMPISD_CYSTEINE_CROSS_LINK_RESTRAINT_H
13 #define IMPISD_CYSTEINE_CROSS_LINK_RESTRAINT_H
14 #include <IMP/isd/isd_config.h>
15 #include <IMP/Restraint.h>
16 #include <IMP/isd/CrossLinkData.h>
18 #include <cereal/access.hpp>
19 #include <cereal/types/vector.hpp>
20 
21 IMPISD_BEGIN_NAMESPACE
22 //! A restraint for cysteine cross-linking data.
23 /** It models the frequency fexp derived from gel separation of cross-linked
24  complexes. The experimental frequency fexp is derived as the
25  fraction of dimeric versus monomeric complex, upon cysteine
26  cross-linking. The forward model is derived from free energy
27  calculations. The likelihood is modeled as a normal distribution
28  function truncated over the interval [0,1]. To construct the
29  restraint, the class CysteineCrossLinkData and CrossLinkData have
30  to be initialized (see for instance
31  test_CysteineCrossLinkRestraint.py). Input parameters and
32  constructor. There are two different constructors p1 and p2 are
33  the two cross-linked sites. \f$ \beta \f$ is the beta parameter
34  in the distribution function. The \f$ \alpha \f$ parameter is
35  constrained by the condition that the variance is gaussian by the
36  formula \f$ \omega \f$ is a scale factor for the beta parameter,
37  to allow for outlier detection. Usage: Construct the ambiguous
38  set using CysteineCrossLinkRestraint(\f$ \beta \f$, \f$ \omega
39  \f$, xlyield, \f$ f_{exp} \f$) method. The model frequencies of
40  each individual copy are summed, weighted and multiplied by the
41  unknown crosslink yield (epsilon). Pass individual cross-linked
42  pairs to add_contribution(p0, p1, w) command, where "w" is a state
43  weight parameter.
44  */
45 
46 class IMPISDEXPORT CysteineCrossLinkRestraint : public Restraint {
47  ParticleIndexes ps1_;
48  ParticleIndexes ps2_;
49  std::vector<ParticleIndexes> pslist1_;
50  std::vector<ParticleIndexes> pslist2_;
51  ParticleIndex beta_;
52  ParticleIndex sigma_;
53  ParticleIndex epsilon_; // k * t at the exponential
54  ParticleIndex weight_;
57  int constr_type_;
58  double fexp_;
59  bool use_CA_;
60 
61  friend class cereal::access;
62 
63  template<class Archive> void serialize(Archive &ar) {
64  ar(cereal::base_class<Restraint>(this), ps1_, ps2_, pslist1_, pslist2_,
65  beta_, sigma_, epsilon_, weight_, data_, ccldata_, constr_type_,
66  fexp_, use_CA_);
67  }
68 
70 
71  public:
72  //! Create the restraint.
75  ParticleIndexAdaptor epsilon,
76  ParticleIndexAdaptor weight, CrossLinkData *data,
77  double fexp);
78 
81  ParticleIndexAdaptor epsilon,
82  ParticleIndexAdaptor weight, CrossLinkData *data,
83  CysteineCrossLinkData *ccldata);
84 
86 
87  /* call for probability */
88  double get_probability() const;
89 
90  double get_standard_error() const;
91 
92  Floats get_frequencies() const;
93 
94  double get_model_frequency() const;
95 
96  Floats get_distances() const;
97 
98  double get_truncated_normalization(double mean, double sigma) const;
99 
100  double get_normal_pdf(double mean, double sigma, double x) const;
101 
102  void add_contribution(ParticleIndexAdaptor p1, ParticleIndexAdaptor p2);
103  void add_contribution(ParticleIndexes p1, ParticleIndexes p2);
104 
105  algebra::Vector3D get_CB_coordinates(const ParticleIndexes &ps) const;
106 
107  unsigned get_number_of_contributions() const;
108 
109  virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum)
110  const override;
111  virtual IMP::ModelObjectsTemp do_get_inputs() const override;
113 };
114 
115 IMPISD_END_NAMESPACE
116 
117 #endif /* IMPISD_CYSTEINE_CROSS_LINK_RESTRAINT_H */
Normal distribution of Function.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Take Decorator, Particle or ParticleIndex.
virtual double unprotected_evaluate(DerivativeAccumulator *da) const
Return the unweighted score for the restraint.
Normal distribution of Function.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Definition: object_macros.h:95
A smart pointer to a ref-counted Object that is a class member.
Definition: Pointer.h:143
VectorD< 3 > Vector3D
Definition: VectorD.h:408
Abstract base class for all restraints.
virtual ModelObjectsTemp do_get_inputs() const =0
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:56
A restraint for cysteine cross-linking data.