Package rdkit :: Package Chem :: Module AvailDescriptors
[hide private]
[frames] | no frames]

Source Code for Module rdkit.Chem.AvailDescriptors

 1  ## Automatically adapted for numpy.oldnumeric Jun 27, 2008 by -c 
 2   
 3  # $Id: AvailDescriptors.py 1572 2010-12-11 07:42:47Z glandrum $ 
 4  # 
 5  # Copyright (C) 2001-2006 greg Landrum and Rational Discovery LLC 
 6  # 
 7  #   @@ All Rights Reserved @@ 
 8  #  This file is part of the RDKit. 
 9  #  The contents are covered by the terms of the BSD license 
10  #  which is included in the file license.txt, found at the root 
11  #  of the RDKit source tree. 
12  # 
13  """ DEPRECATED 
14  constructs the list of available descriptors 
15   
16  """ 
17  from rdkit.RDLogger import logger 
18  logger().warning("The AvailDescriptors module is deprecated. Please switch to using the Descriptors module.") 
19   
20  from rdkit.Chem import GraphDescriptors,MolSurf,Lipinski,Fragments,Crippen,Descriptors 
21  from rdkit.Chem.EState import EState_VSA 
22  mods = [GraphDescriptors,MolSurf,EState_VSA,Lipinski,Descriptors,Crippen,Fragments] 
23   
24  from rdkit import Chem 
25  otherMods = [Chem] 
26   
27  others = [] 
28  for mod in otherMods: 
29    tmp = dir(mod) 
30    for name in tmp: 
31      if name[0] != '_': 
32        thing = getattr(mod,name) 
33        if hasattr(thing,'__call__'): 
34          others.append(name) 
35   
36  descList = [] 
37  descDict = {} 
38  for mod in mods: 
39    tmp = dir(mod) 
40   
41    for name in tmp: 
42      if name[0] != '_' and name[-1] != '_' and name not in others: 
43        # filter out python reference implementations: 
44        if name[:2]=='py' and name[2:] in tmp: 
45          continue 
46        thing = getattr(mod,name) 
47        if hasattr(thing,'__call__'): 
48          descList.append((name,thing)) 
49          descDict[name] = thing 
50   
51 -def Desensitize():
52 """ puts in all upper and all lower case versions of each 53 descriptor name 54 """ 55 ks = descDict.keys() 56 for k in ks: 57 fn = descDict[k] 58 descDict[k.upper()]=fn 59 descDict[k.lower()]=fn
60 61 62 if __name__ == '__main__': 63 m = Chem.MolFromSmiles('CCOC') 64 for name,fn in descList: 65 print name,fn(m) 66