diff picard_SortSam.xml @ 12:05087b27692a draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/picard commit 7491208ca0c917a053798a48c3e54c3e30e95d92
author devteam
date Sun, 27 Nov 2016 15:11:50 -0500
parents efc56ee1ade4
children 7e6fd3d0f16e
line wrap: on
line diff
--- a/picard_SortSam.xml	Wed Nov 11 12:23:17 2015 -0500
+++ b/picard_SortSam.xml	Sun Nov 27 15:11:50 2016 -0500
@@ -4,44 +4,64 @@
     <import>picard_macros.xml</import>
   </macros>
   <expand macro="requirements" />
-  <command>
+  <command detect_errors="exit_code"><![CDATA[
+    #if $sort_order == "queryname":
+        #set $output = "output.sam"
+        ln -s '${outFile}' output.sam &&
+    #else:
+        #set $output = $outFile
+    #end if
     @java_options@
-    java -jar \$JAVA_JAR_PATH/picard.jar
+    picard
     SortSam
     INPUT="${inputFile}"
-    OUTPUT="${outFile}"
+    OUTPUT='${output}'
     SORT_ORDER="${sort_order}"
     QUIET=true
     VERBOSITY=ERROR
     VALIDATION_STRINGENCY=${validation_stringency}
-  </command>
-  
+  ]]></command>
+
   <inputs>
     <param name="inputFile" type="data" format="sam,bam" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
-    <param name="sort_order" type="select" display="radio" label="Sort order" help="SORT_ORDER; default=coordinate">
+    <param name="sort_order" type="select" display="radio" label="Sort order" help="SORT_ORDER; default=coordinate. Selecting Queryname will output SAM file, as Galaxy does not support BAM files that are not coordinate sorted.">
       <option value="coordinate" selected="True">Coordinate</option>
       <option value="queryname">Queryname</option>
     </param>
     <expand macro="VS" />
   </inputs>
-  
+
   <outputs>
-    <data name="outFile" format="bam" label="${tool.name} on ${on_string}: BAM sorted in ${sort_order} order">
+      <data name="outFile" format="bam" label="${tool.name} on ${on_string}: Alignment sorted in ${sort_order} order">
+          <change_format>
+              <when input="sort_order" value="queryname" format="sam"/>
+          </change_format>
     </data>
   </outputs>
-  
-  <stdio>
-    <exit_code range="1:"  level="fatal"/>
-  </stdio>
-  
+
+
   <tests>
+      <!-- This test fails when setting metadata on non-coordinate sorted bam files.
+           This should be handled better in Galaxy (info as of release 16.0).
+           Workaroudn is to produce queryname sorted sam files.
     <test>
       <param name="inputFile" ftype="bam" value="picard_SortSam.bam" />
       <param name="sort_order" value="queryname"/>
-      <output name="outFile" file="picard_SortSam_test1.bam" ftype="bam" lines_diff="2"/>
+      <output name="outFile" file="picard_SortSam_test1.bam" ftype="bam" lines_diff="4"/>
+    </test>
+  -->
+    <test>
+      <param name="inputFile" ftype="bam" value="picard_SortSam.bam" />
+      <param name="sort_order" value="queryname"/>
+      <output name="outFile" file="picard_SortSam_test1.sam" ftype="sam" lines_diff="4" compare="contains"/>
+    </test>
+    <test>
+      <param name="inputFile" ftype="bam" value="picard_SortSam.bam" />
+      <param name="sort_order" value="coordinate"/>
+      <output name="outFile" file="picard_SortSam_test1.bam" ftype="bam" lines_diff="4"/>
     </test>
   </tests>
-  
+
   <help>
 
 .. class:: infomark
@@ -56,7 +76,7 @@
 
   SORT_ORDER=SortOrder
   SO=SortOrder          Sort order of output file. You can either sort by queryname or by coordinate.
- 
+
  @more_info@
 
   </help>