Semantic interpreter of the smiles grammar. More...
#include <SmilesMoleculeBuilder.h>
Public Member Functions | |
std::vector< Molecule > | interpret (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< BondData > | lastBondData |
State for last stored bond data. | |
PrivateGraph | graph |
Possibly disconnected tracking graph. | |
std::stack< PrivateGraph::Vertex > | vertexStack |
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::Edge > | piSubgraphEdges |
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< AtomData > | vertexData |
AtomData for each created vertex. | |
Semantic interpreter of the smiles grammar.
Constructs possibly disconnected graph during parsing, then constructs molecules from accrued data and inference where necessary.
|
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.
std::runtime_error | If the bond types are mismatched |
|
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.