RDKit
Open-source cheminformatics and machine learning.
FreeChemicalFeature.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2008 Greg Landrum and 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 __FREECHEMICALFEATURE_H_13012005_1023__
12 #define __FREECHEMICALFEATURE_H_13012005_1023__
13 
14 #include <Geometry/point.h>
16 
17 namespace ChemicalFeatures {
18 
19 //------------------------------------------------------
20 //! Class for chemical features that do not originate from molecules
21 // e.g. pharmacophores, site-maps etc.
23  : public ChemicalFeature {
24  public:
25  //! start with everything specified
26  FreeChemicalFeature(const std::string &family, std::string type,
27  const RDGeom::Point3D &loc, int id = -1)
28  : d_id(id), d_family(family), d_type(type), d_position(loc) {}
29 
30  //! start with family and location specified, leave the type blank
31  FreeChemicalFeature(const std::string &family, const RDGeom::Point3D &loc)
32  : d_id(-1), d_family(family), d_type(""), d_position(loc) {}
33 
34  //! start with everything blank
36  :
37  d_family(""),
38  d_type(""),
39  d_position(RDGeom::Point3D(0.0, 0.0, 0.0)) {}
40 
41  explicit FreeChemicalFeature(const std::string &pickle) {
42  this->initFromString(pickle);
43  }
44 
46  : d_id(other.getId()),
47  d_family(other.getFamily()),
48  d_type(other.getType()),
49  d_position(other.getPos()) {}
50 
52 
53  //! return our id
54  int getId() const { return d_id; }
55 
56  //! return our family
57  const std::string &getFamily() const { return d_family; }
58 
59  //! return our type
60  const std::string &getType() const { return d_type; }
61 
62  //! return our position
63  RDGeom::Point3D getPos() const { return d_position; }
64 
65  //! set our id
66  void setId(const int id) { d_id = id; }
67 
68  //! set our family
69  void setFamily(const std::string &family) { d_family = family; }
70 
71  //! set our type
72  void setType(const std::string &type) { d_type = type; }
73 
74  //! set our position
75  void setPos(const RDGeom::Point3D &loc) {
76  // std::cout << loc.x << " " << loc.y << " " << loc.z << "\n";
77  d_position = loc;
78  // std::cout << d_position.x << " " << d_position.y << " " << d_position.z
79  // << "\n";
80  }
81 
82  //! returns a serialized form of the feature (a pickle)
83  std::string toString() const;
84  //! initialize from a pickle string
85  void initFromString(const std::string &pickle);
86 
87  private:
88  int d_id{-1};
89  std::string d_family;
90  std::string d_type;
91  RDGeom::Point3D d_position;
92 };
93 } // namespace ChemicalFeatures
94 
95 #endif
abstract base class for chemical feature
Class for chemical features that do not originate from molecules.
FreeChemicalFeature()
start with everything blank
void initFromString(const std::string &pickle)
initialize from a pickle string
FreeChemicalFeature(const std::string &family, const RDGeom::Point3D &loc)
start with family and location specified, leave the type blank
std::string toString() const
returns a serialized form of the feature (a pickle)
FreeChemicalFeature(const std::string &family, std::string type, const RDGeom::Point3D &loc, int id=-1)
start with everything specified
FreeChemicalFeature(const FreeChemicalFeature &other)
void setId(const int id)
set our id
void setType(const std::string &type)
set our type
FreeChemicalFeature(const std::string &pickle)
void setPos(const RDGeom::Point3D &loc)
set our position
const std::string & getFamily() const
return our family
const std::string & getType() const
return our type
void setFamily(const std::string &family)
set our family
RDGeom::Point3D getPos() const
return our position
#define RDKIT_CHEMICALFEATURES_EXPORT
Definition: export.h:112
RDKIT_CHEMREACTIONS_EXPORT void pickle(const boost::shared_ptr< EnumerationStrategyBase > &enumerator, std::ostream &ss)
pickles a EnumerationStrategy and adds the results to a stream ss