MDL Reaction DepictionΒΆ

OEDepict TK also supports MDL reaction depiction. The reaction being depicted has to be imported by calling the OEReadMDLReactionQueryFile function. The rest of the process is identical to depicting a molecule. First the OEPrepareDepiction function has to be called to generate the 2D atom coordinates, then the image can be created by rendering the imported reaction (OERenderMolecule) (See examples in Figure: Example of MDL reaction depiction)

Listing 1: Example of reaction depiction

package openeye.docexamples.oedepict;

import openeye.oechem.*;
import openeye.oedepict.*;

public class DepictMDLReaction {
    public static void main(String argv[]){
        if (argv.length != 2) {
            oechem.OEThrow.Usage("DepictMDLReaction <mdlreaction> <imagefile>");
        }
        oemolistream ifs = new oemolistream(argv[0]);
        OEGraphMol qmol = new OEGraphMol();
        oechem.OEReadMDLReactionQueryFile(ifs, qmol);
        ifs.close();
        oedepict.OEPrepareDepiction(qmol);
        oedepict.OERenderMolecule(argv[1], qmol);
    }
}
../_images/DepictMDLReaction.png

Example of MDL reaction depiction

See also

The atom map information read from the reaction file can be depicted as atom properties by using the OEDisplayAtomMapIdx class. (See examples in Figure: Example of MDL reaction depiction with atom mapping)

Listing 2: Example of reaction depiction with map indices

package openeye.docexamples.oedepict;

import openeye.oechem.*;
import openeye.oedepict.*;

public class DepictMDLReactionMapIdx {
    public static void main(String argv[]) {
        if (argv.length != 2) {
            oechem.OEThrow.Usage("DepictMDLReactionMapIdx <mdlreaction> <imagefile>");
        }

        String ifile = new String(argv[0]);
        String ofile = new String(argv[1]);

        oemolistream ifs = new oemolistream(ifile);
        OEGraphMol qmol = new OEGraphMol();
        oechem.OEReadMDLReactionQueryFile(ifs, qmol);
        ifs.close();
        oedepict.OEPrepareDepiction(qmol);

        OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions();
        opts.SetAtomPropertyFunctor(new OEDisplayAtomMapIdx());
        OE2DMolDisplay dist = new OE2DMolDisplay(qmol, opts);

        oedepict.OERenderMolecule(ofile, dist);
    }
}
../_images/DepictMDLReactionWithMapIdx.png

Example of MDL reaction depiction with atom mapping