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>
19
20#include <boost/shared_ptr.hpp>
21namespace RDKit {
22class ROMol;
23class MolChemicalFeatureDef;
24
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()) {
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
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
Defines the primary molecule class ROMol as well as associated typedefs.
const std::string & getFamily() const
std::vector< double >::const_iterator beginWeights() const
std::vector< double >::iterator endWeights()
std::vector< double >::const_iterator endWeights() const
void setWeights(const std::vector< double > &weights)
const std::string & getType() const
std::vector< double >::iterator beginWeights()
std::list< boost::shared_ptr< MolChemicalFeatureDef > > CollectionType
MolChemicalFeatureDef(const std::string &smarts, std::string family, std::string type)
const std::string & getSmarts() const
Class to allow us to throw a ValueError from C++ and have it make it back to Python.
Definition Exceptions.h:40
#define RDKIT_MOLCHEMICALFEATURES_EXPORT
Definition export.h:289
Std stuff.