changeset 3:021f0ef9474f draft

Uploaded
author bgruening
date Wed, 18 Sep 2013 09:44:36 -0400
parents b65518a007fa
children 7c1f9962ac07
files get_pubchem/get_pubchem_as_smiles.py get_pubchem/get_pubchem_as_smiles.xml
diffstat 2 files changed, 33 insertions(+), 20 deletions(-) [+]
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)
 
--- a/get_pubchem/get_pubchem_as_smiles.xml	Sun Sep 08 09:42:57 2013 -0400
+++ b/get_pubchem/get_pubchem_as_smiles.xml	Wed Sep 18 09:44:36 2013 -0400
@@ -1,23 +1,36 @@
 <tool id="ctb_pubchem_download_as_smiles" name="PubChem Download" Version="0.1" >
-  <description>as canonical SMILES</description>
-  <requirements>
-    <requirement type="package" version="2.3.2">openbabel</requirement>
-  </requirements>
-  <command interpreter="python">
+    <description>as canonical SMILES</description>
+    <requirements>
+        <requirement type="package" version="2.3.2">openbabel</requirement>
+    </requirements>
+    <command interpreter="python">
         get_pubchem_as_smiles.py 
             -o $pubchem_smi 
             -p 4
-            2>&#38;1
-  </command>
-  <inputs>
-     <param name="infile" type="select" display="radio" size="250" label="Load all pubchem files and convert them to canonical smiles." />
-  </inputs>
-  <outputs>
-     <data format="smi" name="pubchem_smi" />
-  </outputs>
-  <tests>
-  </tests>
-  <help>
+    </command>
+    <stdio>
+        <regex match="obError" 
+               source="both" 
+               level="fatal" 
+               description="Critical Open Babel error" />
+        <regex match="obWarning"
+               source="both"
+               level="warning"
+               description="Non-critical Open Babel warning" />
+        <regex match="obInfo"
+               source="both"
+               level="log"
+               description="Open Babel Information" />
+    </stdio>
+    <inputs>
+        <param name="infile" type="select" display="radio" size="250" label="Load all pubchem files and convert them to canonical smiles." />
+    </inputs>
+    <outputs>
+        <data format="smi" name="pubchem_smi" />
+    </outputs>
+    <tests>
+    </tests>
+    <help>
 
 .. class:: infomark
 
@@ -35,5 +48,5 @@
 
 The output will be one large SMILES file.
   
-  </help>
+    </help>
 </tool>