3. Calculating simple overlap

The simplest object in the Shape toolkit, OEOverlap, is used to calculate simple, static, overlap between two objects (molecules or grids). Note that static means that the two input species (ref and fit) are not moved at all. This object simply calculate the overlap given the input positions. Performing calculations that actually optimize the alignment/overlap are done with the OEBestOverlay object (see chapter 5).

This first example reads in a reference molecule and a few fit molecules and prints out the overlap calculated. Note that this example uses all default settings for OEOverlap (discussed in the following sections).

 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 SimpleOverlap {
10   public static void main(String[] args) {
11     oemolistream reffs = new oemolistream("a.mol2");
12     oemolistream fitfs = new oemolistream("rocs_hits_1.sdf");
13
14     OEGraphMol refmol = new OEGraphMol();
15     oechem.OEReadMolecule(reffs, refmol);
16
17     OEOverlap ov = new OEOverlap();
18     ov.SetRefMol(refmol);
19
20     OEOverlapResults res = new OEOverlapResults();
21     OEGraphMol fitmol = new OEGraphMol();
22     while (oechem.OEReadMolecule(fitfs, fitmol)) {
23       System.out.print(fitmol.GetTitle());
24       ov.Overlap(fitmol, res);
25       System.out.println(" exact tanimoto = "+res.getTanimoto());
26     }
27   }
28 }
29

Listing:3.1 Simple overlap using Exact overlap


Subsections