# HG changeset patch # User peterjc # Date 1494432889 14400 # Node ID d9f3d477950724104e4ac770de521f8a94d1846c # Parent 683ea5ab0008361a5ebd56068899058a9b9cd831 v0.0.7 stricter error checking; record gnuplot version diff -r 683ea5ab0008 -r d9f3d4779507 tools/mummer/README.rst --- 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 ```` (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 diff -r 683ea5ab0008 -r d9f3d4779507 tools/mummer/mummer.py --- 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).") diff -r 683ea5ab0008 -r d9f3d4779507 tools/mummer/mummer.xml --- 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 @@ - + Combine mummer/nucmer/promer with mummerplot - ps2pdf ghostscript - mummer - nucmer - promer - mummerplot mummer - gnuplot gnuplot - - - - - - -mummer.py --version + +python $__tool_directory__/mummer.py --version - -mummer.py "$fasta_a" "$fasta_b" $algorithm "$png_output" "$pdf_output" + +python $__tool_directory__/mummer.py '$fasta_a' '$fasta_b' $algorithm '$png_output' '$pdf_output'