OEPrepareDepiction

The overloaded versions of the OEPrepareDepiction function

Link

Description

OEPrepareDepiction(mol, clearccords, suppressH)

prepare depiction

OEPrepareDepiction(mol, opts)

prepare depiction according to options

bool OEPrepareDepiction(OEChem::OEMolBase &mol, bool clearcoords=false,
                        bool suppressH=true)

Prepares a molecule before depiction that involves suppressing or adding explicit hydrogens, perceiving atom and bond stereo information and calculating 2D coordinates.

mol

The molecule being manipulated.

clearcoords

If true, than the 2D coordinates of the molecule are re-calculated. If false and the molecule has 2D coordinates than these coordinates are kept.

If the molecule has no 2D coordinates, then the 2D coordinates are always generated by calling the OEDepictCoordinates function regardless of the value of the clearcoords parameter.

suppressH

If true, than explicit hydrogens are suppressed in the input molecule by calling the OESuppressNonDepictionHydrogens function. See example in Figure: Example of the molecule depictions with kept and suppressed hydrogens.

../../_images/OEPrepareDepictionHydrogenHandling.png

Example of the molecule depictions with kept and suppressed hydrogens

Note

The OEPrepareDepiction function generates canonical 2D coordinates (when the clearcoords parameter is true) i.e. the layout of the same molecules will be identical regardless of their atom and bond orderings.

The following code shows how to generate non-canonical 2D coordinates:

def PrepareDepiction(mol, clearcoords=False, suppressH=True):

    oechem.OESetDimensionFromCoords(mol)
    oechem.OEPerceiveChiral(mol)

    if mol.GetDimension() != 2 or clearcoords:
        if mol.GetDimension() == 3:
            oechem.OE3DToBondStereo(mol)
            oechem.OE3DToAtomStereo(mol)
        if suppressH:
            oechem.OESuppressHydrogens(mol)
        oechem.OEAddDepictionHydrogens(mol)

        oechem.OEDepictCoordinates(mol)
        oechem.OEMDLPerceiveBondStereo(mol)

    mol.SetDimension(2)
    return True

See also

bool OEPrepareDepiction(OEChem::OEMolBase &mol, const OEPrepareDepictionOptions& opts)

Prepares a molecule before depiction.

mol

The molecule being manipulated.

opts

The OEPrepareDepictionOptions object that stores properties that influence how the molecule is prepared.