RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
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
20namespace RDKit {
21class ROMol;
22class Atom;
23class MolChemicalFeatureFactory;
24class 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
43 ~MolChemicalFeature() override = default;
44
45 //! \brief return the name of the feature's family
46 const std::string &getFamily() const override;
47 //! \brief return the name of the feature's type
48 const std::string &getType() const override;
49 //! \brief return the position of the feature (obtained from
50 //! from the associated conformation
51 RDGeom::Point3D getPos() const override;
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 override { 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
abstract base class for chemical feature
The class for finding chemical features in molecules.
unsigned int getNumAtoms() const
returns the number of atoms defining the feature
~MolChemicalFeature() override=default
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
AtomPtrContainer::const_iterator AtomPtrContainer_CI
const std::string & getFamily() const override
return the name of the feature's family
void setActiveConformer(int confId)
sets the active conformer (in the associated molecule)
AtomPtrContainer::const_iterator endAtoms() const
MolChemicalFeature(const ROMol *mol, const MolChemicalFeatureFactory *factory, const MolChemicalFeatureDef *fdef, int id=-1)
Constructor.
RDGeom::Point3D getPos() const override
return the position of the feature (obtained from from the associated conformation
RDGeom::Point3D getPos(int confId) const
return the position of the feature (obtained from from the requested conformation from the associated...
void clearCache()
clears out the internal position cache
const AtomPtrContainer & getAtoms() const
returns our atom container of
const ROMol * getMol() const
return a pointer to our associated molecule
const std::string & getType() const override
return the name of the feature's type
const MolChemicalFeatureFactory * getFactory() const
return a pointer to our feature factory
std::vector< const Atom * > AtomPtrContainer
int getId() const override
returns the active conformer (in the associated molecule)
#define RDKIT_MOLCHEMICALFEATURES_EXPORT
Definition export.h:289
Std stuff.