Mercurial > repos > tduigou > get_sbml_model
changeset 4:1482291aaa5c draft
planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 4a0b08beb8cdf51ab295a1f5f8c586d6bbaf5586
author | tduigou |
---|---|
date | Mon, 22 May 2023 14:57:40 +0000 |
parents | f59e65c1606a |
children | 80c32f0cb716 |
files | get_infos.py get_sbml_model.xml |
diffstat | 2 files changed, 25 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- 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__":
--- 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">