Generated on Wed Apr 29 2015 11:51:41 for GGL-4.1.2 by doxygen 1.8.3.1
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | Static Protected Attributes
ggl::chem::MoleculeUtil Class Reference

Molecule utility factory. More...

#include <MoleculeUtil.hh>

Data Structures

class  AtomLabelData
 
class  BondLabelData
 

Public Types

typedef std::map< std::string,
std::string > 
AromaticSwapMap
 
typedef std::map< std::string,
AtomLabelData
AtomDataMap
 
typedef std::map< std::string,
BondLabelData
BondDataMap
 
typedef unsigned char OneByte
 typedef to represent one byte of information More...
 

Public Member Functions

 MoleculeUtil ()
 Default construction. More...
 
virtual ~MoleculeUtil ()
 Default destruction. More...
 

Static Public Member Functions

static void compressGroups (ggl::chem::Molecule &mol, const GroupMap &groups)
 
static void compressHnodes (Molecule &mol)
 
static std::string convertCML (const Molecule &mol)
 
static std::ostream & convertCML (const Molecule &mol, std::ostream &stream)
 
static void copy (const Molecule &mol, Molecule &toFill)
 
static void copy (const sgm::Graph_Interface &mol, Molecule &toFill)
 
static bool decodeConsistencyStatus (const size_t consistencyCode, std::ostream &errorStream)
 
static void fillProtons (Molecule &mol)
 
static const std::string *const getAromaticPendant (const std::string &label)
 
static std::string getAtom (const std::string &label)
 
static const AtomDataMapgetAtomData (void)
 
static const AtomLabelData *const getAtomData (const std::string &label)
 
static const BondDataMapgetBondData (void)
 
static const BondLabelData *const getBondData (const std::string &label)
 
static int getCharge (const std::string &label)
 
static int getClass (const std::string &label)
 
static std::string getComplexAtomLabel (const std::string &atom, const size_t protons=0, const int charge=0, const int classID=0, const bool explicitChargeValue=false)
 
static std::string getGroupLabel (const std::string &nodeLabel)
 
static size_t getProtons (const std::string &label)
 
static size_t getProtonsToAdd (const std::string &atomLabel, const int atomCharge, const size_t bondValenceSum, const size_t bondNum, const size_t bondNumAromatic, const size_t bondNumProton)
 
static void insertGroups (ggl::chem::Molecule &mol, const GroupMap &groups) throw (std::runtime_error)
 
static size_t isConsistent (const Molecule &mol)
 
static bool isGroupLabel (const std::string &nodeLabel)
 
static bool isValidAtomLabel (const std::string &atomLabel)
 
static bool isValidBondLabel (const std::string &bondLabel)
 
static void removeProtons (Molecule &mol)
 

Static Public Attributes

static const std::string AtomLabelWildcard
 
static const size_t C_AtomComplexWithH
 
static const size_t C_AtomLabelInvalid
 
static const size_t C_AtomLabelWildcard
 
static const size_t C_AtomValence
 
static const size_t C_BondLabelInvalid
 
static const size_t C_BondLoop
 
static const size_t C_Consistent
 consistency code : everything fine More...
 
static const size_t C_NonConnected
 

Static Protected Member Functions

static bool checkAtomComplexWithH (const Molecule &mol)
 
static bool checkAtomLabel (const Molecule &mol)
 
static bool checkAtomLabelWildcard (const Molecule &mol)
 
static bool checkAtomValence (const Molecule &mol)
 
static bool checkBondLabel (const Molecule &mol)
 
static bool checkBondLoop (const Molecule &mol)
 
static bool checkNonConnected (const Molecule &mol)
 

Static Protected Attributes

static AromaticSwapMap aromaticSwapMap
 maps aromatic labels onto their non-aromatic form and vice versa More...
 
static AtomDataMap atomData
 the stored atom label to data mapping More...
 
static BondDataMap bondData
 the stored bond label to data mapping More...
 
static const std::string DIGIT
 holds all digits for string parsing More...
 
static const std::string WHITESPACE
 holds all white space characters for string parsing More...
 

Detailed Description

    Utility class that contains certain data and members needed for
    Molecule evaluation and handling. 
Author
Martin Mann (c) 2009 http://www.bioinf.uni-freiburg.de/~mmann/

Definition at line 54 of file MoleculeUtil.hh.

Member Typedef Documentation

typedef std::map< std::string, std::string > ggl::chem::MoleculeUtil::AromaticSwapMap

Mapping of aromatic labels to their non-aromatic form and vice versa, to enable a relabeling of aromatic rings.

