IMP logo
IMP Reference Guide  2.14.0
The Integrative Modeling Platform
CrossLinkMSRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/isd/CrossLinkMSRestraint.h
3  * \brief A pmf based likelihood function
4  * with prior knowledge on the false positive rate.
5  *
6  * Copyright 2007-2020 IMP Inventors. All rights reserved.
7  *
8  */
9 
10 #ifndef IMPISD_CROSS_LINK_MSRESTRAINT_H
11 #define IMPISD_CROSS_LINK_MSRESTRAINT_H
12 #include "isd_config.h"
13 #include <IMP/Restraint.h>
14 #include <IMP/particle_index.h>
15 #include <IMP/isd/Scale.h>
16 
17 IMPISD_BEGIN_NAMESPACE
18 
19 //! A restraint for ambiguous cross-linking MS data and multiple state approach.
20 /** It marginalizes the false positive rate and depends on the expected fpr and
21  an uncertainty parameter beta.
22  */
23 class IMPISDEXPORT CrossLinkMSRestraint : public Restraint {
24 
26  IMP::ParticleIndexPairs sigmass_;
27  IMP::ParticleIndex lengthi_;
29  double length_;
30  double slope_;
31  int constr_;
32  bool get_log_prob_;
33 
34  double sphere_cap(float r1, float r2, float d) const;
35 
36  public:
37  //! Create the restraint.
38  CrossLinkMSRestraint(IMP::Model* m, double length,
39  bool get_log_prob = false,
40  std::string name = "CrossLinkMSRestraint%1%");
41 
44  bool get_log_prob = false,
45  std::string name = "CrossLinkMSRestraint%1%");
46 
47  CrossLinkMSRestraint(IMP::Model* m, double length, double slope,
48  bool get_log_prob = false,
49  std::string name = "CrossLinkMSRestraint%1%");
50 
51  void add_contribution(const IMP::ParticleIndexPair& pps,
52  const IMP::ParticleIndexPair& sigmas,
53  IMP::ParticleIndex psi) {
54  ppis_.push_back(pps);
55  sigmass_.push_back(sigmas);
56  psis_.push_back(psi);
57  }
58 
59  double get_probability() const;
60 
61  //! Get the length of this restraint
62  /** Note that if the restraint was constructed with a length Scale,
63  this can change during sampling. */
64  double get_length() const {
65  if (constr_ == 1) {
66  return isd::Scale(get_model(), lengthi_).get_scale();
67  } else {
68  return length_;
69  }
70  }
71 
72  double get_slope() const { return slope_; }
73 
74  //! Get the sigma particle indexes from a contribution
76  return sigmass_[i];
77  }
78 
79  //! Get the psi particle index from a contribution
81  return psis_[i];
82  }
83 
84  //! Get the particle indexes from a contribution
86  return ppis_[i];
87  }
88 
89  unsigned int get_number_of_contributions() const { return ppis_.size(); }
90 
91  virtual double unprotected_evaluate(
95 };
96 
97 IMPISD_END_NAMESPACE
98 
99 #endif /* IMPISD_CROSS_LINK_MSRESTRAINT_H */
A restraint for ambiguous cross-linking MS data and multiple state approach.
Various general useful functions for IMP.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
A decorator for scale parameters particles.
Add scale parameter to particle.
Definition: Scale.h:24
ParticleIndexPair get_contribution_particle_indexes(int i) const
Get the particle indexes from a contribution.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
ParticleIndexPair get_contribution_sigma_indexes(int i) const
Get the sigma particle indexes from a contribution.
double get_length() const
Get the length of this restraint.
Abstract base class for all restraints.
ParticleIndex get_contribution_psi_index(int i) const
Get the psi particle index from a contribution.
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:54