# HG changeset patch # User tduigou # Date 1693837183 0 # Node ID 8dc4d3964ab5b7c078b7fd07480e9d0f8887f051 # Parent 9b5947d481928d72f110c4e13e754530df0ff109 planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 09fcdb371be214b222a2e1c540d7c6e7489ca258 diff -r 9b5947d48192 -r 8dc4d3964ab5 get_infos.py --- a/get_infos.py Mon Aug 28 14:24:48 2023 +0000 +++ b/get_infos.py Mon Sep 04 14:19:43 2023 +0000 @@ -12,6 +12,12 @@ type=str, help='SBML input file (xml)' ) + # argument to tag file from BiGG + parser.add_argument( + '--bigg', + action='store_true', + help='Tag file from BiGG' + ) parser.add_argument( '--comp', type=str, @@ -52,33 +58,41 @@ f.write(f'{rxn.getId()}\n') if params.taxid: - # Extended Name - server = 'http://bigg.ucsd.edu/api/v2/models/' - ext = params.hostid - r = r_get(server+ext, headers={ "Content-Type" : "application/json"}) - if not r.ok: - print(f"Warning: unable to retrieve host name for id {params.hostid}") - else: - try: - hostname = r.json()["organism"] - except KeyError: - print(f"Warning: unable to retrieve host name for id {params.hostid}") - hostname = '' - if not hostname: - taxid = '' - else: - # TAXON ID - server = 'https://rest.ensembl.org' - ext = f'/taxonomy/id/{hostname}?' + hostname = '' + + # Model from BiGG + if params.bigg: + # Extended Name + server = 'http://bigg.ucsd.edu/api/v2/models/' + ext = params.hostid 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}") else: try: - taxid = r.json()["id"] + hostname = r.json()["organism"] except KeyError: + print(f"Warning: unable to retrieve host name for id {params.hostid}") + if not hostname: + taxid = '' + else: + # 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}") - taxid = '' + else: + try: + taxid = r.json()["id"] + except KeyError: + print(f"Warning: unable to retrieve taxonomy ID for host organism {hostname}") + taxid = '' + + # Model from user + else: + taxid = params.hostid + with open(params.taxid, 'w') as f: f.write('#ID\n') f.write(f'{taxid}\n') diff -r 9b5947d48192 -r 8dc4d3964ab5 get_sbml_model.xml --- a/get_sbml_model.xml Mon Aug 28 14:24:48 2023 +0000 +++ b/get_sbml_model.xml Mon Sep 04 14:19:43 2023 +0000 @@ -1,23 +1,32 @@ - + Get an SBML model (BiGG) curl gzip python-libsbml requests + taxonid '$model' && #else - cp '${cond_src.input_file}' '$model' && + python -m taxonid '${cond_src.hostname}' --output-file tmpfile && + echo "#ID" > '$taxid' && + cat tmpfile >> '$taxid' && #end if + echo "listdir:"; + ls; python '$__tool_directory__/'get_infos.py - '$model' - --hostid '${cond_src.hostid}' - --comp '$compartments' - --biomass '$biomass' - --taxid '$taxid' + #if str($cond_src.from_src) == 'from_bigg' + '$model' + --taxid '$taxid' + #else + '${cond_src.input_file}' + #end if + --hostid '${cond_src.hostid}' + --comp '$compartments' + --biomass '$biomass' ]]> @@ -26,8 +35,11 @@ + + + - + @@ -85,30 +97,30 @@ - + + cond_src['from_src'] == 'from_bigg' + - - - - + + - + + - - +