OEAddLigandHighlighting

Highlights atoms and/or bonds of the displayed ligand.

The overloaded versions of the OEAddLigandHighlighting function

Link

Description

OEAddLigandHighlighting(disp, highlight, atompred)

highlights ligand atoms with OEHighlightBase

OEAddLigandHighlighting(adisp, highlight, bondpred)

highlights ligand bonds with OEHighlightBase

OEAddLigandHighlighting(adisp, highlight, atompred, bondpred)

highlights ligand atoms and bonds with OEHighlightBase

OEAddLigandHighlighting(adisp, highlight, match)

highlights ligand atoms and bonds of a match with OEHighlightBase

OEAddLigandHighlighting(adisp, highlight, abset)

highlights ligand atoms and bonds of a set with OEHighlightBase

Parameters :

adisp

The OE2DActiveSiteDisplay object of which ligand atoms add/or ligand bonds being highlighted.

highlight

The OEHighlightBase object that specifies the style of the highlighting.

atompred

OEAddLigandHighlighting function highlights only ligand atoms for which the given atom predicate returns true.

bondpred

OEAddLigandHighlighting function highlights only ligand bonds for which the given bond predicate returns true.

match

OEAddLigandHighlighting function highlights the target atoms and bonds of the OEMatchBase object.

abset

Stores the ligand atoms and bonds being highlighted.

  1. Highlighting using atom and bond predicates:

    void OEAddLigandHighlighting(OE2DActiveSiteDisplay &adisp, const OEDepict::OEHighlightBase &highlight,
                                 const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &atompred)
    

    Highlights ligand atoms with the style implemented in the given OEHighlightBase object. The atoms being highlighted are specified by given atom predicate.

    void OEAddLigandHighlighting(OE2DActiveSiteDisplay &adisp, const OEDepict::OEHighlightBase &highlight,
                                 const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &bondpred)
    

    Highlights ligand bonds with the style implemented in the given OEHighlightBase object. The bonds being highlighted are specified by given bond predicates.

    void OEAddLigandHighlighting(OE2DActiveSiteDisplay &adisp, const OEDepict::OEHighlightBase &highlight,
                                 const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &atompred,
                                 const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &bondpred)
    

    Highlights ligand atoms and bonds with the style implemented in the given OEHighlightBase object. The atoms and bonds being highlighted are specified by given atom and bond predicates, respectively.

    Example: (See image generated in Example of highlighting 6-membered rings of a ligand using ‘ball and stick’ style and Example of highlighting 6-membered rings of a ligand using ‘color’ style )

    private class Pred6MemAromAtom : OEUnaryAtomPred
    {
        public override bool Call(OEAtomBase atom)
        {
            return atom.IsAromatic() && OEChem.OEAtomIsInAromaticRingSize(atom, 6);
        }
    
        public override OEUnaryAtomBoolFunc CreateCopy()
        {
            OEUnaryAtomBoolFunc copy = new Pred6MemAromAtom();
            copy.ReleaseOwnership();
            return copy;
        }
    }
    
    private class Pred6MemAromBond : OEUnaryBondPred
    {
    
        public override bool Call(OEBondBase bond)
        {
            return bond.IsAromatic() && OEChem.OEBondIsInAromaticRingSize(bond, 6);
        }
    
        public override OEUnaryBondBoolFunc CreateCopy()
        {
            OEUnaryBondBoolFunc copy = new Pred6MemAromBond();
            copy.ReleaseOwnership();
            return copy;
        }
    }
    
    private static void OEAddHighlighting_Predicate(OE2DActiveSiteDisplay adisp)
    {
        OEHighlightByBallAndStick highlight = new OEHighlightByBallAndStick(OEChem.OEBlueTint);
    
        OEGrapheme.OEAddLigandHighlighting(adisp, highlight, new Pred6MemAromAtom());
        OEGrapheme.OEAddLigandHighlighting(adisp, highlight, new Pred6MemAromBond());
    }
    
    private static void OEAddHighlighting_AtomAndBondPredicate(OE2DActiveSiteDisplay adisp)
    {
        OEHighlightByColor highlight = new OEHighlightByColor(OEChem.OEDarkGreen);
        OEGrapheme.OEAddLigandHighlighting(adisp, highlight,
                                           new Pred6MemAromAtom(), new Pred6MemAromBond());
    }
    
../../_images/OEAddHighlighting-ActiveSite-Predicate.png

Example of highlighting 6-membered rings of a ligand using ‘ball and stick’ style

../../_images/OEAddHighlighting-ActiveSite-AtomAndBondPredicate.png

Example of highlighting 6-membered rings of a ligand using ‘color’ style

See also

  1. Highlighting using an OEMatchBase object that is initialized by substructure search or maximum common substructure search:

    void OEAddLigandHighlighting(OE2DActiveSiteDisplay &adisp, const OEDepict::OEHighlightBase &highlight,
                                 const OEChem::OEMatchBase &match)
    

    Example: (See image generated in Example of highlighting 6-membered rings of a ligand using ‘lasso’ style)

    private static void OEAddHighlighting_OEMatch(OE2DActiveSiteDisplay adisp)
    {
        OEMolBase ligand = adisp.GetDisplayedLigand();
        OESubSearch subs = new OESubSearch("a1aaaaa1");
        OEColorIter citer = OEChem.OEGetVividColors();
        bool unique = true;
        foreach (OEMatchBase match in subs.Match(ligand, unique))
        {
            if (citer.IsValid())
            {
                OEColor hcolor = citer.Target();
                OEHighlightByLasso highlight = new OEHighlightByLasso(hcolor);
                highlight.SetConsiderAtomLabelBoundingBox(true);
                OEGrapheme.OEAddLigandHighlighting(adisp, highlight, match);
            }
        }
    }
    
../../_images/OEAddHighlighting-ActiveSite-OEMatch.png

Example of highlighting 6-membered rings of a ligand using ‘lasso’ style

  1. Highlighting using an OEAtomBondSet object that stores the atoms and bonds being highlighted:

    void OEAddLigandHighlighting(OE2DActiveSiteDisplay &adisp, const OEDepict::OEHighlightBase &highlight,
                                 const OEChem::OEAtomBondSet &abset)
    

    Example: (See image generated in Example of highlighting 6-membered rings of a ligand using ‘cogwheel’ style)

    private static void OEAddHighlighting_OEAtomBondSet(OE2DActiveSiteDisplay adisp)
    {
        OEMolBase ligand = adisp.GetDisplayedLigand();
        OEAtomBondSet abset = new OEAtomBondSet(ligand.GetAtoms(new Pred6MemAromAtom()),
                                                ligand.GetBonds(new Pred6MemAromBond()));
        OEHighlightByCogwheel highlight = new OEHighlightByCogwheel(OEChem.OEPinkTint);
        highlight.SetInnerContour(false);
        OEGrapheme.OEAddLigandHighlighting(adisp, highlight, abset);
    }
    
../../_images/OEAddHighlighting-ActiveSite-OEAtomBondSet.png

Example of highlighting 6-membered rings of a ligand using ‘cogwheel’ style