IMP  2.3.1
The Integrative Modeling Platform
AtomicCrossLinkMSRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/isd/AtomicCrossLinkMSRestraint.h
3  * \brief A pmf based likelihood function
4  * with prior knowledge on the flase positive rate.
5  *
6  * Copyright 2007-2013 IMP Inventors. All rights reserved.
7  *
8  */
9 
10 #ifndef IMPISD_ATOMIC_CROSS_LINK_MSRESTRAINT_H
11 #define IMPISD_ATOMIC_CROSS_LINK_MSRESTRAINT_H
12 #include "isd_config.h"
14 #include <IMP/container_macros.h>
15 #include <IMP/PairContainer.h>
16 #include <IMP/kernel/Restraint.h>
17 
18 IMPISD_BEGIN_NAMESPACE
19 
20 //! Restrain atom pairs based on a set of crosslinks.
21 class IMPISDEXPORT AtomicCrossLinkMSRestraint : public Restraint {
22 public:
23  //! Constructor
24  /**
25  \param[in] length The maximum length of the crosslinker
26  \param[in] slope Exponential factor added to the score
27  \param[in] i_am_part_of_log_score Set to True if using LogWrapper
28  \param[in] name The restraint name
29 
30  */
32  double length,
33  Float slope = 0.0,
34  bool i_am_part_of_log_score=false,
35  std::string name = "AtomicCrossLinkMSRestraint%1%");
36 
37  //! Add a contribution to this xlink
38  /**
39  \param[in] ppi The particles to which you will apply the restraint
40  \param[in] sigmas Nuisance parameters (one per residue involved in the XL)
41  \param[in] psi Nuisance parameter for the data point accuracy (one per pair)
42  */
43 
44  void add_contribution(const ParticleIndexPair& ppi,
45  const ParticleIndexPair& sigmas,
46  const ParticleIndex &psi);
47 
48 
49  //! Evaluate the restraint just for a subset of contribution indexes
50  Float evaluate_for_contributions(Ints c,DerivativeAccumulator *accum) const;
51 
52  //! Returns a description of each contribution (distance, sig1, sig2, psi)
53  Floats get_contribution_scores(int index) const;
54 
55  //! Get number of contributions added to the restraint
56  unsigned int get_number_of_contributions() const { return ppis_.size(); }
57 
58  //! Get the particles in a contribution
59  ParticleIndexPair get_contribution(int i) const { return ppis_[i]; }
60 
61  //! Get the sigma nuisances in a contribution
62  ParticleIndexPair get_contribution_sigmas(int i) const { return sigmass_[i]; }
63 
64  //! Get the psi nuisance in a contribution
65  ParticleIndex get_contribution_psi(int i) const { return psis_[i]; }
66 
67  virtual double unprotected_evaluate(
70  void show(std::ostream &out) const { out << "Atomic XL restraint with "
71  <<get_number_of_contributions()
72  <<" contributions"; }
73  void set_slope(Float slope) { slope_=slope; }
74  void set_part_of_log_score(bool hey) { i_am_part_of_log_score_=hey; }
75 
77  private:
78  Float xlen_;
79  Float slope_;
80  bool i_am_part_of_log_score_;
81  ParticleIndexPairs ppis_;
82  ParticleIndexPairs sigmass_;
83  ParticleIndexes psis_;
84  Ints default_range_;
85 };
86 
87 IMPISD_END_NAMESPACE
88 
89 #endif /* IMPISD_ATOMIC_CROSS_LINK_MSRESTRAINT_H */
Class for adding derivatives from restraints to the model.
IMP::base::Vector< IMP::base::WeakPointer< kernel::ModelObject > > ModelObjectsTemp
Store a list of kernel::ParticlesTemp.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Restrain atom pairs based on a set of crosslinks.
Import IMP/kernel/container_macros.h in the namespace.
ParticleIndexPair get_contribution(int i) const
Get the particles in a contribution.
ParticleIndex get_contribution_psi(int i) const
Get the psi nuisance in a contribution.
Import IMP/kernel/PairContainer.h in the namespace.
Abstract base class for all restraints.
A restraint is a term in an IMP ScoringFunction.
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
virtual ModelObjectsTemp do_get_inputs() const =0
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:20
ParticleIndexPair get_contribution_sigmas(int i) const
Get the sigma nuisances in a contribution.
unsigned int get_number_of_contributions() const
Get number of contributions added to the restraint.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73