Chemical Data Processing Library C++ API - Version 1.4.0
NPointPharmacophoreFingerprintGenerator.hpp
Go to the documentation of this file.
1 /*
2  * NPointPharmacophoreFingerprintGenerator.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_DESCR_NPOINTPHARMACOPHOREFINGERPRINTGENERATOR_HPP
30 #define CDPL_DESCR_NPOINTPHARMACOPHOREFINGERPRINTGENERATOR_HPP
31 
32 #include <cstddef>
33 #include <vector>
34 #include <utility>
35 #include <functional>
36 
37 #include "CDPL/Descr/APIPrefix.hpp"
41 #include "CDPL/Math/Matrix.hpp"
42 #include "CDPL/Util/BitSet.hpp"
43 
44 
45 namespace CDPL
46 {
47 
48  namespace Descr
49  {
50 
63  {
64 
65  public:
69  static constexpr std::size_t DEF_MIN_FEATURE_TUPLE_SIZE = 1;
70 
74  static constexpr std::size_t DEF_MAX_FEATURE_TUPLE_SIZE = 3;
75 
79  typedef std::function<bool(const Pharm::Feature&)> FeatureFilterFunction;
80 
85 
90  void setMinFeatureTupleSize(std::size_t min_size);
91 
96  std::size_t getMinFeatureTupleSize() const;
97 
102  void setMaxFeatureTupleSize(std::size_t max_size);
103 
108  std::size_t getMaxFeatureTupleSize() const;
109 
114  void setBinSize(double bin_size);
115 
120  double getBinSize() const;
121 
127 
133 
140 
147 
148  protected:
152  static constexpr double DEF_BIN_SIZE = 2.0;
153 
158 
163 
169  void generate(const Chem::MolecularGraph& molgraph, Util::BitSet& fp);
170 
177 
178  private:
179  void init(const Pharm::FeatureContainer& cntnr);
180 
181  void enumFeatureTuples(std::size_t curr_ftr_idx, Util::BitSet& fp);
182 
183  void emitFeatureTupleBit(Util::BitSet& fp);
184 
185  void canonFeatureTupleData(std::size_t curr_ftr_idx);
186 
187  unsigned long getDistanceBinNumber(double dist) const;
188 
189  virtual double getDistance(const Pharm::Feature& ftr1, const Pharm::Feature& ftr2) const = 0;
190 
191  typedef std::pair<unsigned int, std::size_t> FeatureID;
192  typedef std::vector<FeatureID> FeatureList;
193  typedef std::vector<unsigned long> FeatureTupleData;
194 
195  std::size_t minFtrTupleSize;
196  std::size_t maxFtrTupleSize;
197  double binSize;
198  FeatureFilterFunction ftrFilterFunc;
201  Pharm::FeatureSet ftrSubset;
202  FeatureList ftrList;
203  Math::ULMatrix ftrDistMatrix;
204  FeatureList ftrTuple;
205  FeatureTupleData ftrTupleData;
206  FeatureTupleData tmpFtrTupleData;
207  };
208  } // namespace Descr
209 } // namespace CDPL
210 
211 #endif // CDPL_DESCR_NPOINTPHARMACOPHOREFINGERPRINTGENERATOR_HPP
Definition of class CDPL::Pharm::BasicPharmacophore.
Declaration of type CDPL::Util::BitSet.
Definition of class CDPL::Pharm::DefaultPharmacophoreGenerator.
Definition of the preprocessor macro CDPL_DESCR_API.
#define CDPL_DESCR_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of class CDPL::Pharm::FeatureSet.
Definition of matrix data types.
Abstract base class for representations of a chemical structure as a graph of bonded atoms.
Definition: MolecularGraph.hpp:57
Abstract base for N-point pharmacophore fingerprint generators.
Definition: NPointPharmacophoreFingerprintGenerator.hpp:63
const Pharm::PharmacophoreGenerator & getPharmacophoreGenerator() const
Returns the internal pharmacophore generator used for the input molecular graph.
std::function< bool(const Pharm::Feature &)> FeatureFilterFunction
Type of the generic functor used to filter which features participate in the fingerprint.
Definition: NPointPharmacophoreFingerprintGenerator.hpp:79
std::size_t getMinFeatureTupleSize() const
Returns the currently configured minimum feature tuple size.
NPointPharmacophoreFingerprintGenerator(const NPointPharmacophoreFingerprintGenerator &gen)=default
Copy constructor.
void generate(const Chem::MolecularGraph &molgraph, Util::BitSet &fp)
Generates the fingerprint of the molecular graph molgraph.
void setMaxFeatureTupleSize(std::size_t max_size)
Sets the maximum size of generated feature tuples.
std::size_t getMaxFeatureTupleSize() const
Returns the currently configured maximum feature tuple size.
void setMinFeatureTupleSize(std::size_t min_size)
Sets the minimum size of generated feature tuples.
void setFeatureFilterFunction(const FeatureFilterFunction &func)
Specifies a predicate that selects which features participate in the fingerprint.
Pharm::PharmacophoreGenerator & getPharmacophoreGenerator()
Returns the internal pharmacophore generator used for the input molecular graph.
void setBinSize(double bin_size)
Sets the size of the bins used to discretize feature-pair distances.
double getBinSize() const
Returns the currently configured distance bin size.
void generate(const Pharm::FeatureContainer &cntnr, Util::BitSet &fp)
Generates the fingerprint of the feature container cntnr.
const FeatureFilterFunction & getFeatureFilterFunction() const
Returns the currently configured feature filter function.
NPointPharmacophoreFingerprintGenerator()
Constructs the NPointPharmacophoreFingerprintGenerator instance.
virtual ~NPointPharmacophoreFingerprintGenerator()
Virtual destructor.
Definition: NPointPharmacophoreFingerprintGenerator.hpp:84
Concrete Pharm::Pharmacophore implementation that owns its features as Pharm::BasicFeature instances ...
Definition: BasicPharmacophore.hpp:53
Pharmacophore generator pre-configured with the built-in default set of feature generators.
Definition: DefaultPharmacophoreGenerator.hpp:53
Abstract base class for containers holding a sequence of Pharm::Feature objects with associated prope...
Definition: FeatureContainer.hpp:55
Concrete Pharm::FeatureContainer implementation that stores references to existing Pharm::Feature ins...
Definition: FeatureSet.hpp:56
Abstract base class representing a single pharmacophore feature within a parent Pharm::Pharmacophore.
Definition: Feature.hpp:48
Base class for pharmacophore generators that orchestrate per-feature-type Pharm::FeatureGenerator ins...
Definition: PharmacophoreGenerator.hpp:50
Matrix< unsigned long > ULMatrix
Unbounded dense matrix holding unsigned integers of type unsigned long.
Definition: Matrix.hpp:3155
boost::dynamic_bitset BitSet
Dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.