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

Molecule to SMILES writer. More...

#include <SMILESwriter.hh>

Data Structures

class  NodeData
 

Public Member Functions

 SMILESwriter ()
 

Static Public Member Functions

static std::string getSMILES (const Molecule &m, const bool ignoreProtons=true, const bool allowWildcard=false)
 
static std::string getSMILES (const Molecule &m, const GroupMap &groups, const bool ignoreProtons, const bool allowWildcard=false)
 

Protected Types

typedef boost::graph_traits
< Molecule >
::adjacency_iterator 
MA_Iterator_t
 
typedef boost::property_map
< Molecule, PropEdgeLabel >
::const_type 
ME_Property_Map_t
 
typedef boost::graph_traits
< Molecule >::edge_descriptor 
MEdge_t
 
typedef boost::property_map
< Molecule, PropNodeIndex >
::const_type 
MV_Index_Map_t
 
typedef boost::graph_traits
< Molecule >::vertex_iterator 
MV_Iterator_t
 
typedef std::map< MVertex_t,
NodeData
MV_NodeData_Map
 
typedef boost::property_map
< Molecule, PropNodeLabel >
::const_type 
MV_Property_Map_t
 
typedef std::map< MVertex_t, bool > MV_Visited_Map_t
 utility map type for DFS traversal of the Molecule graph More...
 
typedef boost::graph_traits
< Molecule >
::vertex_descriptor 
MVertex_t
 

Static Protected Member Functions

static std::string build_dfs (MVertex_t v, MVertex_t p, const Molecule *graph, std::vector< int > *ranks, MV_Visited_Map_t &visit, const MV_NodeData_Map &nodeData, const MV_Index_Map_t &idx, const MV_Property_Map_t &vname, const ME_Property_Map_t &ename, const bool ignoreProtons)
 
static std::vector< int > canonize (const Molecule *graph, const MV_Visited_Map_t &visit, const MV_Index_Map_t &idx, const MV_Property_Map_t &vname, const ME_Property_Map_t &ename, MV_NodeData_Map &nodeData, const GroupMap *const groups, const bool allowWildcard)
 
static std::string getLabel (const std::string &label)
 
static std::string getLabel (const std::string &label, const NodeData &nodeData, const bool ignoreProtons)
 
static std::string getSMILES (const Molecule &m, const GroupMap *const groups, const bool ignoreProtons, const bool allowWildcard)
 
static std::set< std::string > initOrganicSubset ()
 
static bool isWithBracketsInSMILES (const std::string &atom)
 
static int prime (int number)
 
static std::string second_pass (std::string smiles)
 

Static Protected Attributes

static std::set< std::string > organic_subset
 
static const int primes []
 
static const int primesLength
 