Definition at line 164 of file MoleculeUtil.hh.

typedef std::map< std::string, AtomLabelData > ggl::chem::MoleculeUtil::AtomDataMap

Mapping of atom labels (in SMILES notation but without brackets) to the corresponding atom information like valence etc.

Definition at line 159 of file MoleculeUtil.hh.

typedef std::map< std::string, BondLabelData > ggl::chem::MoleculeUtil::BondDataMap

Mapping of bond labels (in SMILES notation) to the corresponding bond information like valence etc.

Definition at line 191 of file MoleculeUtil.hh.

typedef unsigned char ggl::chem::MoleculeUtil::OneByte

Definition at line 59 of file MoleculeUtil.hh.

Constructor & Destructor Documentation

ggl::chem::MoleculeUtil::MoleculeUtil ( )
virtual ggl::chem::MoleculeUtil::~MoleculeUtil ( )
virtual

Member Function Documentation

static bool ggl::chem::MoleculeUtil::checkAtomComplexWithH ( const Molecule mol)
staticprotected

Checks if any complex node label contains implicit H atoms. This is currently not supported by the library

Parameters
molthe molecule to check
Returns
true iff no atom label equals AtomLabelWildcard; false otherwise
static bool ggl::chem::MoleculeUtil::checkAtomLabel ( const Molecule mol)
staticprotected

Checks if all node label of the given molecule are supported by the current SMILESwriter.

Parameters
molthe molecule to check
Returns
true iff all node label are ok, false otherwise
static bool ggl::chem::MoleculeUtil::checkAtomLabelWildcard ( const Molecule mol)
staticprotected

Checks if any node label is equal to AtomLabelWildcard. Since this is currently not supported the check returns false if any occurence is found.

Parameters
molthe molecule to check
Returns
true iff no atom label equals AtomLabelWildcard; false otherwise
static bool ggl::chem::MoleculeUtil::checkAtomValence ( const Molecule mol)
staticprotected

Checks if any atom shows an inconsistent electron distribution, ie. [valence+charge != bondValenceSum+aromAdd] where aromAdd == 1 if the atom is part of an aromatic ring and 0 otherwise.

Parameters
molthe molecule to check
Returns
true iff no atom shows inconsistent electron distribution false otherwise
static bool ggl::chem::MoleculeUtil::checkBondLabel ( const Molecule mol)
staticprotected

Checks if all bond label of the given molecule are supported by the current SMILESwriter.

Parameters
molthe molecule to check
Returns
true iff all bond labels are ok; false otherwise
static bool ggl::chem::MoleculeUtil::checkBondLoop ( const Molecule mol)
staticprotected

Checks if an atom forms a bond with itself, i.e. a ring bond.

Parameters
molthe molecule to check
Returns
true iff all bond labels are ok; false otherwise
static bool ggl::chem::MoleculeUtil::checkNonConnected ( const Molecule mol)
staticprotected

Checks if the molecule shows more than one connected component.

Parameters
molthe molecule to check
Returns
true iff only the molecule is connected; false otherwise
static void ggl::chem::MoleculeUtil::compressGroups ( ggl::chem::Molecule mol,
const GroupMap groups 
)
static

Iteratively identifies groups within the molecule and replaces them by the according group label. The replacement is done in decreasing group size, ie. first the largest groups are compressed.

Parameters
molthe molecule to alter
groupsthe list of known groups to be introduced if found
static void ggl::chem::MoleculeUtil::compressHnodes ( Molecule mol)
static

Compresses all explicitly represented "H" atoms into the adjacent atom label.

Note: only protons with atom node label "H" are compressed. Nodes e.g. including class information like "H:1" are maintained and not removed.

Parameters
molthe molecule graph to compress
static std::string ggl::chem::MoleculeUtil::convertCML ( const Molecule mol)
static

Converts a given molecule in Chemical Markup Language (CML) format.

See http://cml.sourceforge.net/ for further details on the format.

Parameters
molthe molecule to represent
Returns
the CML string representation of the molecule
static std::ostream& ggl::chem::MoleculeUtil::convertCML ( const Molecule mol,
std::ostream &  stream 
)
static

Converts a given molecule in Chemical Markup Language (CML) format.

See http://cml.sourceforge.net/ for further details on the format.

Parameters
molthe molecule to represent
streamthe out stream to add the CML representation to
Returns
the altered stream filled with the CML string representation of the molecule
static void ggl::chem::MoleculeUtil::copy ( const Molecule mol,
Molecule toFill 
)
static

Copies a given molecule into another molecule object which is overwritten.

