Molassembler  1.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, constructs molecules from the data accrued by the parser. More...

#include <SmilesMoleculeBuilder.h>

Public Member Functions

std::vector< Moleculeinterpret ()
 Interpret the collected graph as (possibly multiple molecules)
 
Parsing triggers
void addAtom (const 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
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)
 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)
 Set bond stereo post-parse and conversion to molecules.
 

Static Private Member Functions

Static private members
static bool isValenceFillElement (Utils::ElementType e)
 Checks whether an element type is valence filled.
 
static unsigned valenceFillElementImplicitHydrogenCount (int valence, Utils::ElementType e)
 Determines the implicit hydrogen count of a valence fill element.
 
static BondType mutualBondType (const boost::optional< BondType > &a, const boost::optional< BondType > &b)
 
static std::vector
< Shapes::Vertex
shapeMap (const ChiralData &chiralData)
 Fetches a map to help with the atom chiral markers.
 

Private member data

enum  SimpleLastBondData { Unbonded, Unspecified }
 Storage for bonds marked with stereo indicators ("/" and "\")
 
using StereoMarkedBondTuple = std::tuple< PrivateGraph::Vertex, PrivateGraph::Vertex, BondData::StereoMarker >
 Storage for bonds marked with stereo indicators ("/" and "\")
 
boost::variant
< SimpleLastBondData, BondData
lastBondData = SimpleLastBondData::Unbonded
 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::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 molecules from the data accrued by the parser.

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

Exceptions
std::runtime_errorIf the bond types are mismatched

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