Detailed Description

    Utility class to generate a canonical SMILES string from a molecule
    graph representation. It expects atom (node) and edge (bond) label
    following the Daylight's SMILES description. See 
    ggl::chem::SMILES_grammar for further details.

    It implements the algorithm suggested by Weininger (1989)

    @article{ Weininger_1989,
     title={SMILES. 2. Algorithm for generation of unique SMILES notation},
     author={Weininger, D and Weininger, A and Weininger, J L},
     journal={Journal of Chemical Information and Modeling},
     volume={29},
     number={2},
     pages={97--101},
     year={1989},
     publisher={American Chemical Society},
     url={http://dx.doi.org/10.1021/ci00062a008}
    }

    NOTE : THIS WRITER IS INCOMPLETE, I.E. NOT ALL TYPES OF MOLECULE ATOMS
    AND BONDS ARE HANDLED BY THIS WRITER !!!

    Supported atom labels are defined by MoleculeUtil::getAtomData().

    Supported bond labels are defined by MoleculeUtil::getBondData().
Author
Alexander Ullrich (c) 2008
Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/

Definition at line 46 of file SMILESwriter.hh.

Member Typedef Documentation

typedef boost::graph_traits<Molecule>::adjacency_iterator ggl::chem::SMILESwriter::MA_Iterator_t
protected

Definition at line 55 of file SMILESwriter.hh.

typedef boost::property_map<Molecule, PropEdgeLabel>::const_type ggl::chem::SMILESwriter::ME_Property_Map_t
protected

Definition at line 60 of file SMILESwriter.hh.

typedef boost::graph_traits<Molecule>::edge_descriptor ggl::chem::SMILESwriter::MEdge_t
protected

Definition at line 52 of file SMILESwriter.hh.

typedef boost::property_map<Molecule, PropNodeIndex>::const_type ggl::chem::SMILESwriter::MV_Index_Map_t
protected

Definition at line 58 of file SMILESwriter.hh.

typedef boost::graph_traits<Molecule>::vertex_iterator ggl::chem::SMILESwriter::MV_Iterator_t
protected

Definition at line 54 of file SMILESwriter.hh.

Definition at line 106 of file SMILESwriter.hh.

typedef boost::property_map<Molecule, PropNodeLabel>::const_type ggl::chem::SMILESwriter::MV_Property_Map_t
protected

Definition at line 59 of file SMILESwriter.hh.

typedef std::map<MVertex_t, bool> ggl::chem::SMILESwriter::MV_Visited_Map_t
protected

Definition at line 63 of file SMILESwriter.hh.

typedef boost::graph_traits<Molecule>::vertex_descriptor ggl::chem::SMILESwriter::MVertex_t
protected

Definition at line 51 of file SMILESwriter.hh.

Constructor & Destructor Documentation

ggl::chem::SMILESwriter::SMILESwriter ( )

Member Function Documentation

static std::string ggl::chem::SMILESwriter::build_dfs ( MVertex_t  v,
MVertex_t  p,
const Molecule graph,
std::vector< int > *  ranks,
MV_Visited_Map_t visit,
const MV_NodeData_Map nodeData,
const MV_Index_Map_t idx,
const MV_Property_Map_t vname,
const ME_Property_Map_t ename,
const bool  ignoreProtons 
)
staticprotected
static std::vector<int> ggl::chem::SMILESwriter::canonize ( const Molecule graph,
const MV_Visited_Map_t visit,
const MV_Index_Map_t idx,
const MV_Property_Map_t vname,
const ME_Property_Map_t ename,
MV_NodeData_Map nodeData,
const GroupMap *const  groups,
const bool  allowWildcard 
)
staticprotected
static std::string ggl::chem::SMILESwriter::getLabel ( const std::string &  label)
staticprotected

Produces a SMILES conform label of the given atom label, ie. enclosing brackets are added if needed.

Parameters
labelthe atom label to check
Returns
the SMILES conform atom label
static std::string ggl::chem::SMILESwriter::getLabel ( const std::string &  label,
const NodeData nodeData,
const bool  ignoreProtons 
)
staticprotected

Produces a SMILES conform label of the given atom label, ie. enclosing brackets are added if needed. Furthermore, protons can be removed from the SMILES if their number can be deduced from atom and bond valence.

Parameters
labelthe atom label to check
nodeDatathe atom information for this atom
ignoreProtonswhether or not protons should be removed from the atom label if possible
Returns
the SMILES conform atom label
static std::string ggl::chem::SMILESwriter::getSMILES ( const Molecule m,
const bool  ignoreProtons = true,
const bool  allowWildcard = false 
)
static

Generates a canonical SMILES string of the given graph representation of a molecule.

NOTE: THE FUNCTIONALITY IS INCOMPLETE, i.e. not all atom and bond types are possible! See class description!

Parameters
mthe molecule graph to parse
ignoreProtonsif true and m is no HH molecule, all protons that can be inferred from atom and bond valence are ignored when producing the SMILES string; otherwise protons are compressed into the adjacent non-proton atom label
allowWildcardwhether or not the wildcard is a valid atom label within SMILES. NOTE: this will result in non-standard SMILES since the wildcard label is a non-standard extension within the GGL!
Returns
a canonical SMILES string representing the given molecule
Exceptions
std::runtime_errorif unsupported atom or bond labels are encountered
static std::string ggl::chem::SMILESwriter::getSMILES ( const Molecule m,
const GroupMap groups,
const bool  ignoreProtons,
const bool  allowWildcard = false 
)
static

Generates a canonical SMILES string of the given graph representation of a molecule.

Before this is done, all known groups are compressed into their according group labels using MoleculeUtil::compressGroups(..).

NOTE: THE FUNCTIONALITY IS INCOMPLETE, i.e. not all atom and bond types are possible! See class description!

Parameters
mthe molecule graph to parse
groupsa container that holds group IDs where each matching node represents the according subgraph
ignoreProtonsif true and m is no HH molecule, all protons that can be inferred from atom and bond valence are ignored when producing the SMILES string; otherwise protons are compressed into the adjacent non-proton atom label
allowWildcardwhether or not the wildcard is a valid atom label within SMILES. NOTE: this will result in non-standard SMILES since the wildcard label is a non-standard extension within the GGL!
Returns
a canonical SMILES string representing the given molecule
static std::string ggl::chem::SMILESwriter::getSMILES ( const Molecule m,
const GroupMap *const  groups,
const bool  ignoreProtons,
const bool  allowWildcard 
)
staticprotected

Generates a canonical SMILES string of the given graph representation of a molecule.

NOTE: THE FUNCTIONALITY IS INCOMPLETE, i.e. not all atom and bond types are possible! See class description!

Parameters
mthe molecule graph to parse
groupsa container that holds group IDs where each matching node represents the according subgraph; can be NULL if no groups are to be considered
ignoreProtonsif true and m is no HH molecule, all protons that can be inferred from atom and bond valence are ignored when producing the SMILES string; otherwise protons are compressed into the adjacent non-proton atom label
allowWildcardwhether or not the wildcard is a valid atom label within SMILES. NOTE: this will result in non-standard SMILES since the wildcard label is a non-standard extension within the GGL!
Returns
a canonical SMILES string representing the given molecule
static std::set<std::string> ggl::chem::SMILESwriter::initOrganicSubset ( )
staticprotected
static bool ggl::chem::SMILESwriter::isWithBracketsInSMILES ( const std::string &  atom)
staticprotected

Checks whether or not an atom identifier has to be enclosed in brackets within the SMILES notation or not.

Parameters
atomthe atom label without enclosing brackets
Returns
true, if the atom label has to be enclosed with brackets; false otherwise.
static int ggl::chem::SMILESwriter::prime ( int  number)
staticprotected
static std::string ggl::chem::SMILESwriter::second_pass ( std::string  smiles)
staticprotected

Field Documentation

std::set<std::string> ggl::chem::SMILESwriter::organic_subset
staticprotected

Definition at line 108 of file SMILESwriter.hh.

const int ggl::chem::SMILESwriter::primes[]
staticprotected

Definition at line 201 of file SMILESwriter.hh.

const int ggl::chem::SMILESwriter::primesLength
staticprotected

Definition at line 204 of file SMILESwriter.hh.


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