RDKit
Open-source cheminformatics and machine learning.
MolChemicalFeature.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #include <RDGeneral/export.h>
11 #ifndef __MOLCHEMICALFEATURE_H_11012005_1404__
12 #define __MOLCHEMICALFEATURE_H_11012005_1404__
13 
14 #include <string>
15 #include <vector>
16 #include <map>
17 #include <Geometry/point.h>
19 
20 namespace RDKit {
21 class ROMol;
22 class Atom;
23 class MolChemicalFeatureFactory;
24 class MolChemicalFeatureDef;
25 
29 
30  public:
31  typedef std::vector<const Atom *> AtomPtrContainer;
32  typedef AtomPtrContainer::const_iterator AtomPtrContainer_CI;
33 
34  //! Constructor
36  const MolChemicalFeatureDef *fdef, int id = -1)
37  : dp_mol(mol),
38  dp_factory(factory),
39  dp_def(fdef),
40  d_id(id),
41  d_activeConf(-1){};
42 
44 
45  //! \brief return the name of the feature's family
46  const std::string &getFamily() const;
47  //! \brief return the name of the feature's type
48  const std::string &getType() const;
49  //! \brief return the position of the feature (obtained from
50  //! from the associated conformation
51  RDGeom::Point3D getPos() const;
52 
53  //! \brief return the position of the feature (obtained from
54  //! from the requested conformation from the associated molecule)
55  RDGeom::Point3D getPos(int confId) const;
56  //! \brief return a pointer to our feature factory
57  const MolChemicalFeatureFactory *getFactory() const { return dp_factory; };
58  //! \brief return a pointer to our associated molecule
59  const ROMol *getMol() const { return dp_mol; };
60  //! \brief return a pointer to our feature definition
61  const MolChemicalFeatureDef *getFeatDef() const { return dp_def; };
62 
63  //! \brief returns the active conformer (in the associated molecule)
64  int getId() const { return d_id; };
65 
66  //! \brief returns the number of atoms defining the feature
67  inline unsigned int getNumAtoms() const { return d_atoms.size(); }
68 
69  //! \brief sets the active conformer (in the associated molecule)
70  void setActiveConformer(int confId);
71 
72  //! \brief returns the active conformer (in the associated molecule)
73  int getActiveConformer() const { return d_activeConf; };
74 
75  //! \brief clears out the internal position cache
76  void clearCache() { d_locs.clear(); };
77 
78  //! \brief returns our atom container of
79  const AtomPtrContainer &getAtoms() const { return d_atoms; }
80  AtomPtrContainer::const_iterator beginAtoms() const {
81  return d_atoms.begin();
82  };
83  AtomPtrContainer::const_iterator endAtoms() const { return d_atoms.end(); };
84 
85  private:
86  typedef std::map<int, RDGeom::Point3D> PointCacheType;
87 
88  const ROMol *dp_mol;
89  const MolChemicalFeatureFactory *dp_factory;
90  const MolChemicalFeatureDef *dp_def;
91  int d_id;
92  int d_activeConf;
93  AtomPtrContainer d_atoms;
94  mutable PointCacheType d_locs;
95 };
96 } // namespace RDKit
97 
98 #endif
RDKit::MolChemicalFeature::getId
int getId() const
returns the active conformer (in the associated molecule)
Definition: MolChemicalFeature.h:64
point.h
RDKit::MolChemicalFeature::beginAtoms
AtomPtrContainer::const_iterator beginAtoms() const
Definition: MolChemicalFeature.h:80
RDGeom::Point3D
Definition: point.h:46
RDKit::MolChemicalFeature::~MolChemicalFeature
~MolChemicalFeature()
Definition: MolChemicalFeature.h:43
RDKit::MolChemicalFeatureFactory
The class for finding chemical features in molecules.
Definition: MolChemicalFeatureFactory.h:25
ChemicalFeatures::ChemicalFeature
abstract base class for chemical feature
Definition: ChemicalFeature.h:19
RDKit::MolChemicalFeature::getMol
const ROMol * getMol() const
return a pointer to our associated molecule
Definition: MolChemicalFeature.h:59
RDKit::ROMol
Definition: ROMol.h:171
RDKit::MolChemicalFeature::getFeatDef
const MolChemicalFeatureDef * getFeatDef() const
return a pointer to our feature definition
Definition: MolChemicalFeature.h:61
RDKit::MolChemicalFeature::getFactory
const MolChemicalFeatureFactory * getFactory() const
return a pointer to our feature factory
Definition: MolChemicalFeature.h:57
RDKit::MolChemicalFeatureDef
Definition: MolChemicalFeatureDef.h:25
RDKit::MolChemicalFeature::getActiveConformer
int getActiveConformer() const
returns the active conformer (in the associated molecule)
Definition: MolChemicalFeature.h:73
RDKit::MolChemicalFeature::getNumAtoms
unsigned int getNumAtoms() const
returns the number of atoms defining the feature
Definition: MolChemicalFeature.h:67
RDKit::MolChemicalFeature::MolChemicalFeature
MolChemicalFeature(const ROMol *mol, const MolChemicalFeatureFactory *factory, const MolChemicalFeatureDef *fdef, int id=-1)
Constructor.
Definition: MolChemicalFeature.h:35
RDKit::MolChemicalFeature::AtomPtrContainer_CI
AtomPtrContainer::const_iterator AtomPtrContainer_CI
Definition: MolChemicalFeature.h:32
RDKit::MolChemicalFeature::clearCache
void clearCache()
clears out the internal position cache
Definition: MolChemicalFeature.h:76
RDKit
Std stuff.
Definition: Atom.h:30
RDKit::MolChemicalFeature::AtomPtrContainer
std::vector< const Atom * > AtomPtrContainer
Definition: MolChemicalFeature.h:31
RDKit::MolChemicalFeature
Definition: MolChemicalFeature.h:26
RDKIT_MOLCHEMICALFEATURES_EXPORT
#define RDKIT_MOLCHEMICALFEATURES_EXPORT
Definition: export.h:385
RDKit::MolChemicalFeature::endAtoms
AtomPtrContainer::const_iterator endAtoms() const
Definition: MolChemicalFeature.h:83
ChemicalFeature.h
RDKit::MolChemicalFeature::getAtoms
const AtomPtrContainer & getAtoms() const
returns our atom container of
Definition: MolChemicalFeature.h:79
export.h