Mercurial > repos > peterjc > samtools_idxstats
changeset 1:8945bad80f4a draft
v0.0.4; internal changes for packaging
author | peterjc |
---|---|
date | Wed, 13 May 2015 10:35:50 -0400 |
parents | d4412c04d7b1 |
children | 71afa65f444a |
files | tools/samtools_idxstats/README.rst tools/samtools_idxstats/samtools_idxstats.py tools/samtools_idxstats/samtools_idxstats.xml tools/samtools_idxstats/tool_dependencies.xml |
diffstat | 4 files changed, 49 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/samtools_idxstats/README.rst Wed Nov 20 12:27:33 2013 -0500 +++ b/tools/samtools_idxstats/README.rst Wed May 13 10:35:50 2015 -0400 @@ -1,7 +1,7 @@ Galaxy wrapper for samtools idxstats ==================================== -This wrapper is copyright 2013 by Peter Cock, The James Hutton Institute +This wrapper is copyright 2013-2015 by Peter Cock, The James Hutton Institute (formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved. See the licence text below. @@ -26,19 +26,19 @@ To install the wrapper copy or move the following files under the Galaxy tools folder, e.g. in a ``tools/samtools_idxstats`` folder: -* samtools_idxstats.xml (the Galaxy tool definition) -* samtools_idxstats.py (the Python wrapper script) -* README.rst (this file) +* ``samtools_idxstats.xml`` (the Galaxy tool definition) +* ``samtools_idxstats.py`` (the Python wrapper script) +* ``README.rst`` (this file) You will also need to modify the ``tools_conf.xml`` file to tell Galaxy to offer the tool. Just add the line, perhaps under the NGS tools section:: <tool file="samtools_idxstats/samtools_idxstats.xml" /> -If you wish to run the unit tests, also add this to tools_conf.xml.sample -and move/copy the test-data files under Galaxy's test-data folder. Then:: +If you wish to run the unit tests, also move/copy the ``test-data/`` files +under Galaxy's ``test-data/`` folder. Then:: - $ ./run_functional_tests.sh -id samtools_idxstats + $ ./run_tests.sh -id samtools_idxstats That's it. @@ -50,29 +50,43 @@ Version Changes ------- ---------------------------------------------------------------------- v0.0.1 - Initial public release +v0.0.2 - Use quoted filenames when calling samtools (in case of spaces etc) +v0.0.3 - Embed samtools citation in tool XML. +v0.0.4 - Reorder XML elements (internal change only). + - Planemo for Tool Shed upload (``.shed.yml``, internal change only). ======= ====================================================================== Developers ========== -Development is one this GitHub repository: +Development is on this GitHub repository: https://github.com/peterjc/pico_galaxy/tree/master/tools/samtools_idxstats -For making the "Galaxy Tool Shed" http://toolshed.g2.bx.psu.edu/ tarball use -the following command from the Galaxy root folder:: - $ tar -czf samtools_idxstats.tar.gz tools/samtools_idxstats/README.rst tools/samtools_idxstats/samtools_idxstats.xml tools/samtools_idxstats/samtools_idxstats.py tools/samtools_idxstats/tool_dependencies.xml test-data/ex1.bam test-data/ex1.idxstats.tabular +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):: + + $ planemo shed_upload --shed_target testtoolshed --check_diff ~/repositories/pico_galaxy/tools/samtools_idxstats/ + ... -Check this worked:: +or:: + + $ planemo shed_upload --shed_target toolshed --check_diff ~/repositories/pico_galaxy/tools/samtools_idxstats/ + ... - $ tar -tzf samtools_idxstats.tar.gz - tools/samtools_idxstats/README.rst - tools/samtools_idxstats/samtools_idxstats.xml - tools/samtools_idxstats/samtools_idxstats.py - tools/samtools_idxstats/tool_dependencies.xml +To just build and check the tar ball, use:: + + $ planemo shed_upload --tar_only ~/repositories/pico_galaxy/tools/samtools_idxstats/ + ... + $ tar -tzf shed_upload.tar.gz test-data/ex1.bam test-data/ex1.idxstats.tabular + tools/samtools_idxstats/README.rst + tools/samtools_idxstats/samtools_idxstats.py + tools/samtools_idxstats/samtools_idxstats.xml + tools/samtools_idxstats/tool_dependencies.xml Licence (MIT)
--- a/tools/samtools_idxstats/samtools_idxstats.py Wed Nov 20 12:27:33 2013 -0500 +++ b/tools/samtools_idxstats/samtools_idxstats.py Wed May 13 10:35:50 2015 -0400 @@ -17,26 +17,26 @@ 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.1)" + print "(Galaxy wrapper v0.0.2)" cmd = "samtools 2>&1 | grep -i ^Version" sys.exit(os.system(cmd)) -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) != 4: - stop_err("Require three arguments: BAM, BAI, tabular filenames") + sys_exit("Require three arguments: BAM, BAI, tabular filenames") bam_filename, bai_filename, tabular_filename = sys.argv[1:] if not os.path.isfile(bam_filename): - stop_err("Input BAM file not found: %s" % bam_filename) + sys_exit("Input BAM file not found: %s" % bam_filename) if not os.path.isfile(bai_filename): if bai_filename == "None": - stop_err("Error: Galaxy did not index your BAM file") - stop_err("Input BAI file not found: %s" % bai_filename) + sys_exit("Error: Galaxy did not index your BAM file") + sys_exit("Input BAI file not found: %s" % bai_filename) #Assign sensible names with real extensions, and setup symlinks: tmp_dir = tempfile.mkdtemp() @@ -49,7 +49,7 @@ assert os.path.isfile(bam_file + ".bai"), bam_file #Run samtools idxstats: -cmd = "samtools idxstats %s > %s" % (bam_file, tabular_filename) +cmd = 'samtools idxstats "%s" > "%s"' % (bam_file, tabular_filename) return_code = os.system(cmd) #Remove the temp symlinks: @@ -58,4 +58,4 @@ os.rmdir(tmp_dir) if return_code: - stop_err("Return code %i from command:\n%s" % (return_code, cmd)) + sys_exit("Return code %i from command:\n%s" % (return_code, cmd))
--- a/tools/samtools_idxstats/samtools_idxstats.xml Wed Nov 20 12:27:33 2013 -0500 +++ b/tools/samtools_idxstats/samtools_idxstats.xml Wed May 13 10:35:50 2015 -0400 @@ -1,9 +1,14 @@ -<tool id="samtools_idxstats" name="BAM mapping statistics" version="0.0.1"> +<tool id="samtools_idxstats" name="BAM mapping statistics" version="0.0.4"> <description>samtools idxstats</description> <requirements> <requirement type="binary">samtools</requirement> <requirement type="package" version="0.1.19">samtools</requirement> </requirements> + <stdio> + <!-- Assume anything other than zero is an error --> + <exit_code range="1:" /> + <exit_code range=":-1" /> + </stdio> <version_command interpreter="python">samtools_idxstats.py --version</version_command> <command interpreter="python">samtools_idxstats.py "$input_bam" "${input_bam.metadata.bam_index}" "$out_tabular"</command> <inputs> @@ -12,11 +17,6 @@ <outputs> <data name="out_tabular" format="tabular" label="$input_bam.name (idxstats)" /> </outputs> - <stdio> - <!-- Assume anything other than zero is an error --> - <exit_code range="1:" /> - <exit_code range=":-1" /> - </stdio> <tests> <test> <param name="input_bam" value="ex1.bam" ftype="bam" /> @@ -73,4 +73,7 @@ This wrapper is available to install into other Galaxy Instances via the Galaxy Tool Shed at http://toolshed.g2.bx.psu.edu/view/peterjc/samtools_idxstats </help> + <citations> + <citation type="doi">10.1093/bioinformatics/btp352</citation> + </citations> </tool>
--- a/tools/samtools_idxstats/tool_dependencies.xml Wed Nov 20 12:27:33 2013 -0500 +++ b/tools/samtools_idxstats/tool_dependencies.xml Wed May 13 10:35:50 2015 -0400 @@ -1,6 +1,6 @@ <?xml version="1.0"?> <tool_dependency> <package name="samtools" version="0.1.19"> - <repository changeset_revision="00e17a794a2e" name="package_samtools_0_1_19" owner="iuc" toolshed="http://toolshed.g2.bx.psu.edu" /> + <repository changeset_revision="96aab723499f" name="package_samtools_0_1_19" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" /> </package> </tool_dependency>