Chemical Data Processing Library C++ API - Version 1.2.0
FeatureInteractionScoreGridCalculator.hpp
Go to the documentation of this file.
1 /*
2  * FeatureInteractionScoreGridCalculator.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_GRAIL_FEATUREINTERACTIONSCOREGRIDCALCULATOR_HPP
30 #define CDPL_GRAIL_FEATUREINTERACTIONSCOREGRIDCALCULATOR_HPP
31 
32 #include <vector>
33 #include <cstddef>
34 #include <memory>
35 #include <functional>
36 
37 #include "CDPL/GRAIL/APIPrefix.hpp"
38 #include "CDPL/Math/Vector.hpp"
41 
42 
43 namespace CDPL
44 {
45 
46  namespace Internal
47  {
48 
49  template <typename PT, typename CT, typename ST>
50  class Octree;
51  }
52 
53  namespace Pharm
54  {
55 
56  class FeatureContainer;
57  class Feature;
58  } // namespace Pharm
59 
60  namespace GRAIL
61  {
62 
67  {
68 
69  public:
70  static constexpr double DEF_DISTANCE_CUTOFF = 10.0;
71 
72  typedef std::shared_ptr<FeatureInteractionScoreGridCalculator> SharedPointer;
73 
74  typedef std::function<bool(const Pharm::Feature&)> FeaturePredicate;
75  typedef std::function<double(const Math::Vector3D&, const Pharm::Feature&)> ScoringFunction;
76  typedef std::function<double(const Math::DVector&)> ScoreCombinationFunction;
77 
79  {
80 
81  double operator()(const Math::DVector& scores) const
82  {
83  return normInf(scores);
84  }
85  };
86 
88  {
89 
90  double operator()(const Math::DVector& scores) const
91  {
92  return sum(scores);
93  }
94  };
95 
97 
99 
101 
103 
105 
106  void normalizeScores(bool normalize);
107 
108  bool scoresNormalized() const;
109 
111 
113 
115 
117 
119 
121 
122  void setDistanceCutoff(double dist);
123 
124  double getDistanceCutoff() const;
125 
127 
129 
130  private:
131  typedef std::vector<const Pharm::Feature*> FeatureList;
132  typedef Internal::Octree<Math::Vector3D, Math::Vector3DArray, double> Octree;
133  typedef std::shared_ptr<Octree> OctreePtr;
134  typedef std::vector<std::size_t> FeatureIndexList;
135 
136  FeatureList tgtFeatures;
137  Math::DVector partialScores;
138  ScoringFunction scoringFunc;
139  ScoreCombinationFunction scoreCombinationFunc;
140  FeaturePredicate ftrSelectionPred;
141  double distCutoff;
142  OctreePtr octree;
143  Math::Vector3DArray featureCoords;
144  FeatureIndexList featureIndices;
145  bool normScores;
146  };
147  } // namespace GRAIL
148 } // namespace CDPL
149 
150 #endif // CDPL_GRAIL_FEATUREINTERACTIONSCOREGRIDCALCULATOR_HPP
Definition of the preprocessor macro CDPL_GRAIL_API.
#define CDPL_GRAIL_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of a spatial grid data type.
Definition of the class CDPL::Math::VectorArray.
Definition of vector data types.
FeatureInteractionScoreGridCalculator.
Definition: FeatureInteractionScoreGridCalculator.hpp:67
const ScoringFunction & getScoringFunction() const
FeatureInteractionScoreGridCalculator(const ScoringFunction &func)
void setFeatureSelectionPredicate(const FeaturePredicate &pred)
FeatureInteractionScoreGridCalculator & operator=(const FeatureInteractionScoreGridCalculator &calc)
void setScoringFunction(const ScoringFunction &func)
std::function< double(const Math::Vector3D &, const Pharm::Feature &)> ScoringFunction
Definition: FeatureInteractionScoreGridCalculator.hpp:75
std::function< double(const Math::DVector &)> ScoreCombinationFunction
Definition: FeatureInteractionScoreGridCalculator.hpp:76
void setScoreCombinationFunction(const ScoreCombinationFunction &func)
const ScoreCombinationFunction & getScoreCombinationFunction() const
std::shared_ptr< FeatureInteractionScoreGridCalculator > SharedPointer
Definition: FeatureInteractionScoreGridCalculator.hpp:72
std::function< bool(const Pharm::Feature &)> FeaturePredicate
Definition: FeatureInteractionScoreGridCalculator.hpp:74
const FeaturePredicate & getFeatureSelectionPredicate() const
FeatureInteractionScoreGridCalculator(const ScoringFunction &scoring_func, const ScoreCombinationFunction &comb_func)
FeatureInteractionScoreGridCalculator(const FeatureInteractionScoreGridCalculator &calc)
void calculate(const Pharm::FeatureContainer &tgt_ftrs, Grid::DSpatialGrid &grid)
SpatialGrid.
Definition: SpatialGrid.hpp:47
FeatureContainer.
Definition: FeatureContainer.hpp:53
Feature.
Definition: Feature.hpp:48
VectorArray< Vector3D > Vector3DArray
An array of Math::Vector3D objects.
Definition: VectorArray.hpp:84
MatrixNormInfinity< E >::ResultType normInf(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:917
GridElementSum< E >::ResultType sum(const GridExpression< E > &e)
Definition: GridExpression.hpp:416
CVector< double, 3 > Vector3D
A bounded 3 element vector holding floating point values of type double.
Definition: Vector.hpp:1637
The namespace of the Chemical Data Processing Library.
Definition: FeatureInteractionScoreGridCalculator.hpp:79
double operator()(const Math::DVector &scores) const
Definition: FeatureInteractionScoreGridCalculator.hpp:81
Definition: FeatureInteractionScoreGridCalculator.hpp:88
double operator()(const Math::DVector &scores) const
Definition: FeatureInteractionScoreGridCalculator.hpp:90