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 #!/usr/bin/env python
2 # Copyright (C) 2005,2006 OpenEye Scientific Software, Inc.
3 import os, sys
4 from openeye.oechem import *
5 from openeye.oeshape import *
6
7 reffs = oemolistream("a.mol2")
8 fitfs = oemolistream("rocs_hits_1.sdf")
9
10 refmol=OEGraphMol()
11 OEReadMolecule(reffs, refmol)
12
13 ov=OEOverlap()
14 ov.SetRefMol(refmol)
15
16 res = OEOverlapResults()
17 fitmol = OEGraphMol()
18 while OEReadMolecule(fitfs, fitmol):
19 print fitmol.GetTitle(),
20 ov.Overlap(fitmol, res)
21 print " exact tanimoto = %.2f"%res.tanimoto
22