OECreateSmartsString

Attention

This is a preliminary API and may be improved based on user feedback. It is currently available in C++ and Python.

void OECreateSmartsString(std::string &str, const OEMolBase &mol,
                          const char *smartsTag=nullptr,
                          unsigned int flavor=(OESMILESFlag::DEFAULT & ~OESMILESFlag::Canonical),
                          std::pair<const OEAtomBase*,const OEAtomBase*> *atmord=nullptr);

Generate the SMARTS string from the provided molecule using the flavors from the OESMILESFlag namespace. If the smartsTag argument is null, the data tag applied by OEParseSmarts is assumed to contain the atom and bond annotations from the SMARTS parse, otherwise an explicit generic data tag can be provided for custom SMARTS constraint annotations. Note that custom constraint annotations are not validated, so extra checking for a valid SMARTS query will be required (e.g., by calling OEParseSmarts).

The provided default flavor for the SMARTS generation suppresses reordering which can invalidate the statically captured pattern constraints. Any explicitly provided non-default flavor should also suppress reordering activity for the same reason. While the flavor is provided for user control and experimentation, be aware that only actual atom/bond properties on the molecule are considered for the flavor provided, so any SMARTS qualifiers from the smartsTag generic data are considered to be completely irrelevant during canonicalization. Extra care is also required if any atom (OESMARTSAtomFlag::Chirality) or bond (OESMARTSBondFlag::Chirality) stereo parity is encoded as into the SMARTS string, requiring one or both of OESMILESFlag::AtomStereo for tetrahedral stereo parity SMARTS encodings, or OESMILESFlag::BondStereo for cis/trans SMARTS encodings.