diff bwa-mem.xml @ 24:64f11cf59c6e draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bwa commit 055c6c3de6c9e0f219f5792f6580244815c1cd31"
author iuc
date Wed, 05 May 2021 18:22:08 +0000
parents 3fe632431b68
children e188dc7a68e6
line wrap: on
line diff
--- a/bwa-mem.xml	Tue May 19 11:29:11 2020 -0400
+++ b/bwa-mem.xml	Wed May 05 18:22:08 2021 +0000
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<tool id="bwa_mem" name="Map with BWA-MEM" version="@VERSION@.1">
+<tool id="bwa_mem" name="Map with BWA-MEM" version="@VERSION@.2">
     <description>- map medium and long reads (&gt; 100 bp) against reference genome</description>
     <macros>
         <import>read_group_macros.xml</import>
@@ -14,7 +14,12 @@
 ## Begin BWA-MEM command line
 
 bwa mem
--t "\${GALAXY_SLOTS:-1}"
+
+#if str( $output_sort ) == "unsorted":
+    -t 1
+#else
+    -t "\${GALAXY_SLOTS:-1}"
+#end if
 ## Verbosity is set to 1 (errors only)
 -v 1
 
@@ -106,7 +111,15 @@
     '${fastq_input.fastq_input1}'
 #end if
 
-| samtools sort -@\${GALAXY_SLOTS:-2} -T "\${TMPDIR:-.}" -O bam -o '$bam_output'
+#if str( $output_sort ) == "coordinate":
+        | samtools sort -@\${GALAXY_SLOTS:-2} -T "\${TMPDIR:-.}" -O bam -o '$bam_output'
+#elif str( $output_sort ) == "name":
+        | samtools sort -n -@\${GALAXY_SLOTS:-2} -T "\${TMPDIR:-.}" -O bam -o '$bam_output'
+#else
+        | samtools view -@ \${GALAXY_SLOTS:-2} -bS - -o '$bam_output'
+#end if
+
+
     ]]></command>
 
     <inputs>
@@ -247,11 +260,20 @@
                 </conditional>
             </when>
         </conditional>
+        <param name="output_sort" type="select" label="BAM sorting mode" help="The 'Not sorted' option can extend the run time of the tool significantly (cause it requires running on only a single thread).">
+            <option value="coordinate" selected="True">Sort by chromosomal coordinates</option>
+            <option value="name">Sort by read names  (i.e., the QNAME field) </option>
+            <option value="unsorted">Not sorted (sorted as input)</option>
+        </param>
     </inputs>
 
     <outputs>
         <data format="bam" name="bam_output" label="${tool.name} on ${on_string} (mapped reads in BAM format)">
             <expand macro="dbKeyActionsBwaMem" />
+            <change_format>
+                <when input="output_sort" value="name" format="qname_sorted.bam" />
+                <when input="output_sort" value="unsorted" format="qname_input_sorted.bam" />
+            </change_format>
         </data>
     </outputs>
 
@@ -296,6 +318,26 @@
             <param name="analysis_type_selector" value="illumina"/>
             <output name="bam_output" ftype="bam" file="bwa-mem-test2.bam" lines_diff="2" />
         </test>
+        <test>
+            <param name="reference_source_selector" value="history" />
+            <param name="ref_file" ftype="fasta" value="bwa-mem-mt-genome.fa"/>
+            <param name="fastq_input_selector" value="paired"/>
+            <param name="fastq_input1" ftype="fastqsanger" value="bwa-mem-fastq1.fq"/>
+            <param name="fastq_input2" ftype="fastqsanger" value="bwa-mem-fastq2.fq"/>
+            <param name="analysis_type_selector" value="illumina"/>
+            <param name="output_sort" value="unsorted"/>
+            <output name="bam_output" ftype="qname_input_sorted.bam" file="bwa-mem-test3.bam" lines_diff="2" />
+        </test>
+        <test>
+            <param name="reference_source_selector" value="history" />
+            <param name="ref_file" ftype="fasta" value="bwa-mem-mt-genome.fa"/>
+            <param name="fastq_input_selector" value="paired"/>
+            <param name="fastq_input1" ftype="fastqsanger" value="bwa-mem-fastq1.fq"/>
+            <param name="fastq_input2" ftype="fastqsanger" value="bwa-mem-fastq2.fq"/>
+            <param name="analysis_type_selector" value="illumina"/>
+            <param name="output_sort" value="name"/>
+            <output name="bam_output" ftype="qname_sorted.bam" file="bwa-mem-test4.bam" lines_diff="2" />
+        </test>
     </tests>
     <help><![CDATA[
 **What is does**
@@ -332,6 +374,19 @@
   2. *PacBio mode*: The mode adjusted specifically for mapping of long PacBio subreads. Equivalent to the following command: bwa mem -k17 -W40 -r10 -A1 -B1 -O1 -E1 -L0  <reference index> <PacBio dataset in fastq format>
   3. *Full list of options*: Allows access to all options through Galaxy interface.
 
+  -----
+
+**Bam sorting mode**
+
+The generated bam files can be sorted according to three criteria: coordinates, names and input order.
+
+In coordinate sorted mode the reads are sorted by coordinates. It means that the reads from the beginning of the first chromosome are first in the file. 
+
+When sorted by read name, the file is sorted by the reference ID (i.e., the QNAME field). 
+
+Finally, the *No sorted (sorted as input)* option yield a BAM file in which the records are sorted in an order corresponding to the order of the reads in the original input file. This option requires using a single thread to perform the conversion from SAM to BAM format, so the runtime is extended.
+
+
 @RG@
 
 @info@