5. depict.cpp Source Code

#include "openeye.h"
#include "oechem.h"
#include "oedepict.h"

using namespace OEChem;

int main(int argc,char *argv[])
{
  if (argc != 3) OEThrow.Usage("depict <infile> <outfile>");
  OESystem::oemolistream ifs(argv[1]);
  if(!ifs) OEThrow.Fatal("Unable to open %s for reading",argv[1]);
  OESystem::oemolostream ofs(argv[2]);
  if(!ofs) OEThrow.Fatal("Unable to open %s for writing",argv[2]);

  OEGraphMol mol;
  while (ifs >> mol) {
    if (mol.GetDimension() == 3) {
      OEPerceiveChiral(mol);
      OE3DToBondStereo(mol);
      OE3DToAtomStereo(mol);
    }
    OEAddDepictionHydrogens(mol);
    OEDepictCoordinates(mol);
    OEMDLPerceiveBondStereo(mol);
    ofs << mol;
  }
  return 0;
}