# HG changeset patch # User tduigou # Date 1682347793 0 # Node ID fa893f77dc221704ca5561f55c7e011d00e3dd81 # Parent ceffb29b60c9efa1024bc7f0b8f4681b7d2613a6 planemo upload for repository https://github.com/brsynth/synbiocad-galaxy-wrappers commit 18fcec17fb6415ad5a59b9bcfa853e755c768e6f diff -r ceffb29b60c9 -r fa893f77dc22 LICENSE --- a/LICENSE Mon Apr 03 09:18:22 2023 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2020 Jean-Loup Faulon's group & INRA -Copyright (c) 2020 University of Evry / Paris-Saclay - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff -r ceffb29b60c9 -r fa893f77dc22 README.md --- a/README.md Mon Apr 03 09:18:22 2023 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -# get_sbml_model - Pick an SBML model among a list - -## How to run get_sbml_model wrapper tests - -In order to execute tests on get_sbml_model wrapper, you need to: - - - Connect to your galaxy instance in interactive mode: - - ```bash - docker exec -it -u root galaxy_galaxy_1 bash - ``` - - Copy all the contents of `test-data` folder into your own test-data directory which is located in your local galaxy instance : `/galaxy/test-data`. It contains all the input files and expected output files needed for the tests. - - - Install Planemo: - You can see here the documentation for Planemo Installation : https://planemo.readthedocs.io/en/latest/installation.html - Note that they recommand to install Planemo by setting up a virtual environment: - - ```bash - python3 -m venv planemo - . planemo/bin/activate - pip install -U planemo - ``` - - - run the tests: - - ```bash - planemo test tools/synbiocad-galaxy-wrappers/get_sbml_model/wrap.xml - ``` - - IMPORTANT: Maybe you will need to remove CONDA from your PATH for the command `planemo test` to run correctly. To do that, you can edit this file `~/.bashrc`, comment this line `PATH="/root/anaconda3/bin:$PATH"` and save changes. - - Planemo will output an html test summary `tool_test_output.html`. \ No newline at end of file diff -r ceffb29b60c9 -r fa893f77dc22 get_infos.py --- a/get_infos.py Mon Apr 03 09:18:22 2023 +0000 +++ b/get_infos.py Mon Apr 24 14:49:53 2023 +0000 @@ -2,6 +2,7 @@ from libsbml import ( readSBMLFromFile ) +from requests import get as r_get def entry_point(): @@ -21,6 +22,16 @@ type=str, help='Path to store biomass reaction ID' ) + parser.add_argument( + '--hostid', + type=str, + help='Extended name of the host organism' + ) + parser.add_argument( + '--taxid', + type=str, + help='Path to store host taxonomy ID' + ) params = parser.parse_args() sbml_doc = readSBMLFromFile(params.infile) @@ -40,5 +51,34 @@ if 'biomass' in rxn.getId().lower(): 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"*** 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}") + else: + try: + taxid = r.json()["parent"]["id"] + except KeyError: + 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') + + if __name__ == "__main__": entry_point() \ No newline at end of file diff -r ceffb29b60c9 -r fa893f77dc22 get_sbml_model.xml --- a/get_sbml_model.xml Mon Apr 03 09:18:22 2023 +0000 +++ b/get_sbml_model.xml Mon Apr 24 14:49:53 2023 +0000 @@ -1,4 +1,4 @@ - + Get an SBML model (BiGG) curl @@ -8,7 +8,7 @@ '$model'; - python '$__tool_directory__/'get_infos.py '$model' --comp '$compartments' --biomass '$biomass' + python '$__tool_directory__/'get_infos.py '$model' --hostid '$input' --comp '$compartments' --biomass '$biomass' --taxid '$taxid' ]]> @@ -63,6 +63,7 @@ + @@ -71,7 +72,8 @@ - + + @@ -84,4 +86,13 @@ + + + @unpublished{get_sbml_model + author = {Joan Hérisson}, + title = {{get_sbml_model}}, + url = {https://github.com/brsynth/}, + } + +