Chemical Data Processing Library C++ API - Version 1.1.1
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
CDPL::Math::Vector< double >
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::setFeatureSelectionPredicate
void setFeatureSelectionPredicate(const FeaturePredicate &pred)
VectorArray.hpp
Definition of the class CDPL::Math::VectorArray.
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::ScoreSumFunctor
Definition: FeatureInteractionScoreGridCalculator.hpp:88
CDPL::Math::Vector3D
CVector< double, 3 > Vector3D
A bounded 3 element vector holding floating point values of type double.
Definition: Vector.hpp:1637
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::FeatureInteractionScoreGridCalculator
FeatureInteractionScoreGridCalculator(const FeatureInteractionScoreGridCalculator &calc)
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::getDistanceCutoff
double getDistanceCutoff() const
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::scoresNormalized
bool scoresNormalized() const
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::FeatureInteractionScoreGridCalculator
FeatureInteractionScoreGridCalculator(const ScoringFunction &func)
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::ScoringFunction
std::function< double(const Math::Vector3D &, const Pharm::Feature &)> ScoringFunction
Definition: FeatureInteractionScoreGridCalculator.hpp:75
SpatialGrid.hpp
Definition of a spatial grid data type.
bool
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::getScoreCombinationFunction
const ScoreCombinationFunction & getScoreCombinationFunction() const
CDPL::Pharm::FeatureContainer
FeatureContainer.
Definition: FeatureContainer.hpp:53
VectorArray< Vector3D >
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::operator=
FeatureInteractionScoreGridCalculator & operator=(const FeatureInteractionScoreGridCalculator &calc)
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::setScoringFunction
void setScoringFunction(const ScoringFunction &func)
CDPL::Math::sum
GridElementSum< E >::ResultType sum(const GridExpression< E > &e)
Definition: GridExpression.hpp:416
double
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::setDistanceCutoff
void setDistanceCutoff(double dist)
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::FeatureInteractionScoreGridCalculator
FeatureInteractionScoreGridCalculator(const ScoringFunction &scoring_func, const ScoreCombinationFunction &comb_func)
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::getFeatureSelectionPredicate
const FeaturePredicate & getFeatureSelectionPredicate() const
CDPL::Grid::SpatialGrid
SpatialGrid.
Definition: SpatialGrid.hpp:47
APIPrefix.hpp
Definition of the preprocessor macro CDPL_GRAIL_API.
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::normalizeScores
void normalizeScores(bool normalize)
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Math::normInf
MatrixNormInfinity< E >::ResultType normInf(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:917
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::SharedPointer
std::shared_ptr< FeatureInteractionScoreGridCalculator > SharedPointer
Definition: FeatureInteractionScoreGridCalculator.hpp:72
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::~FeatureInteractionScoreGridCalculator
~FeatureInteractionScoreGridCalculator()
CDPL::GRAIL::FeatureInteractionScoreGridCalculator
FeatureInteractionScoreGridCalculator.
Definition: FeatureInteractionScoreGridCalculator.hpp:67
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::FeaturePredicate
std::function< bool(const Pharm::Feature &)> FeaturePredicate
Definition: FeatureInteractionScoreGridCalculator.hpp:74
CDPL_GRAIL_API
#define CDPL_GRAIL_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::MaxScoreFunctor::operator()
double operator()(const Math::DVector &scores) const
Definition: FeatureInteractionScoreGridCalculator.hpp:81
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::MaxScoreFunctor
Definition: FeatureInteractionScoreGridCalculator.hpp:79
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::calculate
void calculate(const Pharm::FeatureContainer &tgt_ftrs, Grid::DSpatialGrid &grid)
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::getScoringFunction
const ScoringFunction & getScoringFunction() const
CDPL::Pharm::Feature
Feature.
Definition: Feature.hpp:48
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::ScoreCombinationFunction
std::function< double(const Math::DVector &)> ScoreCombinationFunction
Definition: FeatureInteractionScoreGridCalculator.hpp:76
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::setScoreCombinationFunction
void setScoreCombinationFunction(const ScoreCombinationFunction &func)
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::FeatureInteractionScoreGridCalculator
FeatureInteractionScoreGridCalculator()
Vector.hpp
Definition of vector data types.
CDPL::GRAIL::FeatureInteractionScoreGridCalculator::ScoreSumFunctor::operator()
double operator()(const Math::DVector &scores) const
Definition: FeatureInteractionScoreGridCalculator.hpp:90