RDKit: MolChemicalFeature.h Source File

| 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>
18#include <ChemicalFeatures/ChemicalFeature.h>
19
20namespace RDKit {
21class ROMol;
22class Atom;
23class MolChemicalFeatureFactory;
24class MolChemicalFeatureDef;
25
26 class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeature
27 : public ChemicalFeatures::ChemicalFeature {
28 friend class MolChemicalFeatureFactory;
29
30 public:
31 typedef std::vector<const Atom *> AtomPtrContainer;
32 typedef AtomPtrContainer::const_iterator AtomPtrContainer_CI;
33
34 //! Constructor
35 MolChemicalFeature(const ROMol *mol, const MolChemicalFeatureFactory *factory,
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
ChemicalFeature.h
ChemicalFeatures::ChemicalFeature
abstract base class for chemical feature
Definition ChemicalFeature.h:19
RDGeom::Point3D
Definition point.h:53
RDKit::Atom
The class for representing atoms.
Definition Atom.h:74
RDKit::MolChemicalFeatureDef
Definition MolChemicalFeatureDef.h:25
RDKit::MolChemicalFeatureFactory
The class for finding chemical features in molecules.
Definition MolChemicalFeatureFactory.h:24
RDKit::MolChemicalFeature::getNumAtoms
unsigned int getNumAtoms() const
returns the number of atoms defining the feature
Definition MolChemicalFeature.h:67
RDKit::MolChemicalFeature::~MolChemicalFeature
~MolChemicalFeature() override=default
RDKit::MolChemicalFeature::getActiveConformer
int getActiveConformer() const
returns the active conformer (in the associated molecule)
Definition MolChemicalFeature.h:73
RDKit::MolChemicalFeature::MolChemicalFeatureFactory
friend class MolChemicalFeatureFactory
Definition MolChemicalFeature.h:28
RDKit::MolChemicalFeature::beginAtoms
AtomPtrContainer::const_iterator beginAtoms() const
Definition MolChemicalFeature.h:80
RDKit::MolChemicalFeature::getFeatDef
const MolChemicalFeatureDef * getFeatDef() const
return a pointer to our feature definition
Definition MolChemicalFeature.h:61
RDKit::MolChemicalFeature::AtomPtrContainer_CI
AtomPtrContainer::const_iterator AtomPtrContainer_CI
Definition MolChemicalFeature.h:32
RDKit::MolChemicalFeature::getFamily
const std::string & getFamily() const override
return the name of the feature's family
RDKit::MolChemicalFeature::setActiveConformer
void setActiveConformer(int confId)
sets the active conformer (in the associated molecule)
RDKit::MolChemicalFeature::endAtoms
AtomPtrContainer::const_iterator endAtoms() const
Definition MolChemicalFeature.h:83
RDKit::MolChemicalFeature::MolChemicalFeature
MolChemicalFeature(const ROMol *mol, const MolChemicalFeatureFactory *factory, const MolChemicalFeatureDef *fdef, int id=-1)
Constructor.
Definition MolChemicalFeature.h:35
RDKit::MolChemicalFeature::getPos
RDGeom::Point3D getPos() const override
return the position of the feature (obtained from from the associated conformation
RDKit::MolChemicalFeature::getPos
RDGeom::Point3D getPos(int confId) const
return the position of the feature (obtained from from the requested conformation from the associated...
RDKit::MolChemicalFeature::clearCache
void clearCache()
clears out the internal position cache
Definition MolChemicalFeature.h:76
RDKit::MolChemicalFeature::getAtoms
const AtomPtrContainer & getAtoms() const
returns our atom container of
Definition MolChemicalFeature.h:79
RDKit::MolChemicalFeature::getMol
const ROMol * getMol() const
return a pointer to our associated molecule
Definition MolChemicalFeature.h:59
RDKit::MolChemicalFeature::getType
const std::string & getType() const override
return the name of the feature's type
RDKit::MolChemicalFeature::getFactory
const MolChemicalFeatureFactory * getFactory() const
return a pointer to our feature factory
Definition MolChemicalFeature.h:57
RDKit::MolChemicalFeature::AtomPtrContainer
std::vector< const Atom * > AtomPtrContainer
Definition MolChemicalFeature.h:31
RDKit::MolChemicalFeature::getId
int getId() const override
returns the active conformer (in the associated molecule)
Definition MolChemicalFeature.h:64
RDKit::ROMol
Definition ROMol.h:199
export.h
RDKIT_MOLCHEMICALFEATURES_EXPORT
#define RDKIT_MOLCHEMICALFEATURES_EXPORT
Definition export.h:305
RDKit
Std stuff.
Definition Abbreviations.h:19
point.h