RDKit: MolChemicalFeatureDef.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
MolChemicalFeatureDef.h
Go to the documentation of this file.
1//
2// Copyright (C) 2004-2010 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 __CHEMICALFEATUREDEF_H_02122004_1750__
12#define __CHEMICALFEATUREDEF_H_02122004_1750__
13
14#include <string>
15#include <vector>
16#include <list>
17#include <GraphMol/ROMol.h>
18#include <RDGeneral/Exceptions.h>
19
20#include <boost/shared_ptr.hpp>
21namespace RDKit {
22class ROMol;
23class MolChemicalFeatureDef;
24
25 class RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeatureDef {
26 public:
27 typedef std::list<boost::shared_ptr<MolChemicalFeatureDef>> CollectionType;
28
29 MolChemicalFeatureDef() : d_family(""), d_type(""), d_smarts("") {}
30 MolChemicalFeatureDef(const std::string &smarts, std::string family,
31 std::string type);
32
33 unsigned int getNumWeights() const { return d_weights.size(); }
34 std::vector<double>::iterator beginWeights() { return d_weights.begin(); }
35 std::vector<double>::iterator endWeights() { return d_weights.end(); }
36
37 std::vector<double>::const_iterator beginWeights() const {
38 return d_weights.begin();
39 }
40 std::vector<double>::const_iterator endWeights() const {
41 return d_weights.end();
42 }
43
44 void setWeights(const std::vector<double> &weights) {
45 d_weights.insert(d_weights.begin(), weights.begin(), weights.end());
46 if (getPattern() && d_weights.size() != getPattern()->getNumAtoms()) {
47 throw ValueErrorException(
48 " pattern->getNumAtoms() != len(feature weight vector)");
49 }
50 }
51
52 const std::string &getFamily() const { return d_family; }
53 const std::string &getType() const { return d_type; }
54 const std::string &getSmarts() const { return d_smarts; }
55
56 void normalizeWeights();
57
58 const ROMol *getPattern() const { return dp_pattern.get(); }
59
60 private:
61 std::string d_family;
62 std::string d_type;
63 std::string d_smarts;
64 boost::shared_ptr<ROMol> dp_pattern;
65 std::vector<double> d_weights;
66};
67} // namespace RDKit
68#endif
Exceptions.h
ROMol.h
Defines the primary molecule class ROMol as well as associated typedefs.
RDKit::MolChemicalFeatureDef
Definition MolChemicalFeatureDef.h:25
RDKit::MolChemicalFeatureDef::getFamily
const std::string & getFamily() const
Definition MolChemicalFeatureDef.h:52
RDKit::MolChemicalFeatureDef::beginWeights
std::vector< double >::const_iterator beginWeights() const
Definition MolChemicalFeatureDef.h:37
RDKit::MolChemicalFeatureDef::getPattern
const ROMol * getPattern() const
Definition MolChemicalFeatureDef.h:58
RDKit::MolChemicalFeatureDef::endWeights
std::vector< double >::iterator endWeights()
Definition MolChemicalFeatureDef.h:35
RDKit::MolChemicalFeatureDef::endWeights
std::vector< double >::const_iterator endWeights() const
Definition MolChemicalFeatureDef.h:40
RDKit::MolChemicalFeatureDef::getNumWeights
unsigned int getNumWeights() const
Definition MolChemicalFeatureDef.h:33
RDKit::MolChemicalFeatureDef::setWeights
void setWeights(const std::vector< double > &weights)
Definition MolChemicalFeatureDef.h:44
RDKit::MolChemicalFeatureDef::MolChemicalFeatureDef
MolChemicalFeatureDef()
Definition MolChemicalFeatureDef.h:29
RDKit::MolChemicalFeatureDef::getType
const std::string & getType() const
Definition MolChemicalFeatureDef.h:53
RDKit::MolChemicalFeatureDef::normalizeWeights
void normalizeWeights()
RDKit::MolChemicalFeatureDef::beginWeights
std::vector< double >::iterator beginWeights()
Definition MolChemicalFeatureDef.h:34
RDKit::MolChemicalFeatureDef::CollectionType
std::list< boost::shared_ptr< MolChemicalFeatureDef > > CollectionType
Definition MolChemicalFeatureDef.h:27
RDKit::MolChemicalFeatureDef::MolChemicalFeatureDef
MolChemicalFeatureDef(const std::string &smarts, std::string family, std::string type)
RDKit::MolChemicalFeatureDef::getSmarts
const std::string & getSmarts() const
Definition MolChemicalFeatureDef.h:54
RDKit::ROMol
Definition ROMol.h:199
ValueErrorException
Class to allow us to throw a ValueError from C++ and have it make it back to Python.
Definition Exceptions.h:40
export.h
RDKIT_MOLCHEMICALFEATURES_EXPORT
#define RDKIT_MOLCHEMICALFEATURES_EXPORT
Definition export.h:305
RDKit
Std stuff.
Definition Abbreviations.h:19