Parameters
molthe molecule graph to copy
toFillthe molecule graph to make a copy of mol
static void ggl::chem::MoleculeUtil::copy ( const sgm::Graph_Interface mol,
Molecule toFill 
)
static

Copies a given molecule into another molecule object which is overwritten.

Note, no sanity checks of node/edge labels, degrees, etc. are done!

Parameters
molthe molecule graph to copy
toFillthe molecule graph to make a copy of mol
static bool ggl::chem::MoleculeUtil::decodeConsistencyStatus ( const size_t  consistencyCode,
std::ostream &  errorStream 
)
static

Writes a description of the consistency status or errors, encoded in a consistency code produced by isConsistent*(...), to a given outstream. The function returns whether or not an error occured.

Parameters
consistencyCodethe error code to parse, produced by a call to isConsistent*(...)
errorStreamthe output stream to write the error description to
Returns
true if no error is encoded; false otherwise
static void ggl::chem::MoleculeUtil::fillProtons ( Molecule mol)
static

Adds explicit "H" atoms according to the valence of atom nodes and protons within complex atom labels.

TODO: NOTE, this implementation is still experimental and is not necessarily correct!

Parameters
molthe molecule graph to fill
static const std::string* const ggl::chem::MoleculeUtil::getAromaticPendant ( const std::string &  label)
static

Access to the aromatic/non-aromatic pendant of an atom or edge label if it exists.

Parameters
labelthe label of interest
Returns
a pointer to the pendant label or NULL if none exists
static std::string ggl::chem::MoleculeUtil::getAtom ( const std::string &  label)
static

Access to atom name within a given atom label.

Parameters
labelthe atom label to derive the information from
Returns
the name of the atom
static const AtomDataMap& ggl::chem::MoleculeUtil::getAtomData ( void  )
static

Access to the currently supported atom labels and the corresponding atom information, e.g. valence etc.

Returns
the atom2data mapping
static const AtomLabelData* const ggl::chem::MoleculeUtil::getAtomData ( const std::string &  label)
static

Access to atom information for the given atom label, if existing.

Parameters
labelthe atom label to derive the information from
Returns
the atom2data entry or NULL if none available
static const BondDataMap& ggl::chem::MoleculeUtil::getBondData ( void  )
static

Access to the currently supported bond labels and the corresponding bond information, e.g. valence etc.

Returns
the bond2data mapping
static const BondLabelData* const ggl::chem::MoleculeUtil::getBondData ( const std::string &  label)
static

Access to bond information for the given bond label, if existing.

Parameters
labelthe bond label to derive the information from
Returns
the bond2data entry or NULL if none available
static int ggl::chem::MoleculeUtil::getCharge ( const std::string &  label)
static

Access to the charge within a given atom label, if existing.

Parameters
labelthe atom label to derive the information from
Returns
the charge information in the label
static int ggl::chem::MoleculeUtil::getClass ( const std::string &  label)
static

Access to the class information within a given atom label, if existing.

Parameters
labelthe atom label to derive the information from
Returns
the class information in the label, or 0 if not present
static std::string ggl::chem::MoleculeUtil::getComplexAtomLabel ( const std::string &  atom,
const size_t  protons = 0,
const int  charge = 0,
const int  classID = 0,
const bool  explicitChargeValue = false 
)
static

Produces a complex atom label with the given information.

Parameters
atomthe atom label
protonsthe number of protons attached to the atom; a value of 0 is ignored
chargethe charge of the atom; a value of 0 is ignored
classIDthe classID; a value of 0 is ignored
explicitChargeValueif true, a charge value of 1 is represented by "+1" rather than just "+"
Returns
the according complex atom label
static std::string ggl::chem::MoleculeUtil::getGroupLabel ( const std::string &  nodeLabel)
static

Extracts the group identifier from the (complex) node label.

Parameters
nodeLabelthe node label that contains a group label
Returns
the group label or an empty string if no group label is present
static size_t ggl::chem::MoleculeUtil::getProtons ( const std::string &  label)
static

Access to number of protons within a given atom label, if existing.

Parameters
labelthe atom label to derive the information from
Returns
the number of additional protons in the label
static size_t ggl::chem::MoleculeUtil::getProtonsToAdd ( const std::string &  atomLabel,
const int  atomCharge,
const size_t  bondValenceSum,
const size_t  bondNum,
const size_t  bondNumAromatic,
const size_t  bondNumProton 
)
static

Computes the number of missing hydrogens to be added to this atom.

static void ggl::chem::MoleculeUtil::insertGroups ( ggl::chem::Molecule mol,
const GroupMap groups 
) throw (std::runtime_error)
static

