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 |
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().
Definition at line 46 of file SMILESwriter.hh.
|
protected |
Definition at line 55 of file SMILESwriter.hh.
|
protected |
Definition at line 60 of file SMILESwriter.hh.
|
protected |
Definition at line 52 of file SMILESwriter.hh.
|
protected |
Definition at line 58 of file SMILESwriter.hh.
|
protected |
Definition at line 54 of file SMILESwriter.hh.
|
protected |
Definition at line 106 of file SMILESwriter.hh.
|
protected |
Definition at line 59 of file SMILESwriter.hh.
|
protected |
Definition at line 63 of file SMILESwriter.hh.
|
protected |
Definition at line 51 of file SMILESwriter.hh.
ggl::chem::SMILESwriter::SMILESwriter | ( | ) |
|
staticprotected |
|
staticprotected |
|
staticprotected |
Produces a SMILES conform label of the given atom label, ie. enclosing brackets are added if needed.
label | the atom label to check |
|
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.
label | the atom label to check |
nodeData | the atom information for this atom |
ignoreProtons | whether or not protons should be removed from the atom label if possible |
|
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!
m | the molecule graph to parse |
ignoreProtons | if 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 |
allowWildcard | whether 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! |
std::runtime_error | if unsupported atom or bond labels are encountered |
|
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!
m | the molecule graph to parse |
groups | a container that holds group IDs where each matching node represents the according subgraph |
ignoreProtons | if 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 |
allowWildcard | whether 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! |
|
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!
m | the molecule graph to parse |
groups | a container that holds group IDs where each matching node represents the according subgraph; can be NULL if no groups are to be considered |
ignoreProtons | if 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 |
allowWildcard | whether 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! |
|
staticprotected |
|
staticprotected |
Checks whether or not an atom identifier has to be enclosed in brackets within the SMILES notation or not.
atom | the atom label without enclosing brackets |
|
staticprotected |
|
staticprotected |
|
staticprotected |
Definition at line 108 of file SMILESwriter.hh.
|
staticprotected |
Definition at line 201 of file SMILESwriter.hh.
|
staticprotected |
Definition at line 204 of file SMILESwriter.hh.