Depicting Tripos Atom Types

Problem

You want to depict the Tripos atom types on your molecule. See example in Figure 1.

../_images/DepictTriposAtomType1.png

Figure 1. Example of depicting Tripos atom types

Ingredients

Note

Requires OpenEye toolkits version 2013.Feb or later.

Difficulty Level

../_images/chilly1.png

Solution

The OEDepict TK allows you to display any atom property as a string next to the atomic label on your molecular diagram. First you have to create a class derived from the OEDisplayAtomPropBase abstract base class of which __call__ method returns the type string of an atom.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
class TriposTypeLabel(OEDisplayAtomPropBase):
    def __init__(self):
        OEDisplayAtomPropBase.__init__(self)

    def __call__(self, atom):
        return atom.GetType()

    def CreateCopy(self):
        copy = TriposTypeLabel()
        return copy.__disown__()

Before depicting the molecule, you have to call the OETriposAtomTypeNames function that sets the atom name property of each atom to be the Tripos type (see line 3 in the code below).

Then the TriposTypeLabel class, defined above, can be used to customize the molecule depiction. When a OE2DMolDisplay object is constructed to depict a molecule, it takes an OE2DMolDisplayOptions object that stores all the options that determine how a molecule is depicted. By default, no atom property label is rendered next to the atoms. This default behavior can be overwritten by calling the OE2DMolDisplayOptions.SetAtomPropertyFunctor method (see line 6 in the code below).

When you render the molecule the Tripos atom type label will be depicted next to the atom. See example in Figure 1.

1
2
3
4
5
6
7
8
9
def DepictMoleculeWithTriposAtomTypes(image, mol):

    OETriposAtomTypeNames(mol)

    opts = OE2DMolDisplayOptions(image.GetWidth(), image.GetHeight(), OEScale_AutoScale)
    opts.SetAtomPropertyFunctor(TriposTypeLabel())

    disp = OE2DMolDisplay(mol, opts)
    OERenderMolecule(image, disp)

Discussion

Similarly, you can also display bond property information on your molecule image. You can find examples in the Displaying Bond Properties section of the OEDepict TK manual.

See Also in OEChem Manual

API

See Also in OEDepict Manual

Theory

API