Chemical Data Processing Library C++ API - Version 1.2.0
GRAILDataSetGenerator.hpp
Go to the documentation of this file.
1 /*
2  * GRAILDataSetGenerator.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_GRAILDATASETGENERATOR_HPP
30 #define CDPL_GRAIL_GRAILDATASETGENERATOR_HPP
31 
32 #include <map>
33 #include <set>
34 #include <utility>
35 #include <string>
36 #include <memory>
37 #include <functional>
38 
39 #include "CDPL/GRAIL/APIPrefix.hpp"
46 #include "CDPL/Math/Matrix.hpp"
47 #include "CDPL/Math/Vector.hpp"
48 
49 
50 namespace CDPL
51 {
52 
53  namespace GRAIL
54  {
55 
61  {
62 
63  public:
64  typedef std::shared_ptr<GRAILDataSetGenerator> SharedPointer;
65 
68 
70 
71  static constexpr double DEF_GRID_STEP_SIZE = 0.5;
72 
74 
76 
77  void enableInteraction(unsigned int ftr_type, unsigned int tgt_ftr_type, bool enable);
78 
79  bool isInteractionEnabled(unsigned int ftr_type, unsigned int tgt_ftr_type) const;
80 
82 
83  void setScoringFunction(unsigned int ftr_type, unsigned int tgt_ftr_type, const ScoringFunction& func);
84 
85  const ScoringFunction& getScoringFunction(unsigned int ftr_type, unsigned int tgt_ftr_type) const;
86 
87  void removeScoringFunction(unsigned int ftr_type, unsigned int tgt_ftr_type);
88 
89  void setGridName(unsigned int ftr_type, unsigned int tgt_ftr_type, const std::string& name);
90 
91  const std::string& getGridName(unsigned int ftr_type, unsigned int tgt_ftr_type) const;
92 
93  void removeGridName(unsigned int ftr_type, unsigned int tgt_ftr_type);
94 
96 
98 
99  void normalizeScores(bool normalize);
100 
101  bool scoresNormalized() const;
102 
103  void diminishScoresByAtomDensity(bool diminish);
104 
106 
108 
110 
111  void setEnvironmentAtomDensityGridName(const std::string& name);
112 
113  const std::string& getEnvironmentAtomDensityGridName() const;
114 
116 
117  template <typename T>
118  void setGridTransform(const T& xform)
119  {
120  gridTransform = xform;
121  }
122 
123  double getGridStepSize() const;
124 
125  void setGridStepSize(double size);
126 
127  std::size_t getGridXSize() const;
128 
129  void setGridXSize(std::size_t size);
130 
131  std::size_t getGridYSize() const;
132 
133  void setGridYSize(std::size_t size);
134 
135  std::size_t getGridZSize() const;
136 
137  void setGridZSize(std::size_t size);
138 
139  void setGridParamsForBoundingBox(const Math::Vector3D& bbox_min, const Math::Vector3D& bbox_max, double step_size = DEF_GRID_STEP_SIZE);
140 
142 
144 
146 
148 
150  Grid::DRegularGridSet& grid_set, bool append = false);
151 
154  const std::string& grid_name);
155 
156  private:
157  Grid::DRegularGrid::SharedPointer createGrid() const;
158 
159  void init();
160 
161  typedef std::pair<unsigned int, unsigned int> FeatureTypePair;
162  typedef std::map<FeatureTypePair, ScoringFunction> ScoringFuncMap;
163  typedef std::map<FeatureTypePair, std::string> GridNameMap;
164  typedef std::set<FeatureTypePair> EnabledInteractionsSet;
165 
166  ScoringFuncMap ftrInteractionScoringFuncMap;
167  GridNameMap gridNameMap;
168  EnabledInteractionsSet enabledFtrInteractions;
169  FeatureInteractionScoreGridCalculator ftrInteractionGridCalc;
170  AtomDensityGridCalculator atomDensityGridCalc;
172  PharmacophoreProcessingFunction pharmProcessingFunc;
173  Pharm::BasicPharmacophore pharmacophore;
174  double gridStepSize;
175  std::size_t gridXSize;
176  std::size_t gridYSize;
177  std::size_t gridZSize;
178  Math::Matrix4D gridTransform;
179  bool diminishByAtomDensity;
180  bool storeEnvAtomDensityGrid;
181  std::string envAtomDensityGridName;
182  };
183  } // namespace GRAIL
184 } // namespace CDPL
185 
186 #endif // CDPL_GRAIL_GRAILDATASETGENERATOR_HPP
Type definition of a generic wrapper class for storing user-defined Chem::Atom 3D-coordinates functio...
Definition of the class CDPL::GRAIL::AtomDensityGridCalculator.
Definition of the class CDPL::Pharm::BasicPharmacophore.
Definition of the class CDPL::Pharm::DefaultPharmacophoreGenerator.
Definition of the class CDPL::GRAIL::FeatureInteractionScoreGridCalculator.
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 matrix data types.
Definition of the class CDPL::Grid::RegularGridSet.
Definition of vector data types.
A common interface for data-structures that support a random access to stored Chem::Atom instances.
Definition: AtomContainer.hpp:55
MolecularGraph.
Definition: MolecularGraph.hpp:52
AtomDensityGridCalculator.
Definition: AtomDensityGridCalculator.hpp:69
FeatureInteractionScoreGridCalculator.
Definition: FeatureInteractionScoreGridCalculator.hpp:67
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
GRAILDataSetGenerator.
Definition: GRAILDataSetGenerator.hpp:61
void setScoreCombinationFunction(const ScoreCombinationFunction &func)
void setGridXSize(std::size_t size)
virtual ~GRAILDataSetGenerator()
Definition: GRAILDataSetGenerator.hpp:75
std::shared_ptr< GRAILDataSetGenerator > SharedPointer
Definition: GRAILDataSetGenerator.hpp:64
std::size_t getGridYSize() const
std::size_t getGridZSize() const
void setGridParamsForBoundingBox(const Math::Vector3D &bbox_min, const Math::Vector3D &bbox_max, double step_size=DEF_GRID_STEP_SIZE)
void setGridZSize(std::size_t size)
const ScoreCombinationFunction & getScoreCombinationFunction() const
void normalizeScores(bool normalize)
const Pharm::DefaultPharmacophoreGenerator & getPharmacophoreGenerator() const
std::function< void(CDPL::Pharm::Pharmacophore &)> PharmacophoreProcessingFunction
Definition: GRAILDataSetGenerator.hpp:69
FeatureInteractionScoreGridCalculator::ScoringFunction ScoringFunction
Definition: GRAILDataSetGenerator.hpp:66
const ScoringFunction & getScoringFunction(unsigned int ftr_type, unsigned int tgt_ftr_type) const
void removeGridName(unsigned int ftr_type, unsigned int tgt_ftr_type)
bool isInteractionEnabled(unsigned int ftr_type, unsigned int tgt_ftr_type) const
Grid::DRegularGrid::SharedPointer calcAtomDensityGrid(const Chem::AtomContainer &atoms, const Chem::Atom3DCoordinatesFunction &coords_func, const std::string &grid_name)
FeatureInteractionScoreGridCalculator::ScoreCombinationFunction ScoreCombinationFunction
Definition: GRAILDataSetGenerator.hpp:67
const std::string & getEnvironmentAtomDensityGridName() const
const Math::Matrix4D & getGridTransform() const
void setGridName(unsigned int ftr_type, unsigned int tgt_ftr_type, const std::string &name)
const std::string & getGridName(unsigned int ftr_type, unsigned int tgt_ftr_type) const
void setEnvironmentAtomDensityGridName(const std::string &name)
std::size_t getGridXSize() const
const PharmacophoreProcessingFunction & getPharmacophoreProcessingFunction() const
void calcInteractionGrids(const Chem::MolecularGraph &tgt_env, const Chem::Atom3DCoordinatesFunction &coords_func, Grid::DRegularGridSet &grid_set, bool append=false)
Pharm::DefaultPharmacophoreGenerator & getPharmacophoreGenerator()
void setGridYSize(std::size_t size)
void storeEnvironmentAtomDensityGrid(bool store)
void enableInteraction(unsigned int ftr_type, unsigned int tgt_ftr_type, bool enable)
void setGridTransform(const T &xform)
Definition: GRAILDataSetGenerator.hpp:118
void removeScoringFunction(unsigned int ftr_type, unsigned int tgt_ftr_type)
void setPharmacophoreProcessingFunction(const PharmacophoreProcessingFunction &func)
void setScoringFunction(unsigned int ftr_type, unsigned int tgt_ftr_type, const ScoringFunction &func)
void diminishScoresByAtomDensity(bool diminish)
RegularGridSet.
Definition: RegularGridSet.hpp:47
std::shared_ptr< RegularGrid > SharedPointer
Definition: RegularGrid.hpp:51
BasicPharmacophore.
Definition: BasicPharmacophore.hpp:52
DefaultPharmacophoreGenerator.
Definition: DefaultPharmacophoreGenerator.hpp:48
Pharmacophore.
Definition: Pharmacophore.hpp:48
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
std::function< const Math::Vector3D &(const Chem::Atom &)> Atom3DCoordinatesFunction
A generic wrapper class used to store a user-defined Chem::Atom 3D-coordinates function.
Definition: Atom3DCoordinatesFunction.hpp:43
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.