RDKit: FragCatParams.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
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
19namespace RDKit {
20class ROMol;
21 typedef std::vector<boost::shared_ptr<ROMol>> MOL_SPTR_VECT;
22
23//! container for user parameters used to create a fragment catalog
24 class RDKIT_FRAGCATALOG_EXPORT FragCatParams : public RDCatalog::CatalogParams {
25 // FIX: this container is still missing all the CASE-type functional groups
26 // stuff
27 public:
28 FragCatParams() {
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() override;
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 override;
79 std::string Serialize() const override;
80 void initFromStream(std::istream &ss) override;
81 void initFromString(const std::string &text) override;
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
CatalogParams.h
RDCatalog::CatalogParams
abstract base class for the container used to create a catalog
Definition CatalogParams.h:18
RDCatalog::CatalogParams::d_typeStr
std::string d_typeStr
our type string
Definition CatalogParams.h:38
RDKit::FragCatParams::FragCatParams
FragCatParams(const FragCatParams &other)
copy constructor
RDKit::FragCatParams::setLowerFragLength
void setLowerFragLength(unsigned int lFrLen)
sets our lower fragment length
Definition FragCatParams.h:55
RDKit::FragCatParams::initFromStream
void initFromStream(std::istream &ss) override
initializes from a stream pickle
RDKit::FragCatParams::getUpperFragLength
unsigned int getUpperFragLength() const
returns our upper fragment length
Definition FragCatParams.h:58
RDKit::FragCatParams::FragCatParams
FragCatParams()
Definition FragCatParams.h:28
RDKit::FragCatParams::initFromString
void initFromString(const std::string &text) override
initializes from a string pickle
RDKit::FragCatParams::getFuncGroup
const ROMol * getFuncGroup(unsigned int fid) const
returns a pointer to a specific functional group
RDKit::FragCatParams::setUpperFragLength
void setUpperFragLength(unsigned int uFrLen)
sets our upper fragment length
Definition FragCatParams.h:60
RDKit::FragCatParams::getTolerance
double getTolerance() const
returns our fragment-comparison tolerance
Definition FragCatParams.h:63
RDKit::FragCatParams::toStream
void toStream(std::ostream &) const override
serializes (pickles) to a stream
RDKit::FragCatParams::FragCatParams
FragCatParams(unsigned int lLen, unsigned int uLen, const std::string &fgroupFile, double tol=1e-08)
construct from a function-group file
RDKit::FragCatParams::getNumFuncGroups
unsigned int getNumFuncGroups() const
returns our number of functional groups
Definition FragCatParams.h:68
RDKit::FragCatParams::FragCatParams
FragCatParams(const std::string &pickle)
construct from a pickle string (serialized representation)
RDKit::FragCatParams::getFuncGroups
const MOL_SPTR_VECT & getFuncGroups() const
returns our std::vector of functional groups
RDKit::FragCatParams::Serialize
std::string Serialize() const override
returns a string with a serialized (pickled) representation
RDKit::FragCatParams::getLowerFragLength
unsigned int getLowerFragLength() const
returns our lower fragment length
Definition FragCatParams.h:53
RDKit::FragCatParams::setTolerance
void setTolerance(double val)
sets our fragment-comparison tolerance
Definition FragCatParams.h:65
RDKit::FragCatParams::~FragCatParams
~FragCatParams() override
RDKit::ROMol
Definition ROMol.h:199
export.h
RDKIT_FRAGCATALOG_EXPORT
#define RDKIT_FRAGCATALOG_EXPORT
Definition export.h:217
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::MOL_SPTR_VECT
std::vector< boost::shared_ptr< ROMol > > MOL_SPTR_VECT
Definition FragCatParams.h:21