OEParseSmilesΒΆ

bool OEParseSmiles(OEMolBase &mol, const char *str,
                   bool canon=false, bool strict=false)
bool OEParseSmiles(OEMolBase &mol, const std::string &str,
                   bool canon=false, bool strict=false)

bool OEParseSmiles(OEMolBase &mol, const char *str,
                   const OEParseSmilesOptions &options)
bool OEParseSmiles(OEMolBase &mol, const std::string &str,
                   const OEParseSmilesOptions &options)

Parses a SMILES string into a molecule. The returned value indicates whether the given SMILES string was parsed successfully.

mol
The constructed molecule.
str
The SMILES string that is parsed into the molecule.
canon

Flag that determines whether the post-processing kekulization is performed. Passing a boolean true value to this argument indicates to the parser that the SMILES string should be assumed to be well-formed and the usual kekulization (by calling OEKekulize) step may be omitted.

This can be used to speed-up parsing of a large database, but has the side-effect that bond orders are not correctly assigned for aromatic molecules.

strict
Flag that controls whether the parser should operate in strict mode. By default, the SMILES parser attempts to process any reasonably formed SMILES string. If the ‘strict’ argument is true, the parser applies more rigorous sanity checking. For example, the SMILES C==C is accepted by the default non-strict parser, but rejected by the strict parser.
options
The OEParseSmilesOptions object that stores properties that influence how a SMILES string is parsed into a molecule.

The input molecule instance is not cleared so these functions can be used to add components to an existing molecule. If the SMILES string represents a reaction, any previously-existing atoms and bonds not already in a reaction component become reactants in the resulting molecule object.

Hint

The use of the high-level OESmilesToMol function is highly recommended over the low-level OEParseSmiles function. The OESmilesToMol function not only converts a SMILES string into a molecule but also perceives basic molecular properties.

See also