changeset 1:01f8967ce1e0 draft

v0.0.3; internal changes to help packaging with planemo
author peterjc
date Wed, 13 May 2015 10:15:02 -0400
parents 2d303f2e09e0
children 02572789ef6c
files tools/samtools_depad/README.rst tools/samtools_depad/samtools_depad.py tools/samtools_depad/samtools_depad.xml tools/samtools_depad/tool_dependencies.xml
diffstat 4 files changed, 50 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/tools/samtools_depad/README.rst	Fri Nov 21 06:37:20 2014 -0500
+++ b/tools/samtools_depad/README.rst	Wed May 13 10:15:02 2015 -0400
@@ -1,7 +1,7 @@
 Galaxy wrapper for samtools depad
 =================================
 
-This wrapper is copyright 2014 by Peter Cock, The James Hutton Institute
+This wrapper is copyright 2014-2015 by Peter Cock, The James Hutton Institute
 (formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved.
 See the licence text below.
 
@@ -21,7 +21,7 @@
 Manual Installation
 ===================
 
-This expects samtools to be on the $PATH, and was tested using v0.1.19.
+This expects samtools to be on the ``$PATH``, and was tested using v0.1.19.
 
 To install the wrapper copy or move the following files under the Galaxy tools
 folder, e.g. in a ``tools/samtools_depad`` folder:
@@ -35,10 +35,10 @@
 
   <tool file="samtools_depad/samtools_depad.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_depad
+    $ ./run_tests.sh -id samtools_depad
 
 That's it.
 
@@ -49,7 +49,11 @@
 ======= ======================================================================
 Version Changes
 ------- ----------------------------------------------------------------------
-v0.0.1  - Initial public release
+v0.0.1  - Initial public release.
+v0.0.2  - Embed samtools citation in the tool XML.
+        - 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).
 ======= ======================================================================
 
 
@@ -59,22 +63,31 @@
 Development is on this GitHub repository:
 https://github.com/peterjc/pico_galaxy/tree/master/tools/samtools_depad
 
-For making the "Galaxy Tool Shed" http://toolshed.g2.bx.psu.edu/ tarball use
-the following command from the Galaxy root folder::
+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)::
 
-    $ tar -czf samtools_depad.tar.gz tools/samtools_depad/README.rst tools/samtools_depad/samtools_depad.xml tools/samtools_depad/samtools_depad.py tools/samtools_depad/tool_dependencies.xml test-data/sam_spec_padded.fasta test-data/sam_spec_padded.sam test-data/sam_spec_padded.bam test-data/sam_spec_padded.depad.bam
+    $ planemo shed_upload --shed_target testtoolshed --check_diff ~/repositories/pico_galaxy/tools/samtools_depad/
+    ...
+
+or::
 
-Check this worked::
+    $ planemo shed_upload --shed_target toolshed --check_diff ~/repositories/pico_galaxy/tools/samtools_depad/
+    ...
+
+To just build and check the tar ball, use::
 
-    $ tar -tzf samtools_depad.tar.gz
-    tools/samtools_depad/README.rst
-    tools/samtools_depad/samtools_depad.xml
-    tools/samtools_depad/samtools_depad.py
-    tools/samtools_depad/tool_dependencies.xml
+    $ planemo shed_upload --tar_only  ~/repositories/pico_galaxy/tools/samtools_depad/
+    ...
+    $ tar -tzf shed_upload.tar.gz
+    test-data/sam_spec_padded.bam
+    test-data/sam_spec_padded.depad.bam
     test-data/sam_spec_padded.fasta
     test-data/sam_spec_padded.sam
-    test-data/sam_spec_padded.bam
-    test-data/sam_spec_padded.depad.bam
+    tools/samtools_depad/README.rst
+    tools/samtools_depad/samtools_depad.py
+    tools/samtools_depad/samtools_depad.xml
+    tools/samtools_depad/tool_dependencies.xml
 
 
 Licence (MIT)
--- a/tools/samtools_depad/samtools_depad.py	Fri Nov 21 06:37:20 2014 -0500
+++ b/tools/samtools_depad/samtools_depad.py	Wed May 13 10:15:02 2015 -0400
@@ -11,31 +11,29 @@
 """
 import sys
 import os
-import subprocess
-import tempfile
 
 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):
-   """Print error message to stdout and quit with given error level."""
-   sys.stderr.write("%s\n" % msg)
-   sys.exit(error_level)
+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:
-   stop_err("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):
-    stop_err("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):
-    stop_err("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"]:
-    stop_err("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:
 if input_format.lower() == "sam":
@@ -45,4 +43,4 @@
 return_code = os.system(cmd)
 
 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_depad/samtools_depad.xml	Fri Nov 21 06:37:20 2014 -0500
+++ b/tools/samtools_depad/samtools_depad.xml	Wed May 13 10:15:02 2015 -0400
@@ -1,9 +1,14 @@
-<tool id="samtools_depad" name="Depad SAM/BAM file" version="0.0.1">
+<tool id="samtools_depad" name="Depad SAM/BAM file" version="0.0.3">
     <description>samtools depad</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_depad.py --version</version_command>
     <command interpreter="python">samtools_depad.py "$padded_ref" "$input_bam" "$input_bam.ext" "$output_bam"</command>
     <inputs>
@@ -13,11 +18,6 @@
     <outputs>
         <data name="output_bam" format="bam" label="$input_bam.name (depad)" />
     </outputs>
-    <stdio>
-        <!-- Assume anything other than zero is an error -->
-        <exit_code range="1:" />
-        <exit_code range=":-1" />
-    </stdio>
     <tests>
         <test>
             <param name="padded_ref" value="sam_spec_padded.fasta" ftype="fasta" />
@@ -56,4 +56,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_depad
     </help>
+    <citations>
+        <citation type="doi">10.1093/bioinformatics/btp352</citation>
+    </citations>
 </tool>
--- a/tools/samtools_depad/tool_dependencies.xml	Fri Nov 21 06:37:20 2014 -0500
+++ b/tools/samtools_depad/tool_dependencies.xml	Wed May 13 10:15:02 2015 -0400
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <tool_dependency>
     <package name="samtools" version="0.1.19">
-        <repository changeset_revision="923adc89c666" name="package_samtools_0_1_19" owner="iuc" toolshed="https://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>