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 Member Functions | Protected Attributes
ggl::chem::SMILES_grammar Class Reference

SMILES molecule parser. More...

#include <SMILES_grammar.hh>

Inheritance diagram for ggl::chem::SMILES_grammar:
Inheritance graph
[legend]

Data Structures

struct  definition
 The definition of the SMILES grammar. More...
 

Public Member Functions

 SMILES_grammar (Molecule &toFill)
 
 SMILES_grammar (Molecule &toFill, const GroupMap &groups)
 

Static Public Member Functions

static std::pair< Molecule, int > parseSMILES (const std::string &SMILES_string) throw (std::invalid_argument)
 
static std::pair< Molecule, int > parseSMILES (const std::string &SMILES_string, const GroupMap &groups) throw (std::invalid_argument)
 

Protected Member Functions

void addAtom (const std::string &label) const
 
void addBond (const int atom1, const int atom2, const std::string &label) const
 

Protected Attributes

boost::property_map< Molecule,
PropEdgeLabel >::type 
edgeLabel
 Access to the edge label property_map of g2fill to set bond labels. More...
 
Moleculeg2fill
 
const GroupMapgroups
 
boost::property_map< Molecule,
PropNodeLabel >::type 
nodeLabel
 Access to the node label property_map of g2fill to set atom labels. More...
 

Detailed Description

     This class defines the rules of the Daylight's (tm) SMILES
     BNF grammar. It allows for the parsing of a SMILES string to generate
     a molecule graph of the encodes molecule. The graph is represented as
     a boost graph (Molecule) and the atom and bond labels will be
     stored in the property_maps of the given PropNodeLabel and
     PropEdgeLabel.

     BNF grammar of Daylight's SMILES

     smiles         ::= chain (chain | branch)*
     chain          ::= bond? (simple_atom | complex_atom) ringclosure*
     branch         ::= '(' chain (chain | branch)* ')'
     ringclosure    ::= digit | ('%' digit digit)
     simple_atom    ::= simple_symbol
     complex_atom   ::= '[' isotope? (simple_symbol | complex_symbol | group_symbol) chirality? hcount? charge? name? ']'
     isotope        ::= integer
     simple_symbol  ::= 'Br' | 'Cl' | 'B' | 'c' | etc.
     complex_symbol ::= 's' | 'p' | 'o' | 'Zn' | etc.
     group_symbol   ::= '{' anyChar+ '}'
     chirality      ::= '@' '@'?
     hcount         ::= 'H' integer?
     charge         ::= '+' ('+'* | integer)
                      | '-' ('-'* | integer)
     name           ::= ':' integer
     bond           ::= bond_symbol
     bond_symbol    ::= '-' | '=' | '#' | ':' | etc.
     integer        ::= digit+
     digit          ::= [1-9]

     NOTE : chirality, and isotope information is currently ignored !

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

     NOTE : Supported bond labels are defined by MoleculeUtil::getBondData().

     NOTE further : we allow for an extension of the SMILES encoding:
     complex atoms are allowed to hold a group_symbol ID strings
     enclosed in brackets of the form '{SOMEID}'. They are replaced by
     according group subgraphs if found in the provided group map.
     Otherwise the parsing is aborted.
Author
Christoph Flamm (c) 2008 http://www.tbi.univie.ac.at/~xtof/
Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/

Definition at line 99 of file SMILES_grammar.hh.

Constructor & Destructor Documentation

ggl::chem::SMILES_grammar::SMILES_grammar ( Molecule toFill)
explicit

Constructs the definitions of a Daylight's SMILES grammar to parse a SMILES string and to fill the encoded molecule into a given boost graph object.

Parameters
toFillthe boost graph object to add nodes and edges to
ggl::chem::SMILES_grammar::SMILES_grammar ( Molecule toFill,
const GroupMap groups 
)
explicit

Constructs the definitions of a Daylight's SMILES grammar to parse a SMILES string and to fill the encoded molecule into a given boost graph object.

Parameters
toFillthe boost graph object to add nodes and edges to
groupsa container that holds group IDs where each matching node has to be replaced by the according mapped subgraph

Member Function Documentation

void ggl::chem::SMILES_grammar::addAtom ( const std::string &  label) const
protected

Adds an atom to the internal molecule graph to fill

Parameters
labelthe atom label to set
void ggl::chem::SMILES_grammar::addBond ( const int  atom1,
const int  atom2,
const std::string &  label 
) const
protected

Adds a bond to the internal molecule graph to fill

Parameters
atom1the first bond partner
atom2the second bond partner
labelthe bond label to set
static std::pair< Molecule, int > ggl::chem::SMILES_grammar::parseSMILES ( const std::string &  SMILES_string) throw (std::invalid_argument)
static

Parses a SMILES string and generates a graph representation of the molecule

Parameters
SMILES_stringthe string to parse
Returns
pair.first = the graph encoding of the molecule pair.second = -1 if parsing was successful, in error case it returns the string position that caused the parsing error
Exceptions
std::invalid_argumentin case a check fails
static std::pair< Molecule, int > ggl::chem::SMILES_grammar::parseSMILES ( const std::string &  SMILES_string,
const GroupMap groups 
) throw (std::invalid_argument)
static

Parses a SMILES string and generates a graph representation of the molecule

Parameters
SMILES_stringthe string to parse
groupsa container that holds group IDs where each matching node has to be replaced by the according mapped subgraph
Returns
pair.first = the graph encoding of the molecule pair.second = -1 if parsing was successful, in error case it returns the string position that caused the parsing error
Exceptions
std::invalid_argumentin case a check fails

Field Documentation

boost::property_map<Molecule, PropEdgeLabel>::type ggl::chem::SMILES_grammar::edgeLabel
mutableprotected

Definition at line 120 of file SMILES_grammar.hh.

Molecule& ggl::chem::SMILES_grammar::g2fill
protected

The boost graph object that is filled to represent the next parsed SMILES string.

Definition at line 106 of file SMILES_grammar.hh.

const GroupMap* ggl::chem::SMILES_grammar::groups
protected

Container that holds group IDs where each matching node has to be replaced by the according mapped subgraph

Definition at line 110 of file SMILES_grammar.hh.

boost::property_map<Molecule, PropNodeLabel>::type ggl::chem::SMILES_grammar::nodeLabel
mutableprotected

Definition at line 115 of file SMILES_grammar.hh.


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