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 #ifndef __MOLCHEMICALFEATURE_H_11012005_1404__
11 #define __MOLCHEMICALFEATURE_H_11012005_1404__
12 
13 #include <string>
14 #include <vector>
15 #include <map>
16 #include <Geometry/point.h>
18 
19 namespace RDKit {
20  class ROMol;
21  class Atom;
22  class MolChemicalFeatureFactory;
23  class MolChemicalFeatureDef;
24 
25 
27 
29  public:
30  typedef std::vector<const Atom *> AtomPtrContainer;
31  typedef AtomPtrContainer::const_iterator AtomPtrContainer_CI;
32 
33  //! Constructor
35  const MolChemicalFeatureFactory *factory,
36  const MolChemicalFeatureDef *fdef,
37  int id=-1) :
38  dp_mol(mol), dp_factory(factory), dp_def(fdef), d_id(id), d_activeConf(-1) {};
39 
41 
42  //! \brief return the name of the feature's family
43  const std::string &getFamily() const;
44  //! \brief return the name of the feature's type
45  const std::string &getType() const;
46  //! \brief return the position of the feature (obtained from
47  //! from the associated conformation
48  RDGeom::Point3D getPos() const;
49 
50  //! \brief return the position of the feature (obtained from
51  //! from the requested conformation from the associated molecule)
52  RDGeom::Point3D getPos(int confId) const;
53  //! \brief return a pointer to our feature factory
54  const MolChemicalFeatureFactory *getFactory() const { return dp_factory; };
55  //! \brief return a pointer to our associated molecule
56  const ROMol *getMol() const { return dp_mol; };
57  //! \brief return a pointer to our feature definition
58  const MolChemicalFeatureDef *getFeatDef() const { return dp_def; };
59 
60  //! \brief returns the active conformer (in the associated molecule)
61  const int getId() const { return d_id;};
62 
63  //! \brief returns the number of atoms defining the feature
64  inline unsigned int getNumAtoms() const {
65  return d_atoms.size();
66  }
67 
68  //! \brief sets the active conformer (in the associated molecule)
69  void setActiveConformer(int confId);
70 
71  //! \brief returns the active conformer (in the associated molecule)
72  int getActiveConformer() const { return d_activeConf;};
73 
74  //! \brief clears out the internal position cache
75  void clearCache() { d_locs.clear(); };
76 
77  //! \brief returns our atom container of
78  const AtomPtrContainer &getAtoms() const {
79  return d_atoms;
80  }
81  AtomPtrContainer::const_iterator beginAtoms() const { return d_atoms.begin(); };
82  AtomPtrContainer::const_iterator endAtoms() const { return d_atoms.end(); };
83 
84  private:
85  typedef std::map<int,RDGeom::Point3D> PointCacheType;
86 
87  const ROMol *dp_mol;
88  const MolChemicalFeatureFactory *dp_factory;
89  const MolChemicalFeatureDef *dp_def;
90  int d_id;
91  int d_activeConf;
92  AtomPtrContainer d_atoms;
93  mutable PointCacheType d_locs;
94  };
95 
96 }
97 
98 #endif
const std::string & getFamily() const
return the name of the feature&#39;s family
const MolChemicalFeatureFactory * getFactory() const
return a pointer to our feature factory
int getActiveConformer() const
returns the active conformer (in the associated molecule)
The class for finding chemical features in molecules.
std::vector< const Atom * > AtomPtrContainer
MolChemicalFeature(const ROMol *mol, const MolChemicalFeatureFactory *factory, const MolChemicalFeatureDef *fdef, int id=-1)
Constructor.
const MolChemicalFeatureDef * getFeatDef() const
return a pointer to our feature definition
RDGeom::Point3D getPos() const
return the position of the feature (obtained from from the associated conformation ...
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:105
const AtomPtrContainer & getAtoms() const
returns our atom container of
abstract base class for chemical feature
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
AtomPtrContainer::const_iterator AtomPtrContainer_CI
AtomPtrContainer::const_iterator endAtoms() const
const int getId() const
returns the active conformer (in the associated molecule)
void setActiveConformer(int confId)
sets the active conformer (in the associated molecule)
void clearCache()
clears out the internal position cache
const std::string & getType() const
return the name of the feature&#39;s type
const ROMol * getMol() const
return a pointer to our associated molecule
AtomPtrContainer::const_iterator beginAtoms() const
unsigned int getNumAtoms() const
returns the number of atoms defining the feature