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 #!/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 if len(sys.argv)!=4:
 8     OEThrow.Usage("rescore.py <reffile> <rocs_hits_file> <output.sdf>")
 9
10 reffs = oemolistream(sys.argv[1])
11 fitfs = oemolistream(sys.argv[2])
12 outfs = oemolostream(sys.argv[3])
13
14 refmol=OEGraphMol()
15 OEReadMolecule(reffs, refmol)
16
17 ov=OEOverlap()
18 ov.SetMethod(OEOverlapMethod_Analytic)
19 ov.SetRefMol(refmol)
20
21 res = OEOverlapResults()
22 fitmol = OEGraphMol()
23 while OEReadMolecule(fitfs, fitmol):
24     ov.Overlap(fitmol, res)
25     OESetSDData(fitmol, "AnalyticTanimoto", "%.2f"%res.tanimoto)
26     OEWriteMolecule(outfs, fitmol)

Listing:3.2 Rescoring pre-aligned structures