Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _RD_FRAGCATALOGENTRY_H_
00011 #define _RD_FRAGCATALOGENTRY_H_
00012
00013 #include "FragCatParams.h"
00014 #include <RDGeneral/utils.h>
00015 #include <Catalogs/CatalogEntry.h>
00016 #include <GraphMol/RDKitBase.h>
00017 #include <GraphMol/Subgraphs/Subgraphs.h>
00018 #include <GraphMol/Subgraphs/SubgraphUtils.h>
00019 #include <GraphMol/SmilesParse/SmilesWrite.h>
00020 #include <GraphMol/Substruct/SubstructMatch.h>
00021 #include <map>
00022 #include <sstream>
00023
00024 namespace RDKit {
00025
00026 class FragCatalogEntry : public RDCatalog::CatalogEntry {
00027 public :
00028
00029 FragCatalogEntry() : dp_mol(0),d_descrip(""),d_order(0) {
00030 dp_props = new Dict();
00031 setBitId(-1);
00032 }
00033
00034 FragCatalogEntry(const ROMol *omol, const PATH_TYPE &path, const MatchVectType &aidToFid);
00035 FragCatalogEntry(const std::string &pickle);
00036
00037 ~FragCatalogEntry() {
00038 if(dp_mol){
00039 delete dp_mol;
00040 dp_mol=0;
00041 }
00042 if(dp_props){
00043 delete dp_props;
00044 dp_props=0;
00045 }
00046 }
00047
00048 std::string getDescription() const {return d_descrip;}
00049
00050 void setDescription(std::string val) {d_descrip = val;}
00051
00052 void setDescription(const FragCatParams *params);
00053
00054
00055
00056
00057 bool match(const FragCatalogEntry *other, double tol) const;
00058
00059 Subgraphs::DiscrimTuple getDiscrims() const;
00060
00061 unsigned int getOrder() const {
00062 return dp_mol->getNumBonds();
00063 }
00064
00065 const INT_INT_VECT_MAP &getFuncGroupMap() const {
00066 return d_aToFmap;
00067 }
00068
00069
00070 std::string getSmarts(){return "";}
00071
00072
00073 template <typename T> void setProp(const char *key, T &val) const {
00074 dp_props->setVal(key, val);
00075 }
00076
00077 template <typename T> void setProp(const std::string key, T &val) const {
00078 setProp(key.c_str(), val);
00079 }
00080
00081 void setProp(const char *key, int val) const {
00082 dp_props->setVal(key, val);
00083 }
00084
00085 void setProp(const std::string key, int val) const {
00086 setProp(key.c_str(), val);
00087 }
00088
00089 void setProp(const char *key, float val) const {
00090 dp_props->setVal(key, val);
00091 }
00092
00093 void setProp(const std::string key, float val) const {
00094 setProp(key.c_str(), val);
00095 }
00096
00097 void setProp(const std::string key, std::string val) const {
00098 setProp(key.c_str(), val);
00099 }
00100
00101 template <typename T>
00102 void getProp(const char *key, T &res) const {
00103 dp_props->getVal(key, res);
00104 }
00105 template <typename T>
00106 void getProp(const std::string key, T &res) const {
00107 getProp(key.c_str(), res);
00108 }
00109
00110 bool hasProp(const char *key) const {
00111 if (!dp_props) return false;
00112 return dp_props->hasVal(key);
00113 }
00114 bool hasProp(const std::string key) const {
00115 return hasProp(key.c_str());
00116 }
00117
00118 void clearProp(const char *key) const {
00119 dp_props->clearVal(key);
00120 }
00121
00122 void clearProp(const std::string key) const {
00123 clearProp(key.c_str());
00124 }
00125
00126 void toStream(std::ostream &ss) const;
00127 std::string Serialize() const;
00128 void initFromStream(std::istream &ss);
00129 void initFromString(const std::string &text);
00130
00131
00132 private:
00133
00134 ROMol *dp_mol;
00135 Dict *dp_props;
00136
00137 std::string d_descrip;
00138
00139 unsigned int d_order;
00140
00141
00142
00143
00144 INT_INT_VECT_MAP d_aToFmap;
00145 };
00146 }
00147
00148 #endif
00149