Replaces all nodes with group labels with the according molecule component if present in groups. If the group label is unknown, an exception is raised.

NOTE: The node replacement is NOT recursive to avoid infinite replacement chains.

Parameters
molthe molecule to alter
groupsthe list of known groups

std::runtime_error in case a group label is unknown

static size_t ggl::chem::MoleculeUtil::isConsistent ( const Molecule mol)
static

Checks if a given ggl::chem::Molecule graph is consistent. If not, according error codes are returned.

Parameters
molthe molecule graph to check
Returns
if consistent C_Consistent is returned. Otherwise a product of the according C_* values.
static bool ggl::chem::MoleculeUtil::isGroupLabel ( const std::string &  nodeLabel)
static

Checks whether or not a given atom node label is a group label.

Parameters
nodeLabelthe node label of interest
Returns
true if the given node label is a group label; false otherwise
static bool ggl::chem::MoleculeUtil::isValidAtomLabel ( const std::string &  atomLabel)
static

Checks if the given atom (node) label is SMILES conform and currently supported, e.g. by the SMILESwriter class.

Parameters
atomLabelthe label to check
Returns
true if the atom label is ok, false otherwise
static bool ggl::chem::MoleculeUtil::isValidBondLabel ( const std::string &  bondLabel)
static

Checks if the given bond (edge) label is SMILES conform and currently supported, e.g. by the SMILESwriter class.

Parameters
bondLabelthe label to check
Returns
true if the bond label is ok, false otherwise
static void ggl::chem::MoleculeUtil::removeProtons ( Molecule mol)
static

Removes all represented "H" atoms that can be inferred from atom valence, charge and adjacent bond information. All other proton information that cannot be inferred is collapsed into accoring complex atom labels.

Thus, in the end, the molecule won't show adjacent protons if any.

Single protons or HH molecules are preserved as that.

Parameters
molthe molecule graph to be stripped

Field Documentation

AromaticSwapMap ggl::chem::MoleculeUtil::aromaticSwapMap
staticprotected

Definition at line 569 of file MoleculeUtil.hh.

AtomDataMap ggl::chem::MoleculeUtil::atomData
staticprotected

Definition at line 566 of file MoleculeUtil.hh.

const std::string ggl::chem::MoleculeUtil::AtomLabelWildcard
static

the wildcard character for atom labels valid in molecule descriptions

Definition at line 63 of file MoleculeUtil.hh.

BondDataMap ggl::chem::MoleculeUtil::bondData
staticprotected

Definition at line 572 of file MoleculeUtil.hh.

const size_t ggl::chem::MoleculeUtil::C_AtomComplexWithH
static

consistency code : at least one atom label is complex and contains implicit H atoms, this is currently not supported

Definition at line 209 of file MoleculeUtil.hh.

const size_t ggl::chem::MoleculeUtil::C_AtomLabelInvalid
static

consistency code : at least one atom label is not SMILES conform or currently not supported within the library

Definition at line 200 of file MoleculeUtil.hh.

const size_t ggl::chem::MoleculeUtil::C_AtomLabelWildcard
static

consistency code : at least one atom label is a wildcard which is currently not supported within the library

Definition at line 206 of file MoleculeUtil.hh.

const size_t ggl::chem::MoleculeUtil::C_AtomValence
static

consistency code : at least one atom shows an inconsistent electron distribution, ie. valence+charge != protonCount

Definition at line 212 of file MoleculeUtil.hh.

const size_t ggl::chem::MoleculeUtil::C_BondLabelInvalid
static

consistency code : at least one bond label is not SMILES conform or currently not supported within the library

Definition at line 203 of file MoleculeUtil.hh.

const size_t ggl::chem::MoleculeUtil::C_BondLoop
static

consistency code : at least one bond connects the same atom, i.e. forms a loop

Definition at line 215 of file MoleculeUtil.hh.

const size_t ggl::chem::MoleculeUtil::C_Consistent
static

Definition at line 197 of file MoleculeUtil.hh.

const size_t ggl::chem::MoleculeUtil::C_NonConnected
static

consistency code : the molecule graph is not connected, i.e. contains at least two connected components

Definition at line 218 of file MoleculeUtil.hh.

const std::string ggl::chem::MoleculeUtil::DIGIT
staticprotected

Definition at line 561 of file MoleculeUtil.hh.

const std::string ggl::chem::MoleculeUtil::WHITESPACE
staticprotected

Definition at line 563 of file MoleculeUtil.hh.


The documentation for this class was generated from the following file: