OEAddHighlighting¶
Highlights atoms and/or bonds of the displayed molecule.
Link |
Description |
---|---|
highlights atoms with OEHighlightBase |
|
highlights bonds with OEHighlightBase |
|
highlights atoms and bonds with OEHighlightBase |
|
highlights atoms and bonds of a match with OEHighlightBase |
|
highlights atoms and bonds of a set with OEHighlightBase |
|
highlights atoms and bonds of substructure matches OEHighlightBase |
Link |
Description |
---|---|
highlights atoms with color and style |
|
highlights bonds with color and style |
|
highlights atoms and bonds with color and style |
|
highlights atoms and bonds of a match with color and style |
|
highlights atoms and bonds of a set with color and style |
|
highlights atoms and bonds of substructure matches |
Parameters :
- disp
The OE2DMolDisplay object of which atoms add/or bonds being highlighted.
- highlight
The OEHighlightBase object that specifies the style of the highlighting.
- color
The OEColor object that specifies the color of the highlighting.
- style
The style of the highlighting from the
OEHighlightStyle
namespace.- atompred
OEAddHighlighting
function highlights only atoms for which the given atom predicate returns true.- bondpred
OEAddHighlighting
function highlights only bonds for which the given bond predicate returns true.- match
OEAddHighlighting
function highlights the target atoms and bonds of the OEMatchBase object.- abset
Stores the atoms and bonds being highlighted.
- subsearch
The substructure search object of the matches being highlighted.
Highlights atom and/or bonds with the style implemented in the given OEHighlightBase object
The atoms and bonds being highlighted can be specified either by a predicate or an OEMatchBase object or an OEAtomBondSet object.
The following code snippets show different ways to highlight any 6 membered aromatic ring in a molecule using the OEHighlightByBallAndStick highlighting class. They all generate the image shown in Figure: Example of highlighting 6-membered aromatic rings.
Highlighting using atom and bond predicates:
void OEAddHighlighting(OE2DMolDisplay &disp, const OEHighlightBase &highlight, const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &atompred)
Highlights atoms with the style implemented in the given OEHighlightBase object. The atoms being highlighted are specified by given atom predicate.
void OEAddHighlighting(OE2DMolDisplay &disp, const OEHighlightBase &highlight, const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &bondpred)
Highlights bonds with the style implemented in the given OEHighlightBase object. The bonds being highlighted are specified by given bond predicates.
void OEAddHighlighting(OE2DMolDisplay& disp, const OEHighlightBase& highlight, const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &atompred, const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &bondpred)
Highlights 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 aromatic rings)
class Pred6MemAromAtom : public OEUnaryPredicate<OEAtomBase> { public: bool operator()(const OEAtomBase &atom) const { return atom.IsAromatic() && OEAtomIsInAromaticRingSize(atom, 6); } OEUnaryFunction<OEAtomBase,bool> *CreateCopy() const { return new Pred6MemAromAtom; } }; class Pred6MemAromBond : public OEUnaryPredicate<OEBondBase> { public: bool operator()(const OEBondBase &bond) const { return bond.IsAromatic() && OEBondIsInAromaticRingSize(bond, 6); } OEUnaryFunction<OEBondBase,bool> *CreateCopy() const { return new Pred6MemAromBond; } }; void OEAddHighlighting_Predicate(OE2DMolDisplay& disp) { OEHighlightByBallAndStick highlightstyle(OELightGreen); OEAddHighlighting(disp, highlightstyle, Pred6MemAromAtom()); OEAddHighlighting(disp, highlightstyle, Pred6MemAromBond()); } void OEAddHighlighting_AtomAndBondPredicate(OE2DMolDisplay& disp) { OEHighlightByBallAndStick highlightstyle(OELightGreen); OEAddHighlighting(disp, highlightstyle, Pred6MemAromAtom(), Pred6MemAromBond()); }
Highlighting using an OEMatchBase object that is initialized by substructure search or maximum common substructure search:
void OEAddHighlighting(OE2DMolDisplay &disp, const OEHighlightBase &highlight, const OEChem::OEMatchBase &match)
Example: (See image generated in Example of highlighting 6-membered aromatic rings)
void OEAddHighlighting_OEMatch(OE2DMolDisplay& disp) { const OEMolBase* mol = disp.GetMolecule(); OESubSearch ss("a1aaaaa1"); const bool unique = true; OEHighlightByBallAndStick highlightstyle(OELightGreen); for (OEIter<const OEMatchBase> mi = ss.Match(*mol, unique); mi; ++mi) OEAddHighlighting(disp, highlightstyle, mi); }
Highlighting using an OEAtomBondSet object that stores the atoms and bonds being highlighted:
void OEAddHighlighting(OE2DMolDisplay &disp, const OEHighlightBase &highlight, const OEChem::OEAtomBondSet &abset)
Example: (See image generated in Example of highlighting 6-membered aromatic rings)
void OEAddHighlighting_OEAtomBondSet(OE2DMolDisplay& disp) { const OEMolBase* mol = disp.GetMolecule(); const OEAtomBondSet abset(mol->GetAtoms(Pred6MemAromAtom()), mol->GetBonds(Pred6MemAromBond())); OEHighlightByBallAndStick highlightstyle(OELightGreen); OEAddHighlighting(disp, highlightstyle, abset); }
Highlighting using an OESubSearch of which matches are being highlighted:
void OEAddHighlighting(OE2DMolDisplay &disp, const OEHighlightBase &highlight, const OEChem::OESubSearch &subsearch)
Example: (See image generated in Example of highlighting 6-membered aromatic rings)
void OEAddHighlighting_OESubSearch(OE2DMolDisplay& disp) { OESubSearch subsearch("a1aaaaa1"); OEHighlightByBallAndStick highlightstyle(OELightGreen); OEAddHighlighting(disp, highlightstyle, subsearch); }
See also
OEHighlightByColor class
OEHighlightByCogwheel class
OEHighlightByStick class
OEHighlightByLasso class
OEDrawHighlighting
functionHighlighting chapter
Highlights atoms and/or bonds with the given color and style
The atoms and bonds being highlighted can be specified either by a predicate or an OEMatchBase object or an OEAtomBondSet object.
The following code snippets show three different ways to highlight any 6 membered aromatic ring in a molecule using the built-in highlighting styles. They all generate the image shown in Figure: Example of highlighting 6-membered aromatic rings.
Highlighting using atom and bond predicates:
void OEAddHighlighting(OE2DMolDisplay &disp, const OESystem::OEColor &color, unsigned int style, const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &atompred)
Highlights atoms with the given color and style. The atoms being highlighted are specified by given atom predicate.
void OEAddHighlighting(OE2DMolDisplay &disp, const OESystem::OEColor &color, unsigned int style, const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &bondpred)
Highlights bonds with the given color and style. The bonds being highlighted are specified by given bonds predicate.
void OEAddHighlighting(OE2DMolDisplay& disp, const OESystem::OEColor& color, unsigned int style, const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &atompred, const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &bondpred)
Highlights atoms and bonds with the given color and style. 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 aromatic rings)
class Pred6MemAromAtom : public OEUnaryPredicate<OEAtomBase> { public: bool operator()(const OEAtomBase &atom) const { return atom.IsAromatic() && OEAtomIsInAromaticRingSize(atom, 6u); } OEUnaryFunction<OEAtomBase,bool> *CreateCopy() const { return new Pred6MemAromAtom; } }; class Pred6MemAromBond : public OEUnaryPredicate<OEBondBase> { public: bool operator()(const OEBondBase &bond) const { return bond.IsAromatic() && OEBondIsInAromaticRingSize(bond, 6u); } OEUnaryFunction<OEBondBase,bool> *CreateCopy() const { return new Pred6MemAromBond; } }; void OEAddHighlighting_Predicate(OE2DMolDisplay& disp) { OEAddHighlighting(disp, OEDarkGreen, OEHighlightStyle::Color, Pred6MemAromAtom()); OEAddHighlighting(disp, OEDarkGreen, OEHighlightStyle::Color, Pred6MemAromBond()); } void OEAddHighlighting_AtomAndBondPredicate(OE2DMolDisplay& disp) { OEAddHighlighting(disp, OEDarkGreen, OEHighlightStyle::Color, Pred6MemAromAtom(), Pred6MemAromBond()); }
Highlighting using an OEMatchBase object that is initialized by substructure search or maximum common substructure search:
void OEAddHighlighting(OE2DMolDisplay &disp, const OESystem::OEColor &color, unsigned int style, const OEChem::OEMatchBase &match)
Example: (See image generated in Example of highlighting 6-membered aromatic rings)
void OEAddHighlighting_OEMatch(OE2DMolDisplay& disp) { OESubSearch subs("a1aaaaa1"); const bool unique = true; for (OEIter<const OEMatchBase> mi = subs.Match(*disp.GetMolecule(), unique); mi; ++mi) OEAddHighlighting(disp, OEDarkGreen, OEHighlightStyle::Color, *mi); }
Highlighting using an OEAtomBondSet object that stores the atoms and bonds being highlighted:
void OEAddHighlighting(OE2DMolDisplay &disp, const OESystem::OEColor &color, unsigned int style, const OEChem::OEAtomBondSet &abset)
Example: (See image generated in Example of highlighting 6-membered aromatic rings)
void OEAddHighlighting_OEAtomBondSet(OE2DMolDisplay& disp) { const OEMolBase* mol = disp.GetMolecule(); const OEAtomBondSet abset(mol->GetAtoms(Pred6MemAromAtom()), mol->GetBonds(Pred6MemAromBond())); OEAddHighlighting(disp, OEDarkGreen, OEHighlightStyle::Color, abset); }
Highlighting using an OESubSearch of which matches are being highlighted:
void OEAddHighlighting(OE2DMolDisplay &disp, const OESystem::OEColor& color, unsigned int style, const OEChem::OESubSearch &subsearch);Example: (See image generated in Example of highlighting 6-membered aromatic rings)
void OEAddHighlighting_OESubSearch(OE2DMolDisplay& disp) { OESubSearch subsearch("a1aaaaa1"); OEAddHighlighting(disp, OEDarkGreen, OEHighlightStyle::Color, subsearch); }
See also
OEColor class
OEHighlightStyle
namespaceHighlighting chapter