Repository 'get_sbml_model'
hg clone https://toolshed.g2.bx.psu.edu/repos/tduigou/get_sbml_model

Changeset 4:1482291aaa5c (2023-05-22)
Previous changeset 3:f59e65c1606a (2023-04-29) Next changeset 5:80c32f0cb716 (2023-05-30)
Commit message:
planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 4a0b08beb8cdf51ab295a1f5f8c586d6bbaf5586
modified:
get_infos.py
get_sbml_model.xml
b
diff -r f59e65c1606a -r 1482291aaa5c get_infos.py
--- a/get_infos.py Sat Apr 29 16:44:33 2023 +0000
+++ b/get_infos.py Mon May 22 14:57:40 2023 +0000
[
@@ -62,22 +62,26 @@
             try:
                 hostname = r.json()["organism"]
             except KeyError:
-                print(f"*** Error: unable to retrieve host name for id {params.hostid}")
-                return -1
-        # TAXON ID
-        server = 'https://rest.ensembl.org'
-        ext = f'/taxonomy/id/{hostname}?'
-        r = r_get(server+ext, headers={ "Content-Type" : "application/json"})
-        if not r.ok:
-            print(f"Warning: unable to retrieve taxonomy ID for host organism {hostname}")
+                print(f"Warning: unable to retrieve host name for id {params.hostid}")
+                hostname = ''
+        if not hostname:
+            taxid = ''
         else:
-            try:
-                taxid = r.json()["parent"]["id"]
-            except KeyError:
+            # TAXON ID
+            server = 'https://rest.ensembl.org'
+            ext = f'/taxonomy/id/{hostname}?'
+            r = r_get(server+ext, headers={ "Content-Type" : "application/json"})
+            if not r.ok:
                 print(f"Warning: unable to retrieve taxonomy ID for host organism {hostname}")
-            with open(params.taxid, 'w') as f:
-                f.write('#ID\n')
-                f.write(f'{taxid}\n')
+            else:
+                try:
+                    taxid = r.json()["id"]
+                except KeyError:
+                    print(f"Warning: unable to retrieve taxonomy ID for host organism {hostname}")
+                    taxid = ''
+        with open(params.taxid, 'w') as f:
+            f.write('#ID\n')
+            f.write(f'{taxid}\n')
 
 
 if __name__ == "__main__":
b
diff -r f59e65c1606a -r 1482291aaa5c get_sbml_model.xml
--- a/get_sbml_model.xml Sat Apr 29 16:44:33 2023 +0000
+++ b/get_sbml_model.xml Mon May 22 14:57:40 2023 +0000
[
@@ -4,12 +4,17 @@
         <requirement type="package" version="7.81.0">curl</requirement>
         <requirement type="package" version="1.11">gzip</requirement>
         <requirement type="package" version="5.19.2">python-libsbml</requirement>
-        <requirement type="package" version="5.19.2">requests</requirement>
+        <requirement type="package" version="2.29">requests</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
         curl -o - 'http://bigg.ucsd.edu/static/models/$(input).xml.gz'
         | gunzip > '$model';
-        python '$__tool_directory__/'get_infos.py '$model' --hostid '$input' --comp '$compartments' --biomass '$biomass' --taxid '$taxid'
+        python '$__tool_directory__/'get_infos.py
+        '$model'
+        --hostid '$input'
+        --comp '$compartments'
+        --biomass '$biomass'
+        --taxid '$taxid'
     ]]></command>
     <inputs>
         <param name="input" type="select" label="Strain">