OECreateSmartsString

Attention

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

OECreateSmartsString(OEMolBase mol, str smartsTag=None, int flavor=(OESMILESFlag_DEFAULT & ~OESMILESFlag_Canonical)) -> str

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.