Chemical Data Processing Library C++ API - Version 1.4.0
PharmacophoreFitScore.hpp
Go to the documentation of this file.
1 /*
2  * PharmacophoreFitScore.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_PHARMACOPHOREFITSCORE_HPP
30 #define CDPL_PHARM_PHARMACOPHOREFITSCORE_HPP
31 
32 #include <vector>
33 #include <unordered_set>
34 #include <cstddef>
35 
36 #include "CDPL/Pharm/APIPrefix.hpp"
39 #include "CDPL/Util/BitSet.hpp"
40 
41 
42 namespace CDPL
43 {
44 
45  namespace Pharm
46  {
47 
48  class FeatureContainer;
49 
55  {
56 
57  public:
61  static constexpr double DEF_FTR_MATCH_COUNT_WEIGHT = 1.0;
62 
66  static constexpr double DEF_FTR_POS_MATCH_WEIGHT = 0.5;
67 
71  static constexpr double DEF_FTR_GEOM_MATCH_WEIGHT = 0.4;
72 
82  PharmacophoreFitScore(bool query_mode = false,
83  double match_cnt_weight = DEF_FTR_MATCH_COUNT_WEIGHT,
84  double pos_match_weight = DEF_FTR_POS_MATCH_WEIGHT,
85  double geom_match_weight = DEF_FTR_GEOM_MATCH_WEIGHT);
86 
92 
97  void setFeatureMatchCountWeight(double weight);
98 
104 
109  void setFeaturePositionMatchWeight(double weight);
110 
116 
121  void setFeatureGeometryMatchWeight(double weight);
122 
129  void groupReferenceFeatures(bool group);
130 
137 
145  double operator()(const FeatureContainer& ref_ftrs, const FeatureContainer& algnd_ftrs,
146  const Math::Matrix4D& xform);
147 
154  double operator()(const FeatureContainer& ref_ftrs, const SpatialFeatureMapping& mapping);
155 
156  private:
157  typedef std::vector<const Feature*> FeatureList;
158  typedef std::vector<std::size_t> IndexList;
159  typedef std::unordered_set<const Feature*> FeatureSet;
160 
161  void calcScore(std::size_t idx, const SpatialFeatureMapping& mapping,
162  std::size_t mat_ftr_cnt, std::size_t mat_mand_ftr_cnt, double tot_fit_score);
163 
164  SpatialFeatureMapping spatFtrMapping;
165  double ftrMatchCntWeight;
166  double ftrPosMatchWeight;
167  double ftrGeomMatchWeight;
168  bool grpRefFtrs;
169  FeatureList grpdRefFtrs;
170  IndexList refFtrGrpBounds;
171  Util::BitSet mandRefFtrGrps;
172  FeatureSet assignedAlgdFtrs;
173  double maxScore;
174  std::size_t maxMpdMandFtrCount;
175  std::size_t maxMpdFtrCount;
176  };
177  } // namespace Pharm
178 } // namespace CDPL
179 
180 #endif // CDPL_PHARM_PHARMACOPHOREFITSCORE_HPP
Declaration of type CDPL::Util::BitSet.
Definition of the type CDPL::Pharm::FeatureMapping.
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.
Definition of class CDPL::Pharm::SpatialFeatureMapping.
Abstract base class for containers holding a sequence of Pharm::Feature objects with associated prope...
Definition: FeatureContainer.hpp:55
Scoring functor that quantifies how well a candidate set of features fits a reference pharmacophore,...
Definition: PharmacophoreFitScore.hpp:55
void setFeatureGeometryMatchWeight(double weight)
Sets the weight of the feature geometry match contribution.
double getFeatureMatchCountWeight() const
Returns the currently configured weight of the matched feature count contribution.
void setFeaturePositionMatchWeight(double weight)
Sets the weight of the feature position deviation contribution.
void groupReferenceFeatures(bool group)
Specifies whether reference features should be grouped before scoring (groups share a common mandator...
double operator()(const FeatureContainer &ref_ftrs, const FeatureContainer &algnd_ftrs, const Math::Matrix4D &xform)
Computes the fit score of algnd_ftrs against ref_ftrs after applying the rigid body transformation xf...
bool referenceFeaturesGrouped() const
Tells whether reference features are grouped before scoring.
double operator()(const FeatureContainer &ref_ftrs, const SpatialFeatureMapping &mapping)
Computes the fit score from a pre-computed feature mapping.
double getFeatureGeometryMatchWeight() const
Returns the currently configured weight of the feature geometry match contribution.
void setFeatureMatchCountWeight(double weight)
Sets the weight of the matched feature count contribution.
double getFeaturePositionMatchWeight() const
Returns the currently configured weight of the feature position deviation contribution.
PharmacophoreFitScore(bool query_mode=false, double match_cnt_weight=DEF_FTR_MATCH_COUNT_WEIGHT, double pos_match_weight=DEF_FTR_POS_MATCH_WEIGHT, double geom_match_weight=DEF_FTR_GEOM_MATCH_WEIGHT)
Constructs the PharmacophoreFitScore instance.
Pharm::FeatureMapping specialization that perceives a reference-to-aligned feature mapping based on t...
Definition: SpatialFeatureMapping.hpp:57
boost::dynamic_bitset BitSet
Dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.