diff rdkit_descriptors.py @ 1:45b822b9d522

Uploaded
author bgruening
date Sat, 27 Apr 2013 13:15:27 -0400
parents 764340994e71
children
line wrap: on
line diff
--- a/rdkit_descriptors.py	Sat Apr 27 09:01:41 2013 -0400
+++ b/rdkit_descriptors.py	Sat Apr 27 13:15:27 2013 -0400
@@ -7,6 +7,10 @@
 import inspect
 
 def get_supplier( infile, format = 'smiles' ):
+    """
+    Returns a generator over a SMILES or InChI file. Every element is of RDKit 
+    molecule and has its original string as _Name property.
+    """
     with open(infile) as handle:
         for line in handle:
             line = line.strip()
@@ -22,6 +26,9 @@
 
 
 def get_rdkit_descriptor_functions():
+    """
+    Returns all descriptor functions under the Chem.Descriptors Module as tuple of (name, function)
+    """
     ret = [ (name, f) for name, f in inspect.getmembers( Descriptors ) if inspect.isfunction( f ) and not name.startswith( '_' ) ]
     ret.sort()
     return ret
@@ -31,7 +38,6 @@
     """
     Calculates the descriptors of a given molecule.
     """
-
     for name, function in functions:
         yield (name, function( mol ))
 
@@ -66,6 +72,6 @@
         if not mol:
             continue
         descs = descriptors( mol, functions )
-        name = mol.GetProp("_Name")
-        args.outfile.write( "%s\n" % '\t'.join( [name]+ [str(res) for name, res in descs] ) )
+        molecule_id = mol.GetProp("_Name")
+        args.outfile.write( "%s\n" % '\t'.join( [molecule_id]+ [str(res) for name, res in descs] ) )