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 
28 
29  public:
30  typedef std::vector<const Atom *> AtomPtrContainer;
31  typedef AtomPtrContainer::const_iterator AtomPtrContainer_CI;
32 
33  //! Constructor
35  const MolChemicalFeatureDef *fdef, int id = -1)
36  : dp_mol(mol),
37  dp_factory(factory),
38  dp_def(fdef),
39  d_id(id),
40  d_activeConf(-1){};
41 
43 
44  //! \brief return the name of the feature's family
45  const std::string &getFamily() const;
46  //! \brief return the name of the feature's type
47  const std::string &getType() const;
48  //! \brief return the position of the feature (obtained from
49  //! from the associated conformation
50  RDGeom::Point3D getPos() const;
51 
52  //! \brief return the position of the feature (obtained from
53  //! from the requested conformation from the associated molecule)
54  RDGeom::Point3D getPos(int confId) const;
55  //! \brief return a pointer to our feature factory
56  const MolChemicalFeatureFactory *getFactory() const { return dp_factory; };
57  //! \brief return a pointer to our associated molecule
58  const ROMol *getMol() const { return dp_mol; };
59  //! \brief return a pointer to our feature definition
60  const MolChemicalFeatureDef *getFeatDef() const { return dp_def; };
61 
62  //! \brief returns the active conformer (in the associated molecule)
63  int getId() const { return d_id; };
64 
65  //! \brief returns the number of atoms defining the feature
66  inline unsigned int getNumAtoms() const { return d_atoms.size(); }
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 { return d_atoms; }
79  AtomPtrContainer::const_iterator beginAtoms() const {
80  return d_atoms.begin();
81  };
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 #endif
AtomPtrContainer::const_iterator endAtoms() const
const AtomPtrContainer & getAtoms() const
returns our atom container of
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 ROMol * getMol() const
return a pointer to our associated molecule
int getActiveConformer() const
returns the active conformer (in the associated molecule)
AtomPtrContainer::const_iterator beginAtoms() const
const MolChemicalFeatureDef * getFeatDef() const
return a pointer to our feature definition
abstract base class for chemical feature
const MolChemicalFeatureFactory * getFactory() const
return a pointer to our feature factory
Std stuff.
Definition: Atom.h:30
#define RDKIT_MOLCHEMICALFEATURES_EXPORT
Definition: export.h:372
int getId() const
returns the active conformer (in the associated molecule)
AtomPtrContainer::const_iterator AtomPtrContainer_CI
void clearCache()
clears out the internal position cache
unsigned int getNumAtoms() const
returns the number of atoms defining the feature