Mercurial > repos > peterjc > mummer
changeset 6:d9f3d4779507 draft default tip
v0.0.7 stricter error checking; record gnuplot version
author | peterjc |
---|---|
date | Wed, 10 May 2017 12:14:49 -0400 |
parents | 683ea5ab0008 |
children | |
files | tools/mummer/README.rst tools/mummer/mummer.py tools/mummer/mummer.xml |
diffstat | 3 files changed, 36 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/mummer/README.rst Wed Feb 01 06:58:01 2017 -0500 +++ b/tools/mummer/README.rst Wed May 10 12:14:49 2017 -0400 @@ -67,6 +67,10 @@ - Planemo for Tool Shed upload (``.shed.yml``, internal change only). v0.0.6 - PEP8 style changes to Python script (internal change only). - Fixed display of input parameter help text. +v0.0.7 - Use ``<command detect_errors="aggressive">`` (internal change only). + - Single quote command line arguments (internal change only). + - Wrapper script catches missing output explicitly. + - Capture gnuplot version as well. ======= ====================================================================== @@ -81,17 +85,17 @@ 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):: - $ planemo shed_update -t testtoolshed --check_diff ~/repositories/pico_galaxy/tools/mummer/ + $ planemo shed_update -t testtoolshed --check_diff tools/mummer/ ... or:: - $ planemo shed_update -t toolshed --check_diff ~/repositories/pico_galaxy/tools/mummer/ + $ planemo shed_update -t toolshed --check_diff tools/mummer/ ... To just build and check the tar ball, use:: - $ planemo shed_upload --tar_only ~/repositories/pico_galaxy/tools/mummer/ + $ planemo shed_upload --tar_only tools/mummer/ ... $ tar -tzf shed_upload.tar.gz test-data/magic.pdf
--- a/tools/mummer/mummer.py Wed Feb 01 06:58:01 2017 -0500 +++ b/tools/mummer/mummer.py Wed May 10 12:14:49 2017 -0400 @@ -10,9 +10,9 @@ """ import os +import shutil import sys import tempfile -import shutil def run(cmd): @@ -21,12 +21,15 @@ if return_code: sys.exit("Error %i from: %s" % (return_code, cmd)) + if "-v" in sys.argv[1:]or "--version" in sys.argv[1:]: - print("MUMmer wrapper v0.0.3\n") + print("MUMmer wrapper v0.0.7\n") # TODO - How to get a version string from the mummer binary? os.system("nucmer --version") os.system("promer --version") os.system("mummerplot --version") + os.system("gnuplot --version") + # TODO - Should we include "gs --version" as a proxy for ps2pdf? sys.exit(0) # Parse Command Line @@ -58,11 +61,17 @@ cmd = '%s "%s" "%s"' % (algorithm, fasta_a, fasta_b) run(cmd) +output_failed = False + # PNG # === cmd = 'mummerplot -R "%s" -Q "%s" --png --large --prefix=%s %s' % (fasta_a, fasta_b, prefix, coords) run(cmd) -shutil.move(png_image, png_out) +if os.path.isfile(png_image): + shutil.move(png_image, png_out) +else: + sys.stderr.write("ERROR: PNG file not created.\n") + output_failed = True # PS --> PDF # ========== @@ -74,9 +83,19 @@ # Using "set size 1,1" works better - which is what --small gives: cmd = 'mummerplot -R "%s" -Q "%s" --postscript --small --prefix=%s %s' % (fasta_a, fasta_b, prefix, coords) run(cmd) -cmd = 'ps2pdf -dEPSCrop "%s" "%s"' % (ps_image, pdf_out) -run(cmd) +if not os.path.isfile(ps_image): + sys.stderr.write("ERROR: PostScript file needed for PDF output was not created.\n") + output_failed = True +else: + cmd = 'ps2pdf -dEPSCrop "%s" "%s"' % (ps_image, pdf_out) + run(cmd) + if not os.path.isfile(pdf_out): + sys.stderr.write("ERROR: PDF file not created.\n") + output_failed = True # Remove temp files... os.remove(coords) # Might not be under the temp directory... shutil.rmtree(base_path) + +if output_failed: + sys.exit("ERROR: Failed to produce output file(s).")
--- a/tools/mummer/mummer.xml Wed Feb 01 06:58:01 2017 -0500 +++ b/tools/mummer/mummer.xml Wed May 10 12:14:49 2017 -0400 @@ -1,29 +1,18 @@ -<tool id="mummerplot_wrapper" name="MUMmer dotplot" version="0.0.6"> +<tool id="mummerplot_wrapper" name="MUMmer dotplot" version="0.0.7"> <description>Combine mummer/nucmer/promer with mummerplot</description> <requirements> <!-- Needs ps2pdf from ghostscript --> - <requirement type="binary">ps2pdf</requirement> <requirement type="package" version="9.10">ghostscript</requirement> <!-- Needs mummer, nucmer, promer and mummerplot from MUMmer --> - <requirement type="binary">mummer</requirement> - <requirement type="binary">nucmer</requirement> - <requirement type="binary">promer</requirement> - <requirement type="binary">mummerplot</requirement> <requirement type="package" version="3.23">mummer</requirement> <!-- mummerplot needs the gnuplot binary --> - <requirement type="binary">gnuplot</requirement> <requirement type="package" version="4.6">gnuplot</requirement> </requirements> - <stdio> - <!-- Anything other than zero is an error --> - <exit_code range="1:" /> - <exit_code range=":-1" /> - </stdio> - <version_command interpreter="python"> -mummer.py --version + <version_command> +python $__tool_directory__/mummer.py --version </version_command> - <command interpreter="python"> -mummer.py "$fasta_a" "$fasta_b" $algorithm "$png_output" "$pdf_output" + <command detect_errors="aggressive"> +python $__tool_directory__/mummer.py '$fasta_a' '$fasta_b' $algorithm '$png_output' '$pdf_output' </command> <inputs> <!-- Galaxy does not have sub-types for protein vs nucletide FASTA -->