OEAddLabelΒΆ

Adds labels to a molecule display.

The overloaded versions of the OEAddLabel function
Link Description
OEAddLabel(disp, label, match) adding label to atoms of a match
OEAddLabel(disp, label, abset) adding label to set of atoms
OEAddLabel(disp, label, atompred) adding label to atoms specified by a predicate

Parameters :

disp
The OE2DMolDisplay object on which the label is going to be positioned.
label
The OEHighlightLabel object that stores properties that determine the styles of the label along with the text of the label itself.
match
The label is positioned based on the target atoms of the OEMatchBase object.
abset
The label is positioned based on the atoms stored in the OEAtomBondSet object.
atompred
The label is positioned based on the atoms for which the given atom predicate returns true.

Note

It is recommended to use the OEAddLabel along with the OEAddHighlighting.

void OEAddLabel(OE2DMolDisplay &disp,
                const OEHighlightLabel &label,
                const OEChem::OEMatchBase &match)

Adds label to atoms of an OEMatchBase object that can be initialized by substructure search or maximum common substructure search.

Example:

def OEAddLabel_OEMatch(disp):
    subs = OESubSearch("a1aaaaa1")
    unique = True
    highlightstyle = OEHighlightByBallAndStick(OELightGreen)
    for match in subs.Match(disp.GetMolecule(), unique):
        OEAddHighlighting(disp, highlightstyle, match)
        label = OEHighlightLabel("aromatic", OELightGreen)
        OEAddLabel(disp, label, match)
../../_images/OEAddLabel-OEMatch.png

Example of adding label to 6-membered aromatic ring

void OEAddLabel(OE2DMolDisplay &disp,
                const OEHighlightLabel &label,
                const OEChem::OEAtomBondSet &abset)

Adds label to atoms stored in the OEAtomBondSet object.

Example:

def OEAddLabel_OEAtomBondSet(disp):
    mol = disp.GetMolecule()

    ringset = OEAtomBondSet(mol.GetAtoms(OEAtomIsInRing()), mol.GetBonds(OEBondIsInRing()))
    ringhighlight = OEHighlightByBallAndStick(OELightGreen)
    OEAddHighlighting(disp, ringhighlight, ringset)
    ringlabel = OEHighlightLabel("ring", OELightGreen)
    OEAddLabel(disp, ringlabel, ringset)

    chainset = OEAtomBondSet(mol.GetAtoms(OEAtomIsInChain()), mol.GetBonds(OEBondIsInChain()))
    chainhighlight = OEHighlightByBallAndStick(OEBlueTint)
    OEAddHighlighting(disp, chainhighlight, chainset)
    chainlabel = OEHighlightLabel("chain", OEBlueTint)
    OEAddLabel(disp, chainlabel, chainset)
../../_images/OEAddLabel-OEAtomBondSet.png

Example of adding label to ring and chain components of a molecule

void OEAddLabel(OE2DMolDisplay &disp,
                const OEHighlightLabel &label,
                const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &atompred)

Adds label to atoms for which the given atom predicate returns true.

Example:

def OEAddLabel_Predicate(disp):
    ringhighlight = OEHighlightByBallAndStick(OELightGreen)
    OEAddHighlighting(disp, ringhighlight, OEAtomIsInRing(), OEBondIsInRing())
    ringlabel = OEHighlightLabel("ring", OELightGreen)
    OEAddLabel(disp, ringlabel, OEAtomIsInRing())

    chainhighlight = OEHighlightByBallAndStick(OEBlueTint)
    OEAddHighlighting(disp, chainhighlight, OEAtomIsInChain(), OEBondIsInChain())
    chainlabel = OEHighlightLabel("chain", OEBlueTint)
    OEAddLabel(disp, chainlabel, OEAtomIsInChain())
../../_images/OEAddLabel-Predicate.png

Example of adding label to ring and chain components of a molecule