Mercurial > repos > peterjc > effectivet3
changeset 6:0f6eb4a75000 draft
v0.0.15 internal changes; v0.0.14 fixed error handling
author | peterjc |
---|---|
date | Wed, 05 Aug 2015 11:04:42 -0400 |
parents | 1ea715da1879 |
children | 5f85301d50bf |
files | tools/effectiveT3/README.rst tools/effectiveT3/effectiveT3.py tools/effectiveT3/effectiveT3.xml |
diffstat | 3 files changed, 46 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/effectiveT3/README.rst Tue Nov 25 08:28:24 2014 -0500 +++ b/tools/effectiveT3/README.rst Wed Aug 05 11:04:42 2015 -0400 @@ -1,7 +1,7 @@ Galaxy wrapper for EffectiveT3 v1.0.1 ===================================== -This wrapper is copyright 2011-2013 by Peter Cock, The James Hutton Institute +This wrapper is copyright 2011-2015 by Peter Cock, The James Hutton Institute (formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved. See the licence text below. @@ -86,7 +86,9 @@ - Development moved to GitHub, https://github.com/peterjc/pico_galaxy v0.0.13 - Relax unit test to allow for small floating point score difference. - Tool definition now embeds citation information. - - Fixed error handling in ``effectiveT3.py``. +v0.0.14 - Fixed error handling in ``effectiveT3.py``. +v0.0.15 - Reorder XML elements (internal change only). + - Planemo for Tool Shed upload (``.shed.yml``, internal change only). ======= ====================================================================== @@ -99,24 +101,33 @@ Development has now moved to a dedicated GitHub repository: https://github.com/peterjc/pico_galaxy/tree/master/tools/effectiveT3 -For making the "Galaxy Tool Shed" http://toolshed.g2.bx.psu.edu/ tarball use -the following command from the Galaxy root folder:: +For pushing a release to the test or main "Galaxy Tool Shed", use the following +Planemo commands (which requires you have set your Tool Shed access details in +``~/.planemo.yml`` and that you have access rights on the Tool Shed):: - $ tar -czf effectiveT3.tar.gz tools/effectiveT3/README.rst tools/effectiveT3/effectiveT3.xml tools/effectiveT3/effectiveT3.py tools/effectiveT3/tool_dependencies.xml tool-data/effectiveT3.loc.sample test-data/four_human_proteins.fasta test-data/four_human_proteins.effectiveT3.tabular test-data/empty.fasta test-data/empty_effectiveT3.tabular + $ planemo shed_update --shed_target testtoolshed --check_diff ~/repositories/pico_galaxy/tools/effectiveT3/ + ... +or:: -Check this worked:: + $ planemo shed_update --shed_target toolshed --check_diff ~/repositories/pico_galaxy/tools/effectiveT3/ + ... + +To just build and check the tar ball, use:: - $ tar -tzf effectiveT3.tar.gz - tools/effectiveT3/README.rst - tools/effectiveT3/effectiveT3.xml - tools/effectiveT3/effectiveT3.py - tools/effectiveT3/tool_dependencies.xml + $ planemo shed_upload --tar_only ~/repositories/pico_galaxy/tools/effectiveT3/ + ... + $ tar -tzf shed_upload.tar.gz tool-data/effectiveT3.loc.sample + test-data/empty.fasta + test-data/empty_effectiveT3.tabular test-data/four_human_proteins.fasta test-data/four_human_proteins.effectiveT3.tabular - test-data/empty.fasta - test-data/empty_effectiveT3.tabular + tool-data/effectiveT3.loc.sample + tools/effectiveT3/README.rst + tools/effectiveT3/effectiveT3.py + tools/effectiveT3/effectiveT3.xml + tools/effectiveT3/tool_dependencies.xml Licence (MIT)
--- a/tools/effectiveT3/effectiveT3.py Tue Nov 25 08:28:24 2014 -0500 +++ b/tools/effectiveT3/effectiveT3.py Wed Aug 05 11:04:42 2015 -0400 @@ -21,25 +21,25 @@ if "-v" in sys.argv or "--version" in sys.argv: # TODO - Get version of the JAR file dynamically? - print("Wrapper v0.0.13, TTSS_GUI-1.0.1.jar") + print("Wrapper v0.0.14, TTSS_GUI-1.0.1.jar") sys.exit(0) -def stop_err(msg, error_level=1): +def sys_exit(msg, error_level=1): """Print error message to stdout and quit with given error level.""" sys.stderr.write("%s\n" % msg) sys.exit(error_level) if len(sys.argv) != 5: - stop_err("Require four arguments: model, threshold, input protein FASTA file & output tabular file") + sys_exit("Require four arguments: model, threshold, input protein FASTA file & output tabular file") model, threshold, fasta_file, tabular_file = sys.argv[1:] if not os.path.isfile(fasta_file): - stop_err("Input FASTA file not found: %s" % fasta_file) + sys_exit("Input FASTA file not found: %s" % fasta_file) if threshold not in ["selective", "sensitive"] \ and not threshold.startswith("cutoff="): - stop_err("Threshold should be selective, sensitive, or cutoff=..., not %r" % threshold) + sys_exit("Threshold should be selective, sensitive, or cutoff=..., not %r" % threshold) def clean_tabular(raw_handle, out_handle): """Clean up Effective T3 output to make it tabular.""" @@ -63,7 +63,7 @@ else: id, descr = id_descr.split("; ",1) except ValueError: - stop_err("Problem parsing line:\n%s\n" % line) + sys_exit("Problem parsing line:\n%s\n" % line) parts = [s.strip() for s in [id, descr, score, effective]] out_handle.write("\t".join(parts) + "\n") count += 1 @@ -79,25 +79,25 @@ try: child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) except Exception, err: - stop_err("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) + sys_exit("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) # Use .communicate as can get deadlocks with .wait(), stdout, stderr = child.communicate() return_code = child.returncode if return_code: cmd_str= " ".join(cmd) # doesn't quote spaces etc if stderr and stdout: - stop_err("Return code %i from command:\n%s\n\n%s\n\n%s" % (return_code, cmd_str, stdout, stderr)) + sys_exit("Return code %i from command:\n%s\n\n%s\n\n%s" % (return_code, cmd_str, stdout, stderr)) else: - stop_err("Return code %i from command:\n%s\n%s" % (return_code, cmd_str, stderr)) + sys_exit("Return code %i from command:\n%s\n%s" % (return_code, cmd_str, stderr)) if not os.path.isdir(effectiveT3_dir): - stop_err("Effective T3 folder not found: %r" % effectiveT3_dir) + sys_exit("Effective T3 folder not found: %r" % effectiveT3_dir) if not os.path.isfile(effectiveT3_jar): - stop_err("Effective T3 JAR file not found: %r" % effectiveT3_jar) + sys_exit("Effective T3 JAR file not found: %r" % effectiveT3_jar) if not os.path.isdir(os.path.join(effectiveT3_dir, "module")): - stop_err("Effective T3 module folder not found: %r" % os.path.join(effectiveT3_dir, "module")) + sys_exit("Effective T3 module folder not found: %r" % os.path.join(effectiveT3_dir, "module")) effectiveT3_model = os.path.join(effectiveT3_dir, "module", model) if not os.path.isfile(effectiveT3_model): @@ -105,7 +105,7 @@ % (os.path.join(effectiveT3_dir, "module"), ", ".join(repr(p) for p in os.listdir(os.path.join(effectiveT3_dir, "module"))))) sys.stderr.write("Main JAR was found: %r\n" % effectiveT3_jar) - stop_err("Effective T3 model JAR file not found: %r" % effectiveT3_model) + sys_exit("Effective T3 model JAR file not found: %r" % effectiveT3_model) # We will have write access whereever the output should be, temp_file = os.path.abspath(tabular_file + ".tmp") @@ -125,12 +125,12 @@ # Must run from directory above the module subfolder: os.chdir(effectiveT3_dir) except: - stop_err("Could not change to Effective T3 folder: %s" % effectiveT3_dir) + sys_exit("Could not change to Effective T3 folder: %s" % effectiveT3_dir) run(cmd) if not os.path.isfile(temp_file): - stop_err("ERROR - No output file from Effective T3") + sys_exit("ERROR - No output file from Effective T3") out_handle = open(tabular_file, "w") out_handle.write("#ID\tDescription\tScore\tEffective\n") @@ -149,4 +149,4 @@ if count and count==errors: # Galaxy will still allow them to see the output file - stop_err("All your sequences gave an error code") + sys_exit("All your sequences gave an error code")
--- a/tools/effectiveT3/effectiveT3.xml Tue Nov 25 08:28:24 2014 -0500 +++ b/tools/effectiveT3/effectiveT3.xml Wed Aug 05 11:04:42 2015 -0400 @@ -1,8 +1,13 @@ -<tool id="effectiveT3" name="Effective T3" version="0.0.13"> +<tool id="effectiveT3" name="Effective T3" version="0.0.15"> <description>Find bacterial effectors in protein sequences</description> <requirements> <requirement type="package" version="1.0.1">effectiveT3</requirement> </requirements> + <stdio> + <!-- Anything other than zero is an error --> + <exit_code range="1:" /> + <exit_code range=":-1" /> + </stdio> <version_command interpreter="python">effectiveT3.py --version</version_command> <command interpreter="python"> effectiveT3.py $module.fields.path @@ -12,11 +17,6 @@ $restrict.type #end if $fasta_file $tabular_file</command> - <stdio> - <!-- Anything other than zero is an error --> - <exit_code range="1:" /> - <exit_code range=":-1" /> - </stdio> <inputs> <param name="fasta_file" type="data" format="fasta" label="FASTA file of protein sequences"/> <param name="module" type="select" display="radio" label="Classification module">