RDKit
Open-source cheminformatics and machine learning.
FragCatParams.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2003-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 _RD_FRAG_CAT_PARAMS_H_
12 #define _RD_FRAG_CAT_PARAMS_H_
13 
14 #include <Catalogs/CatalogParams.h>
15 #include <string>
16 #include <vector>
17 #include <boost/shared_ptr.hpp>
18 
19 namespace RDKit {
20 class ROMol;
21 typedef std::vector<boost::shared_ptr<ROMol>> MOL_SPTR_VECT;
22 
23 //! container for user parameters used to create a fragment catalog
25  // FIX: this container is still missing all the CASE-type functional groups
26  // stuff
27  public:
29  d_typeStr = "Fragment Catalog Parameters";
30  d_lowerFragLen = 0;
31  d_upperFragLen = 0;
32  d_tolerance = 1e-8;
33  d_funcGroups.clear();
34  }
35  //! construct from a function-group file
36  /*!
37  \param lLen the lower limit on fragment size
38  \param uLen the upper limit on fragment size
39  \param fgroupFile the name of the function-group file
40  \param tol (optional) the eigenvalue tolerance to be used
41  when comparing fragments
42  */
43  FragCatParams(unsigned int lLen, unsigned int uLen,
44  const std::string &fgroupFile, double tol = 1e-08);
45  //! copy constructor
46  FragCatParams(const FragCatParams &other);
47  //! construct from a pickle string (serialized representation)
48  FragCatParams(const std::string &pickle);
49 
50  ~FragCatParams();
51 
52  //! returns our lower fragment length
53  unsigned int getLowerFragLength() const { return d_lowerFragLen; }
54  //! sets our lower fragment length
55  void setLowerFragLength(unsigned int lFrLen) { d_lowerFragLen = lFrLen; }
56 
57  //! returns our upper fragment length
58  unsigned int getUpperFragLength() const { return d_upperFragLen; }
59  //! sets our upper fragment length
60  void setUpperFragLength(unsigned int uFrLen) { d_upperFragLen = uFrLen; }
61 
62  //! returns our fragment-comparison tolerance
63  double getTolerance() const { return d_tolerance; }
64  //! sets our fragment-comparison tolerance
65  void setTolerance(double val) { d_tolerance = val; }
66 
67  //! returns our number of functional groups
68  unsigned int getNumFuncGroups() const {
69  return static_cast<unsigned int>(d_funcGroups.size());
70  }
71 
72  //! returns our std::vector of functional groups
73  const MOL_SPTR_VECT &getFuncGroups() const;
74 
75  //! returns a pointer to a specific functional group
76  const ROMol *getFuncGroup(unsigned int fid) const;
77 
78  void toStream(std::ostream &) const;
79  std::string Serialize() const;
80  void initFromStream(std::istream &ss);
81  void initFromString(const std::string &text);
82 
83  private:
84  unsigned int d_lowerFragLen;
85  unsigned int d_upperFragLen;
86 
87  double d_tolerance; //!< tolerance value used when comparing subgraph
88  // discriminators
89 
90  MOL_SPTR_VECT d_funcGroups;
91 };
92 } // namespace RDKit
93 
94 #endif
RDKit::FragCatParams::getTolerance
double getTolerance() const
returns our fragment-comparison tolerance
Definition: FragCatParams.h:63
RDKit::EnumerationStrategyPickler::pickle
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
RDKit::FragCatParams::setTolerance
void setTolerance(double val)
sets our fragment-comparison tolerance
Definition: FragCatParams.h:65
RDKit::FragCatParams
container for user parameters used to create a fragment catalog
Definition: FragCatParams.h:24
RDKit::ROMol
Definition: ROMol.h:171
RDKit::FragCatParams::setUpperFragLength
void setUpperFragLength(unsigned int uFrLen)
sets our upper fragment length
Definition: FragCatParams.h:60
RDKit::MOL_SPTR_VECT
std::vector< boost::shared_ptr< ROMol > > MOL_SPTR_VECT
Definition: FragCatParams.h:20
RDKit::FragCatParams::setLowerFragLength
void setLowerFragLength(unsigned int lFrLen)
sets our lower fragment length
Definition: FragCatParams.h:55
CatalogParams.h
RDCatalog::CatalogParams
abstract base class for the container used to create a catalog
Definition: CatalogParams.h:18
RDKit::FragCatParams::FragCatParams
FragCatParams()
Definition: FragCatParams.h:28
RDKit
Std stuff.
Definition: Atom.h:30
RDKit::FragCatParams::getUpperFragLength
unsigned int getUpperFragLength() const
returns our upper fragment length
Definition: FragCatParams.h:58
RDKit::FragCatParams::getLowerFragLength
unsigned int getLowerFragLength() const
returns our lower fragment length
Definition: FragCatParams.h:53
RDLog::toStream
RDKIT_RDGENERAL_EXPORT std::ostream & toStream(std::ostream &)
RDKit::FragCatParams::getNumFuncGroups
unsigned int getNumFuncGroups() const
returns our number of functional groups
Definition: FragCatParams.h:68
RDKIT_FRAGCATALOG_EXPORT
#define RDKIT_FRAGCATALOG_EXPORT
Definition: export.h:281
export.h