File: MolChemicalFeature.h

package info (click to toggle)
rdkit 201203-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 37,840 kB
  • sloc: cpp: 93,902; python: 51,897; java: 5,192; ansic: 3,497; xml: 2,499; sql: 1,641; yacc: 1,518; lex: 1,076; makefile: 325; fortran: 183; sh: 153; cs: 51
file content (95 lines) | stat: -rw-r--r-- 3,171 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
//  Copyright (C) 2004-2006 Rational Discovery LLC
//
//   @@ All Rights Reserved @@
//  This file is part of the RDKit.
//  The contents are covered by the terms of the BSD license
//  which is included in the file license.txt, found at the root
//  of the RDKit source tree.
//
#ifndef __MOLCHEMICALFEATURE_H_11012005_1404__
#define __MOLCHEMICALFEATURE_H_11012005_1404__

#include <string>
#include <vector>
#include <map>
#include <Geometry/point.h>
#include <ChemicalFeatures/ChemicalFeature.h>

namespace RDKit {
  class ROMol;
  class Atom;
  class MolChemicalFeatureFactory;
  class MolChemicalFeatureDef;
  
  
  class MolChemicalFeature : public ChemicalFeatures::ChemicalFeature {

    friend class MolChemicalFeatureFactory;
  public:
    typedef std::vector<const Atom *> AtomPtrContainer;
    typedef AtomPtrContainer::const_iterator AtomPtrContainer_CI;

    //! Constructor
    MolChemicalFeature(const ROMol *mol,
		       const MolChemicalFeatureFactory *factory,
                       const MolChemicalFeatureDef *fdef) :
      dp_mol(mol), dp_factory(factory), dp_def(fdef), d_activeConf(-1) {};

    ~MolChemicalFeature() {}

    //! \brief return the name of the feature's family
    const std::string &getFamily() const;
    //! \brief return the name of the feature's type
    const std::string &getType() const;
    //! \brief return the position of the feature (obtained from
    //! from the associated conformation
    RDGeom::Point3D getPos() const;

    //! \brief return the position of the feature (obtained from
    //! from the requested conformation from the associated molecule)
    RDGeom::Point3D getPos(int confId) const;
    //! \brief return a pointer to our feature factory
    const MolChemicalFeatureFactory *getFactory() const { return dp_factory; };
    //! \brief return a pointer to our associated molecule
    const ROMol *getMol() const { return dp_mol; };
    //! \brief return a pointer to our feature definition
    const MolChemicalFeatureDef *getFeatDef() const { return dp_def; };
    
    //! \brief returns the number of atoms defining the feature
    inline unsigned int getNumAtoms() const {
      return d_atoms.size();
    }

    //! \brief sets the active conformer (in the associated molecule)
    void setActiveConformer(int confId);

    //! \brief returns the active conformer (in the associated molecule)
    int getActiveConformer() const { return d_activeConf;};

    //! \brief clears out the internal position cache
    void clearCache() { d_locs.clear(); };
    
    //! \brief returns our atom container of
    const AtomPtrContainer &getAtoms() const {
      return d_atoms;
    }
    AtomPtrContainer::const_iterator beginAtoms() const { return d_atoms.begin(); };
    AtomPtrContainer::const_iterator endAtoms() const { return d_atoms.end(); };

  private:
    typedef std::map<int,RDGeom::Point3D> PointCacheType;
    const ROMol *dp_mol;
    const MolChemicalFeatureFactory *dp_factory;
    const MolChemicalFeatureDef *dp_def;
    //std::string d_type;
    //std::string d_family;

    int d_activeConf;
    AtomPtrContainer d_atoms;
    mutable PointCacheType d_locs;
  };
  
}

#endif