Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::IO::MoleculeBuilder Class Reference

Semantic interpreter of the smiles grammar. More...

#include <SmilesMoleculeBuilder.h>

Public Member Functions

std::vector< Moleculeinterpret (const std::string &smiles)
 Interpret the collected graph as (possibly multiple molecules)
 
Parsing triggers
void addAtom (AtomData atom)
 Parsing trigger on encountering a ring closure marker.
 
void addRingClosure (const BondData &bond)
 Parsing trigger on encountering a ring closure marker.
 
void branchOpen ()
 Parsing trigger on branch open.
 
void branchClose ()
 Parsing trigger on branch close.
 
void setNextAtomUnbonded ()
 Parsing trigger on finding a dot (molecule separator) in place of a bond.
 
void setNextAtomBondInformation (const BondData &bond)
 Parsing trigger on encountering non-default bond information.
 

Private Member Functions

Private member functions
std::unordered_set
< PrivateGraph::Vertex
matchAromatics (std::vector< PrivateGraph > &precursors, const std::vector< unsigned > &componentMap, const std::vector< PrivateGraph::Vertex > &indexInComponentMap) const
 Determine valence-incremented atoms by aromatics in each component.
 
void setShapes (std::vector< Molecule > &molecules, const std::vector< unsigned > &componentMap, const std::vector< PrivateGraph::Vertex > &indexInComponentMap)
 Set shapes according to specified charges and stereo markers.
 
void setAtomStereo (std::vector< Molecule > &molecules, const std::vector< unsigned > &componentMap, const std::vector< PrivateGraph::Vertex > &indexInComponentMap, const std::string &smiles)
 Set atom stereo post-parse and conversion to molecules.
 
void setBondStereo (std::vector< Molecule > &molecules, const std::vector< unsigned > &componentMap, const std::vector< PrivateGraph::Vertex > &indexInComponentMap, const std::string &smiles)
 Set bond stereo post-parse and conversion to molecules.
 
void addAromaticBondStereo (std::vector< Molecule > &molecules, const std::vector< unsigned > &componentMap, const std::vector< PrivateGraph::Vertex > &indexInComponentMap)
 Add bond stereopermutators in aromatic cycles.
 

Static Private Member Functions

Static private members
static BondType mutualBondType (const boost::optional< BondType > &a, const boost::optional< BondType > &b)
 
static std::vector
< Shapes::Vertex
shapeMap (const ChiralData &chiralData)
 

Private member data

using StereoMarkedBondTuple = std::tuple< PrivateGraph::Vertex, PrivateGraph::Vertex, SmilesBondType >
 Storage for bonds marked with stereo indicators ("/" and "\")
 
boost::optional< BondDatalastBondData
 State for last stored bond data.
 
PrivateGraph graph
 Possibly disconnected tracking graph.
 
std::stack< PrivateGraph::VertexvertexStack
 State to track the vertex a new vertex is bound to.
 
std::vector
< StereoMarkedBondTuple
stereoMarkedBonds
 Storage for bonds marked with stereo indicators ("/" and "\")
 
std::vector< PrivateGraph::EdgepiSubgraphEdges
 Storage for pi-subgraph edges.
 
std::unordered_map< unsigned,
std::pair
< PrivateGraph::Vertex,
boost::optional< BondType > > > 
ringClosures
 Storage for ring closure bond indicators.
 
std::vector< AtomDatavertexData
 AtomData for each created vertex.
 

Detailed Description

Semantic interpreter of the smiles grammar.

Constructs possibly disconnected graph during parsing, then constructs molecules from accrued data and inference where necessary.

Member Function Documentation

static BondType Scine::Molassembler::IO::MoleculeBuilder::mutualBondType ( const boost::optional< BondType > &  a,
const boost::optional< BondType > &  b 
)
staticprivate

Determines the mutual bond type of two bond type optionals

For simplification of ring closure double-checking, where the ring-closure bond type may or may not be specified at either or both markers.

Exceptions
std::runtime_errorIf the bond types are mismatched
static std::vector<Shapes::Vertex> Scine::Molassembler::IO::MoleculeBuilder::shapeMap ( const ChiralData chiralData)
staticprivate

Fetches a map to help with the atom chiral markers

Maps the order in which substituents were specified in the SMILES onto shape vertices. Note that there is rotational freedom to these.


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