Guest User

rdkit_fp_screening_sample

a guest
Dec 8th, 2011
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.51 KB | None | 0 0
  1.     logger.info('generating pattern fps:')
  2.     #pattFps = [Chem.LayeredFingerprint(x,Chem.LayeredFingerprint_substructLayers) for x in patts]
  3.     pattFps = [Chem.LayeredFingerprint2(x) for x in patts]
  4.  
  5.     logger.info('generating molecules fps:')
  6.     #molFps = [Chem.LayeredFingerprint(x,Chem.LayeredFingerprint_substructLayers) for x in mols]
  7.     molFps = [Chem.LayeredFingerprint2(x) for x in mols]
  8.  
  9.     pattMisses=[0]*len(pattFps)
  10.     pattHits=[0]*len(pattFps)
  11.  
  12.     logger.info('scanning')
  13.     t1 = time.time()
  14.     nPossible=nMatched=nSearched=0
  15.     t1=time.time()
  16.     for j in range(len(mols)):
  17.         mfp = molFps[j]
  18.         for k in range(len(pattFps)):
  19.             pfp = pattFps[k]
  20.             nPossible+=1
  21.             if DataStructs.AllProbeBitsMatch(pfp,mfp):
  22.                 fpMatch=True
  23.                 nSearched+=1
  24.             else:
  25.                 fpMatch=False
  26.             if mols[j].HasSubstructMatch(patts[k]):
  27.                 nMatched+=1
  28.                 if not fpMatch:
  29.                     print 'mismatch:',j,k
  30.                     print '  ',Chem.MolToSmiles(mols[j])
  31.                     print '  ',Chem.MolToSmiles(patts[k])
  32.         if not (j+1)%500:
  33.             logger.info('  done %d (%d total, %d searched, %d found)'%(j+1,nPossible,nSearched,nMatched))
  34.     t2 = time.time()
  35.     logger.info('FINISHED %d (%d total, %d searched, %d found) in %.2f'%(j+1,nPossible,nSearched,nMatched,t2-t1))
  36.     logger.info('  screenout: %.2f, accuracy: %.2f'%(1.*nSearched/nPossible, 1.*nMatched/nSearched))
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment