diff get_pubchem/get_pubchem_as_smiles.py @ 3:021f0ef9474f draft

Uploaded
author bgruening
date Wed, 18 Sep 2013 09:44:36 -0400
parents b65518a007fa
children 7c1f9962ac07
line wrap: on
line diff
--- a/get_pubchem/get_pubchem_as_smiles.py	Sun Sep 08 09:42:57 2013 -0400
+++ b/get_pubchem/get_pubchem_as_smiles.py	Wed Sep 18 09:44:36 2013 -0400
@@ -29,7 +29,7 @@
     result.get()
 
     for filename in os.listdir(td):
-        path = os.path.join(td, filename)
+        path = os.path.join(td, filename)  + '.smi'
         shutil.copyfileobj(open(path, 'rb'), output_handle)
 
     output_handle.close()
@@ -38,9 +38,9 @@
 def fetch_convert(args):
     (filename, td) = args
 
-    tmp_name = os.path.join( tempfile.gettempdir(), filename)
+    tmp_name = os.path.join( td, filename)
     subprocess.call( ['wget', '-O', tmp_name, os.path.join('ftp://ftp.ncbi.nih.gov/pubchem/Compound/CURRENT-Full/SDF/', filename)] )
-    output = os.path.join(td, filename)
+    output = os.path.join(td, filename) + '.smi'
     subprocess.call(["obabel", "-isdf", tmp_name, "-ocan", '-O', output])
     os.remove(tmp_name)