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 OEDepictCoordinates 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:

bool PrepareDepiction(OEMolBase& mol, bool clearcoords = false, bool suppressH = true)
{
  OESetDimensionFromCoords(mol);
  OEPerceiveChiral(mol);

  if (mol.GetDimension() != 2u || clearcoords)
  {
    if (mol.GetDimension() == 3u)
    {
      OE3DToBondStereo(mol);
      OE3DToAtomStereo(mol);
    }
    if (suppressH)
      OESuppressHydrogens(mol);
    OEAddDepictionHydrogens(mol);

    OEDepictCoordinates(mol);
    OEMDLPerceiveBondStereo(mol);
  }
  mol.SetDimension(2u);
  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.