Package Chem :: Package EState :: Module EState_VSA
[hide private]
[frames] | no frames]

Source Code for Module Chem.EState.EState_VSA

  1  # $Id: EState_VSA.py 2 2006-05-06 22:54:39Z glandrum $ 
  2  # 
  3  # Copyright (C)2003-2006 greg Landrum and Rational Discovery LLC 
  4  # 
  5  #   @@ All Rights Reserved  @@ 
  6  # 
  7  """ Hybrid EState-VSA descriptors (like the MOE VSA descriptors) 
  8   
  9  """ 
 10  import Numeric 
 11  from Chem.EState.EState import EStateIndices as EStateIndices_ 
 12  from Chem.MolSurf import _LabuteHelper as VSAContribs_ 
 13  import bisect 
 14   
 15  """ 
 16   
 17  These default VSA bins were chosen using the PP3K solubility data 
 18  set.  An arbitrary number of bins were selected and the 
 19  boundaries were selected to give an approximately equal number of 
 20  atoms per bin 
 21   
 22  """ 
 23  vsaBins=[4.78,5.00,5.410,5.740,6.00,6.07,6.45,7.00,11.0] 
24 -def VSA_EState_(mol,bins=None,force=1):
25 """ *Internal Use Only* 26 """ 27 if not force and hasattr(mol,'_vsaEState'): 28 return mol._vsaEState 29 30 if bins is None: bins = estateBins 31 propContribs = EStateIndices_(mol,force=force) 32 volContribs = VSAContribs_(mol) 33 34 ans = Numeric.zeros(len(bins)+1,Numeric.Float) 35 for i,prop in enumerate(propContribs): 36 if prop is not None: 37 bin = bisect.bisect_right(bins,volContribs[i+1]) 38 ans[bin] += prop 39 mol._vsaEState=ans 40 return ans
41 42 for i in range(len(vsaBins)): 43 fn = lambda x,y=i:VSA_EState_(x,force=0)[y] 44 if i > 0: 45 fn.__doc__="VSA EState Descriptor %d (% 4.2f <= x < % 4.2f)"%(i+1,vsaBins[i-1],vsaBins[i]) 46 else: 47 fn.__doc__="VSA EState Descriptor %d (-inf < x < % 4.2f)"%(i+1,vsaBins[i]) 48 name="VSA_EState%d"%(i+1) 49 fn.version="1.0.0" 50 exec('%s=fn'%(name)) 51 i+=1 52 fn = lambda x,y=i:VSA_EState_(x,force=0)[y] 53 fn.__doc__="VSA EState Descriptor %d (% 4.2f <= x < inf)"%(i+1,vsaBins[i-1]) 54 name="VSA_EState%d"%(i+1) 55 fn.version="1.0.0" 56 exec('%s=fn'%(name)) 57 fn=None 58 59 60 """ 61 62 These default EState bins were chosen using the PP3K solubility data 63 set. An arbitrary number of bins (10) were selected and the 64 boundaries were selected to give an approximately equal number of 65 atoms per bin 66 67 """ 68 estateBins=[-0.390,0.290,0.717,1.165,1.540,1.807,2.05,4.69,9.17,15.0]
69 -def EState_VSA_(mol,bins=None,force=1):
70 """ *Internal Use Only* 71 """ 72 if not force and hasattr(mol,'_eStateVSA'): 73 return mol._eStateVSA 74 75 if bins is None: bins = estateBins 76 propContribs = EStateIndices_(mol,force=force) 77 volContribs = VSAContribs_(mol) 78 79 ans = Numeric.zeros(len(bins)+1,Numeric.Float) 80 for i,prop in enumerate(propContribs): 81 if prop is not None: 82 bin = bisect.bisect_right(bins,prop) 83 ans[bin] += volContribs[i+1] 84 mol._eStateVSA=ans 85 return ans
86 87 for i in range(len(estateBins)): 88 fn = lambda x,y=i:EState_VSA_(x,force=0)[y] 89 if i > 0: 90 fn.__doc__="EState VSA Descriptor %d (% 4.2f <= x < % 4.2f)"%(i+1,estateBins[i-1],estateBins[i]) 91 else: 92 fn.__doc__="EState VSA Descriptor %d (-inf < x < % 4.2f)"%(i+1,estateBins[i]) 93 name="EState_VSA%d"%(i+1) 94 fn.version="1.0.1" 95 exec('%s=fn'%(name)) 96 i+=1 97 fn = lambda x,y=i:EState_VSA_(x,force=0)[y] 98 fn.__doc__="EState VSA Descriptor %d (% 4.2f <= x < inf)"%(i+1,estateBins[i-1]) 99 name="EState_VSA%d"%(i+1) 100 fn.version="1.0.1" 101 exec('%s=fn'%(name)) 102 fn=None 103 # Change log for EState_VSA descriptors: 104 # version 1.0.1: optimizations, values unaffected 105