Chemical Data Processing Library C++ API - Version 1.4.0
SpatialFeatureMapping.hpp
Go to the documentation of this file.
1 /*
2  * SpatialFeatureMappingExtractor.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_PHARM_SPATIALFEATUREMAPPING_HPP
30 #define CDPL_PHARM_SPATIALFEATUREMAPPING_HPP
31 
32 #include <utility>
33 #include <unordered_map>
34 #include <functional>
35 
36 #include <boost/functional/hash.hpp>
37 
38 #include "CDPL/Pharm/APIPrefix.hpp"
40 #include "CDPL/Math/Matrix.hpp"
41 
42 
43 namespace CDPL
44 {
45 
46  namespace Pharm
47  {
48 
49  class FeatureContainer;
50 
57  {
58 
59  public:
63  typedef std::function<bool(const Feature&, const Feature&)> TypeMatchFunction;
64 
68  typedef std::function<double(const Feature&, const Feature&, const Math::Matrix4D&)> PositionMatchFunction;
69 
73  typedef std::function<double(const Feature&, const Feature&, const Math::Matrix4D&)> GeometryMatchFunction;
74 
80  SpatialFeatureMapping(bool query_mode = false);
81 
87 
93 
99 
105 
111 
117 
124  double getPositionMatchScore(const Feature& ref_ftr, const Feature& aligned_ftr) const;
125 
132  double getGeometryMatchScore(const Feature& ref_ftr, const Feature& aligned_ftr) const;
133 
141  void perceive(const FeatureContainer& ref_ftrs, const FeatureContainer& aligned_ftrs, const Math::Matrix4D& xform);
142 
143  private:
144  typedef std::pair<const Feature*, const Feature*> FeaturePair;
145  typedef std::unordered_map<FeaturePair, double, boost::hash<FeaturePair> > FeaturePairToScoreMap;
146 
147  TypeMatchFunction typeMatchFunc;
148  PositionMatchFunction posMatchFunc;
149  GeometryMatchFunction geomMatchFunc;
150  FeaturePairToScoreMap posMatchScores;
151  FeaturePairToScoreMap geomMatchScores;
152  };
153  } // namespace Pharm
154 } // namespace CDPL
155 
156 #endif // CDPL_PHARM_SPATIALFEATUREMAPPING_HPP
Definition of the type CDPL::Pharm::FeatureMapping.
Definition of matrix data types.
Definition of the preprocessor macro CDPL_PHARM_API.
#define CDPL_PHARM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Abstract base class for containers holding a sequence of Pharm::Feature objects with associated prope...
Definition: FeatureContainer.hpp:55
Data type for the storage and lookup of arbitrary feature to feature mappings.
Definition: FeatureMapping.hpp:54
Abstract base class representing a single pharmacophore feature within a parent Pharm::Pharmacophore.
Definition: Feature.hpp:48
Pharm::FeatureMapping specialization that perceives a reference-to-aligned feature mapping based on t...
Definition: SpatialFeatureMapping.hpp:57
void perceive(const FeatureContainer &ref_ftrs, const FeatureContainer &aligned_ftrs, const Math::Matrix4D &xform)
Computes the spatial feature mapping between the reference and aligned feature containers after apply...
std::function< bool(const Feature &, const Feature &)> TypeMatchFunction
Generic wrapper class used to store a user-defined feature type match function.
Definition: SpatialFeatureMapping.hpp:63
void setPositionMatchFunction(const PositionMatchFunction &func)
Specifies a function for checking the proximity of mapped feature positions.
double getGeometryMatchScore(const Feature &ref_ftr, const Feature &aligned_ftr) const
Returns the geometry-match score cached for the (ref_ftr, aligned_ftr) pair by the last perceive() ca...
double getPositionMatchScore(const Feature &ref_ftr, const Feature &aligned_ftr) const
Returns the position-match score cached for the (ref_ftr, aligned_ftr) pair by the last perceive() ca...
std::function< double(const Feature &, const Feature &, const Math::Matrix4D &)> PositionMatchFunction
Generic wrapper class used to store a user-defined feature position match function.
Definition: SpatialFeatureMapping.hpp:68
const GeometryMatchFunction & getGeometryMatchFunction() const
Returns the function that was registered for checking the match of mapped feature geometries.
const PositionMatchFunction & getPositionMatchFunction() const
Returns the function that was registered for checking the proximity of mapped feature positions.
std::function< double(const Feature &, const Feature &, const Math::Matrix4D &)> GeometryMatchFunction
Generic wrapper class used to store a user-defined feature geometry match function.
Definition: SpatialFeatureMapping.hpp:73
SpatialFeatureMapping(bool query_mode=false)
Constructs a SpatialFeatureMapping instance.
void setGeometryMatchFunction(const GeometryMatchFunction &func)
Specifies a function for checking the match of mapped feature geometries.
void setTypeMatchFunction(const TypeMatchFunction &func)
Specifies a function for testing the type compatibility of features.
const TypeMatchFunction & getTypeMatchFunction() const
Returns the function that was registered for testing the type compatibility of the features.
The namespace of the Chemical Data Processing Library.