File: MolChemicalFeature.h

package info (click to toggle)
rdkit 201809.1%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 123,688 kB
  • sloc: cpp: 230,509; python: 70,501; java: 6,329; ansic: 5,427; sql: 1,899; yacc: 1,739; lex: 1,243; makefile: 445; xml: 229; fortran: 183; sh: 123; cs: 93
file content (97 lines) | stat: -rw-r--r-- 3,221 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
96
97
//
//  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.
//
#include <RDGeneral/export.h>
#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 RDKIT_MOLCHEMICALFEATURES_EXPORT 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, int id = -1)
      : dp_mol(mol),
        dp_factory(factory),
        dp_def(fdef),
        d_id(id),
        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 active conformer (in the associated molecule)
  int getId() const { return d_id; };

  //! \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;
  int d_id;
  int d_activeConf;
  AtomPtrContainer d_atoms;
  mutable PointCacheType d_locs;
};
}

#endif