# HG changeset patch # User peterjc # Date 1494941345 14400 # Node ID 02572789ef6ce4f171e5e6964c9d8b0619df16c4 # Parent 01f8967ce1e0db6daa8536cf9d58a68cfa5cdd20 v0.0.4 Internal changes to command line handling diff -r 01f8967ce1e0 -r 02572789ef6c tools/samtools_depad/README.rst --- a/tools/samtools_depad/README.rst Wed May 13 10:15:02 2015 -0400 +++ b/tools/samtools_depad/README.rst Tue May 16 09:29:05 2017 -0400 @@ -1,14 +1,14 @@ Galaxy wrapper for samtools depad ================================= -This wrapper is copyright 2014-2015 by Peter Cock, The James Hutton Institute +This wrapper is copyright 2014-2017 by Peter Cock, The James Hutton Institute (formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved. See the licence text below. This is a wrapper for part of the command line samtools suite, v0.1.19 This wrapper is available from the Galaxy Tool Shed at: -http://toolshed.g2.bx.psu.edu/view/peterjc/samtools_idxstats +http://toolshed.g2.bx.psu.edu/view/peterjc/samtools_depad Automated Installation @@ -54,6 +54,8 @@ - Removed unused imports from Python wrapper script. v0.0.3 - Reorder XML elements (internal change only). - Planemo for Tool Shed upload (``.shed.yml``, internal change only). +v0.0.4 - Use ```` (internal change only). + - Single quote command line arguments (internal change only). ======= ====================================================================== @@ -67,17 +69,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_upload --shed_target testtoolshed --check_diff ~/repositories/pico_galaxy/tools/samtools_depad/ + $ planemo shed_update -t testtoolshed --check_diff tools/samtools_depad/ ... or:: - $ planemo shed_upload --shed_target toolshed --check_diff ~/repositories/pico_galaxy/tools/samtools_depad/ + $ planemo shed_update -t toolshed --check_diff tools/samtools_depad/ ... To just build and check the tar ball, use:: - $ planemo shed_upload --tar_only ~/repositories/pico_galaxy/tools/samtools_depad/ + $ planemo shed_upload --tar_only tools/samtools_depad/ ... $ tar -tzf shed_upload.tar.gz test-data/sam_spec_padded.bam diff -r 01f8967ce1e0 -r 02572789ef6c tools/samtools_depad/samtools_depad.py --- a/tools/samtools_depad/samtools_depad.py Wed May 13 10:15:02 2015 -0400 +++ b/tools/samtools_depad/samtools_depad.py Tue May 16 09:29:05 2017 -0400 @@ -9,38 +9,34 @@ Runs "samtools depad" and captures the output to the desired BAM file. """ + +import os import sys -import os if "-v" in sys.argv or "--version" in sys.argv: - #Galaxy seems to invert the order of the two lines - print "(Galaxy wrapper v0.0.2)" + # Galaxy seems to invert the order of the two lines + print "(Galaxy wrapper v0.0.4)" cmd = "samtools 2>&1 | grep -i ^Version" sys.exit(os.system(cmd)) -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: - sys_exit("Require four arguments: padded FASTA, SAM/BAM file, format (SAM or BAM), output BAM filenames") + sys.exit("Require four arguments: padded FASTA, SAM/BAM file, format (SAM or BAM), output BAM filenames") padded_ref, bam_filename, input_format, output_filename = sys.argv[1:] if not os.path.isfile(padded_ref): - sys_exit("Input padded reference FASTA file not found: %s" % padded_ref) + sys.exit("Input padded reference FASTA file not found: %s" % padded_ref) if not os.path.isfile(bam_filename): - sys_exit("Input BAM file not found: %s" % bam_filename) + sys.exit("Input BAM file not found: %s" % bam_filename) if input_format.lower() not in ["sam", "bam"]: - sys_exit("Input format should be SAM or BAM, not %r" % input_format) + sys.exit("Input format should be SAM or BAM, not %r" % input_format) -#Run samtools depad: +# Run samtools depad: if input_format.lower() == "sam": - cmd = "samtools depad -S -T %s %s > %s" % (padded_ref, bam_filename, output_filename) + cmd = "samtools depad -S -T '%s' '%s' > '%s'" % (padded_ref, bam_filename, output_filename) else: - cmd = "samtools depad -T %s %s > %s" % (padded_ref, bam_filename, output_filename) + cmd = "samtools depad -T '%s' '%s' > '%s'" % (padded_ref, bam_filename, output_filename) return_code = os.system(cmd) if return_code: - sys_exit("Return code %i from command:\n%s" % (return_code, cmd)) + sys.exit("Return code %i from command:\n%s" % (return_code, cmd)) diff -r 01f8967ce1e0 -r 02572789ef6c tools/samtools_depad/samtools_depad.xml --- a/tools/samtools_depad/samtools_depad.xml Wed May 13 10:15:02 2015 -0400 +++ b/tools/samtools_depad/samtools_depad.xml Tue May 16 09:29:05 2017 -0400 @@ -1,16 +1,14 @@ - + samtools depad - samtools samtools - - - - - - samtools_depad.py --version - samtools_depad.py "$padded_ref" "$input_bam" "$input_bam.ext" "$output_bam" + +python $__tool_directory__/samtools_depad.py --version + + +python $__tool_directory__/samtools_depad.py '$padded_ref' '$input_bam' '$input_bam.ext' '$output_bam' + diff -r 01f8967ce1e0 -r 02572789ef6c tools/samtools_depad/tool_dependencies.xml --- a/tools/samtools_depad/tool_dependencies.xml Wed May 13 10:15:02 2015 -0400 +++ b/tools/samtools_depad/tool_dependencies.xml Tue May 16 09:29:05 2017 -0400 @@ -1,6 +1,6 @@ - +