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

#include <openeye.h>

#include <oesystem.h>
#include <oechem.h>
#include <oedepict.h>

using namespace OESystem;
using namespace OEChem;
using namespace OEDepict;

int main(int argc,  char* argv[])
{
  if (argc != 3)
    OEThrow.Usage("%s <mdlreaction> <imagefile>", argv[0]);

  oemolistream ifs(argv[1]);
  OEGraphMol qmol;
  OEReadMDLReactionQueryFile(ifs, qmol);
  OEPrepareDepiction(qmol);
  OERenderMolecule(argv[2], qmol);
  return 0;
}
../_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

#include <openeye.h>

#include <oesystem.h>
#include <oechem.h>
#include <oedepict.h>

using namespace std;
using namespace OESystem;
using namespace OEChem;
using namespace OEDepict;

int main(int argc,  char* argv[])
{
  if (argc != 3)
    OEThrow.Usage("%s <mdlreaction> <imagefile>", argv[0]);

  string ifile(argv[1]);
  string ofile(argv[2]);

  oemolistream ifs(ifile);
  OEGraphMol qmol;
  OEReadMDLReactionQueryFile(ifs, qmol);
  OEPrepareDepiction(qmol);

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

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

Example of MDL reaction depiction with atom mapping