MolChemicalFeatureDef.h
Go to the documentation of this file.
//
// Copyright (C) 2004-2010 Greg Landrum and Rational Discovery LLC
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#ifndef __CHEMICALFEATUREDEF_H_02122004_1750__
#define __CHEMICALFEATUREDEF_H_02122004_1750__
#include <string>
#include <vector>
#include <list>
#include <GraphMol/ROMol.h>
#include <RDGeneral/Exceptions.h>
#include <boost/shared_ptr.hpp>
namespace RDKit {
class ROMol;
class MolChemicalFeatureDef;
class MolChemicalFeatureDef {
public:
typedef std::list< boost::shared_ptr<MolChemicalFeatureDef> > CollectionType;
MolChemicalFeatureDef() : d_family(""),d_type(""),d_smarts("") {};
MolChemicalFeatureDef(const std::string &smarts,const std::string &family,
const std::string &type);
unsigned int getNumWeights() const { return d_weights.size(); };
std::vector<double>::iterator beginWeights() { return d_weights.begin();};
std::vector<double>::iterator endWeights() { return d_weights.end();};
std::vector<double>::const_iterator beginWeights() const { return d_weights.begin();};
std::vector<double>::const_iterator endWeights() const { return d_weights.end();};
void setWeights(const std::vector<double> &weights){
d_weights.insert(d_weights.begin(),weights.begin(),weights.end());
if(getPattern() && d_weights.size()!=getPattern()->getNumAtoms()){
throw ValueErrorException(" pattern->getNumAtoms() != len(feature weight vector)");
}
}
const std::string &getFamily() const {return d_family;};
const std::string &getType() const {return d_type;};
const std::string &getSmarts() const {return d_smarts;};
void normalizeWeights();
const ROMol *getPattern() const { return dp_pattern.get(); };
private:
std::string d_family;
std::string d_type;
std::string d_smarts;
boost::shared_ptr<ROMol> dp_pattern;
std::vector<double> d_weights;
};
}
#endif
RDKit::MolChemicalFeatureDef::getPattern
const ROMol * getPattern() const
Definition: MolChemicalFeatureDef.h:52
RDKit::MolChemicalFeatureDef::getNumWeights
unsigned int getNumWeights() const
Definition: MolChemicalFeatureDef.h:32
RDKit::MolChemicalFeatureDef::getType
const std::string & getType() const
Definition: MolChemicalFeatureDef.h:47
RDKit::MolChemicalFeatureDef::normalizeWeights
void normalizeWeights()
RDKit::MolChemicalFeatureDef::beginWeights
std::vector< double >::const_iterator beginWeights() const
Definition: MolChemicalFeatureDef.h:36
ROMol.h
Defines the primary molecule class ROMol as well as associated typedefs.
RDKit::MolChemicalFeatureDef::MolChemicalFeatureDef
MolChemicalFeatureDef()
Definition: MolChemicalFeatureDef.h:28
RDKit::ROMol::getNumAtoms
unsigned int getNumAtoms(bool onlyExplicit=1) const
returns our number of atoms
RDKit::MolChemicalFeatureDef::beginWeights
std::vector< double >::iterator beginWeights()
Definition: MolChemicalFeatureDef.h:33
RDKit::MolChemicalFeatureDef::endWeights
std::vector< double >::iterator endWeights()
Definition: MolChemicalFeatureDef.h:34
RDKit::MolChemicalFeatureDef::CollectionType
std::list< boost::shared_ptr< MolChemicalFeatureDef > > CollectionType
Definition: MolChemicalFeatureDef.h:26
RDKit::ROMol
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:105
Exceptions.h
RDKit::MolChemicalFeatureDef::getSmarts
const std::string & getSmarts() const
Definition: MolChemicalFeatureDef.h:48
RDKit
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
RDKit::MolChemicalFeatureDef::getFamily
const std::string & getFamily() const
Definition: MolChemicalFeatureDef.h:46
RDKit::MolChemicalFeatureDef::endWeights
std::vector< double >::const_iterator endWeights() const
Definition: MolChemicalFeatureDef.h:37
ValueErrorException
Class to allow us to throw a ValueError from C++ and have it make it back to Python.
Definition: Exceptions.h:31
RDKit::MolChemicalFeatureDef
Definition: MolChemicalFeatureDef.h:24
RDKit::MolChemicalFeatureDef::setWeights
void setWeights(const std::vector< double > &weights)
Definition: MolChemicalFeatureDef.h:39