# HG changeset patch # User tduigou # Date 1684767460 0 # Node ID 1482291aaa5c8f8733ebcbaeb405d0e9a9ef331a # Parent f59e65c1606aba988019b0dc9c1dc1a901fe9c63 planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 4a0b08beb8cdf51ab295a1f5f8c586d6bbaf5586 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__": 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 @@ curl gzip python-libsbml - requests + requests '$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' ]]>