Skip to content

Instantly share code, notes, and snippets.

@aschreyer
Created June 1, 2011 16:05
Show Gist options
  • Select an option

  • Save aschreyer/1002638 to your computer and use it in GitHub Desktop.

Select an option

Save aschreyer/1002638 to your computer and use it in GitHub Desktop.
Implementing the Chemical Identifier Resolver
from credo.credoscript import *
from credo.contrib.chemidresolver import *
ca = ChemCompAdaptor()
rsvr = ChemIdResolver()
# GET THE SDF FILE OF LAPATINIB WITH 3D COORDINATES
molstring = rsvr.get_structure('lapatinib','sdf', get3d=True)
# GET THE USR MOMENTS FOR THE STRUCTURE
statement = "SELECT oeb_to_usr(openeye.string_to_mol('%s'))" % molstring
moments = engine.execute(statement).scalar()
# FETCH ALL CHEMICAL COMPONENTS SIMILAR TO
hits = ca.fetch_all_by_usr_moments(moments,
limit=10, threshold=0.0, cat=True,
ow=1,hw=0.2,rw=0.2,aw=0.2,dw=0.2)
print hits
[<ChemComp('FMM')>,
<ChemComp('B91')>,
<ChemComp('GGV')>,
<ChemComp('L64')>,
<ChemComp('705')>,
<ChemComp('A83')>,
<ChemComp('146')>,
<ChemComp('PHP')>,
<ChemComp('N2A')>,
<ChemComp('P39')>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment