# HG changeset patch # User peterjc # Date 1494431572 14400 # Node ID 0b38302b09c7613b1b86fe69ac9a7186b22d7417 # Parent caf5b859cf7b62f029b54ab0388e96f3ed2f76d2 planemo upload for repository https://github.com/peterjc/pico_galaxy/tree/master/tools/mummer commit 7cf7d2e3fc5480fbe1a463e8a876e54c5c858dbe-dirty diff -r caf5b859cf7b -r 0b38302b09c7 tools/mummer/README.rst --- a/tools/mummer/README.rst Fri Apr 21 12:03:10 2017 -0400 +++ b/tools/mummer/README.rst Wed May 10 11:52:52 2017 -0400 @@ -69,6 +69,8 @@ - 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. ======= ====================================================================== diff -r caf5b859cf7b -r 0b38302b09c7 tools/mummer/mummer.py --- a/tools/mummer/mummer.py Fri Apr 21 12:03:10 2017 -0400 +++ b/tools/mummer/mummer.py Wed May 10 11:52:52 2017 -0400 @@ -23,11 +23,13 @@ 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 @@ -59,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 # ========== @@ -75,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).")