3.4 Adding scores to molecules using SD data

This next example program switches on the Analytic overlap method and also uses a little extra OEChem to attach the overlap scores to each molecule as SD data. This can be used to rescore a set of ROCS hits or to measure the overlap of ROCS alignments against an exlcusion region in the binding site.

 1 /*******************************************************************************
 2  * Copyright 2005,2006,2007,2008 OpenEye Scientific Software, Inc.
 3  ******************************************************************************/
 4 package openeye.examples.oeshape;
 5
 6 import openeye.oechem.*;
 7 import openeye.oeshape.*;
 8
 9 public class Rescore {
10   public static void main(String[] args) {
11     if (args.length!=3) {
12       System.out.println("Rescore <reffile> <rocs_hits> <output.sdf>");
13       System.exit(0);
14     }
15
16     oemolistream reffs = new oemolistream(args[0]);
17     oemolistream fitfs = new oemolistream(args[1]);
18     oemolostream outfs = new oemolostream(args[2]);
19
20     OEGraphMol refmol = new OEGraphMol();
21     oechem.OEReadMolecule(reffs, refmol);
22
23     OEOverlap ov = new OEOverlap();
24     ov.SetMethod(OEOverlapMethod.Analytic);
25     ov.SetRefMol(refmol);
26
27     OEOverlapResults res = new OEOverlapResults();
28     OEGraphMol fitmol = new OEGraphMol();
29     while (oechem.OEReadMolecule(fitfs, fitmol)) {
30       ov.Overlap(fitmol, res);
31       oechem.OESetSDData(fitmol, "AnalyticTanimoto",
32                          String.valueOf(res.getTanimoto()));
33       oechem.OEWriteMolecule(outfs, fitmol);
34     }
35
36   }
37 }

Listing:3.2 Rescoring pre-aligned structures