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 
27 
28  public:
29  typedef std::vector<const Atom *> AtomPtrContainer;
30  typedef AtomPtrContainer::const_iterator AtomPtrContainer_CI;
31 
32  //! Constructor
34  const MolChemicalFeatureDef *fdef, int id = -1)
35  : dp_mol(mol),
36  dp_factory(factory),
37  dp_def(fdef),
38  d_id(id),
39  d_activeConf(-1){};
40 
42 
43  //! \brief return the name of the feature's family
44  const std::string &getFamily() const;
45  //! \brief return the name of the feature's type
46  const std::string &getType() const;
47  //! \brief return the position of the feature (obtained from
48  //! from the associated conformation
49  RDGeom::Point3D getPos() const;
50 
51  //! \brief return the position of the feature (obtained from
52  //! from the requested conformation from the associated molecule)
53  RDGeom::Point3D getPos(int confId) const;
54  //! \brief return a pointer to our feature factory
55  const MolChemicalFeatureFactory *getFactory() const { return dp_factory; };
56  //! \brief return a pointer to our associated molecule
57  const ROMol *getMol() const { return dp_mol; };
58  //! \brief return a pointer to our feature definition
59  const MolChemicalFeatureDef *getFeatDef() const { return dp_def; };
60 
61  //! \brief returns the active conformer (in the associated molecule)
62  int getId() const { return d_id; };
63 
64  //! \brief returns the number of atoms defining the feature
65  inline unsigned int getNumAtoms() const { return d_atoms.size(); }
66 
67  //! \brief sets the active conformer (in the associated molecule)
68  void setActiveConformer(int confId);
69 
70  //! \brief returns the active conformer (in the associated molecule)
71  int getActiveConformer() const { return d_activeConf; };
72 
73  //! \brief clears out the internal position cache
74  void clearCache() { d_locs.clear(); };
75 
76  //! \brief returns our atom container of
77  const AtomPtrContainer &getAtoms() const { return d_atoms; }
78  AtomPtrContainer::const_iterator beginAtoms() const {
79  return d_atoms.begin();
80  };
81  AtomPtrContainer::const_iterator endAtoms() const { return d_atoms.end(); };
82 
83  private:
84  typedef std::map<int, RDGeom::Point3D> PointCacheType;
85 
86  const ROMol *dp_mol;
87  const MolChemicalFeatureFactory *dp_factory;
88  const MolChemicalFeatureDef *dp_def;
89  int d_id;
90  int d_activeConf;
91  AtomPtrContainer d_atoms;
92  mutable PointCacheType d_locs;
93 };
94 }
95 
96 #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.
int getId() const
returns the active conformer (in the associated molecule)
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:103
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:29
AtomPtrContainer::const_iterator AtomPtrContainer_CI
AtomPtrContainer::const_iterator endAtoms() const
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