IMP  2.1.1
The Integrative Modeling Platform
StatisticalPairScore.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/StatisticalPairScore.h
3  * \brief Functions to read mol2s
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_STATISTICAL_PAIR_SCORE_H
10 #define IMPCORE_STATISTICAL_PAIR_SCORE_H
11 
12 #include <IMP/core/core_config.h>
13 #include <IMP/generic.h>
14 #include <IMP/kernel/Model.h>
17 #include <IMP/kernel/Particle.h>
18 #include <IMP/PairScore.h>
19 #include <IMP/algebra/Vector3D.h>
20 #include "XYZ.h"
21 #include <IMP/base/file.h>
22 #include <limits>
23 
24 IMPCORE_BEGIN_NAMESPACE
25 /** Create a pairwise statistical potential from a file. The Keys passed
26  as a template argument are used to determine how to map the names of
27  the types as described in the loaded file to indexes. That is, if
28  atom::ResidueKey is passed as the Keys, the potential will expect a file
29  which has one line for each pair of residue names.
30 
31  The expected file format is:
32 \verbatim
33  bin_width number_a number_b [offset]
34  key_0a key_0b bin0 bin1 bin2...
35  key_1a key_1b bin0 bin1 bin2...
36 \endverbatim
37 
38  The order of the lines (after the first one) does not matter.
39  The bin_width is how much distance is allocated per bin (the distance used
40  is that between the points). number_a and number_b are the numbers of
41  particle types (number_b should only be specified if BIPARTITE is set).
42 
43  \note The values read in the file are for bins. That is, the first bin
44  is from offset to offset+width. The second is offset+width to offset+
45  2width.
46  As a result, when interpolation is used, the function achieves the
47  bin value at the center of the bin.
48 
49  \param[in] Key is an IMP::Key which maps between names and indices
50  \param[in] BIPARTITE If true, the two sets of particles being stored are
51  different (e.g. a protein atom and a ligand atom), otherwise they are
52  assumed to both be the same. Appropriate values must be provided
53  in the file.
54  \param[in] INTERPOLATE If true, even the scores without derivatives are
55  spline interpolated. If false, only the evaluation of derivatives is
56  interpolated with a spline.
57 */
58 template <class Key, bool BIPARTITE, bool INTERPOLATE, bool SPARSE = false>
60  score_functor::Statistical<Key, BIPARTITE, INTERPOLATE, SPARSE> > {
63 
64  public:
65  /** \param[in] k The attribute to use for determining the particle types
66  \param[in] threshold The maximum distance to score
67  \param[in] data_file Where to load the file from.
68  */
69  StatisticalPairScore(IntKey k, double threshold, base::TextInput data_file)
70  : P(S(k, threshold, data_file)) {}
71  /** \param[in] k The attribute to use for determining the particle types
72  \param[in] threshold The maximum distance to score
73  \param[in] data_file Where to load the file from.
74  \param[in] shift The offset for the types of the second set of types.
75  eg, if the score is on protein and ligand atoms, the ligand atom types
76  start with the value shift.
77  */
78  StatisticalPairScore(IntKey k, double threshold, base::TextInput data_file,
79  unsigned int shift)
80  : P(S(k, threshold, data_file, shift)) {}
81 };
82 IMPCORE_END_NAMESPACE
83 
84 #endif /* IMPCORE_STATISTICAL_PAIR_SCORE_H */
A base class for Keys.
Definition: kernel/Key.h:46
A Score on the distance between a pair of particles.
StatisticalPairScore(IntKey k, double threshold, base::TextInput data_file)
Create efficient distance-based pair scores.
Simple xyz decorator.
StatisticalPairScore(IntKey k, double threshold, base::TextInput data_file, unsigned int shift)
Import IMP/kernel/PairScore.h in the namespace.
Storage of a model, its restraints, constraints and particles.
Classes to handle individual model particles.
Simple 3D vector class.
Handling of file input/output.
Import IMP/kernel/generic.h in the namespace.
A Score on the distance between a pair of particles.