Repository 'bwa_mem2'
hg clone https://testtoolshed.g2.bx.psu.edu/repos/iuc/bwa_mem2

Changeset 3:47195204ebaf (2025-03-19)
Previous changeset 2:bbb670b70b54 (2021-11-24) Next changeset 4:b855f7538222 (2025-03-28)
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bwa_mem2 commit e953b3b7dac6cbe9509fdc673907a7c2c7183180
modified:
bwa-mem2.xml
macros.xml
test-data/bwa_mem2_index.loc
added:
bwa-mem2-idx.xml
test-data/test-cache/reference.0123
test-data/test-cache/reference.amb
test-data/test-cache/reference.ann
test-data/test-cache/reference.bwt.2bit.64
test-data/test-cache/reference.pac
removed:
test-data/test-cache/bwa-mem-mt-genome.fa.0123
test-data/test-cache/bwa-mem-mt-genome.fa.amb
test-data/test-cache/bwa-mem-mt-genome.fa.ann
test-data/test-cache/bwa-mem-mt-genome.fa.bwt.2bit.64
test-data/test-cache/bwa-mem-mt-genome.fa.pac
b
diff -r bbb670b70b54 -r 47195204ebaf bwa-mem2-idx.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bwa-mem2-idx.xml Wed Mar 19 17:25:15 2025 +0000
[
@@ -0,0 +1,36 @@
+<tool id="bwa_mem2_idx" name="BWA-MEM2 indexer"  version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE_VERSION@">
+    <description>Build BWA-MEM2 reference index</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements"/>
+    <command><![CDATA[
+mkdir '$index.extra_files_path' &&
+cd '$index.extra_files_path' &&
+bwa-mem2 index -p 'reference' '${reference}'
+    ]]></command>
+    <inputs>
+        <param name="reference" type="data" format="fasta,fasta.gz" label="Select a genome to index" help="Build an index for this FASTA sequence."/>
+    </inputs>
+    <outputs>
+        <data name="index" format="bwa_mem2_index"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="reference" ftype="fasta" value="bwa-mem-mt-genome.fa"/>
+            <output name="index" ftype="bwa_mem2_index">
+                <extra_files name="reference.0123" type="file" value="test-cache/reference.0123"></extra_files>
+            </output>
+        </test>
+    </tests>
+    <help><![CDATA[
+**What is does**
+BWA-MEM2 is the new version of the bwa-mem algorithm in bwa. It produces alignment identical to bwa and is ~1.3-3.1x faster depending on the use-case, dataset and the running machine.
+The algorithm is robust to sequencing errors and applicable to a wide range of sequence lengths from 70bp to a few megabases.
+
+This tools build a reference index for the bwa-mem2 galaxy tool.
+
+@info@
+    ]]></help>
+    <expand macro="citations" />
+</tool>
b
diff -r bbb670b70b54 -r 47195204ebaf bwa-mem2.xml
--- a/bwa-mem2.xml Wed Nov 24 21:29:12 2021 +0000
+++ b/bwa-mem2.xml Wed Mar 19 17:25:15 2025 +0000
[
@@ -1,4 +1,4 @@
-<tool id="bwa_mem2" name="BWA-MEM2"  version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01">
+<tool id="bwa_mem2" name="BWA-MEM2"  version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2">
     <description>- map medium and long reads (&gt; 100 bp) against reference genome</description>
     <macros>
         <import>read_group_macros.xml</import>
@@ -71,6 +71,9 @@
         ${analysis_type.io_options.M}
         ${analysis_type.io_options.five}
         ${analysis_type.io_options.q}
+        #if str( $analysis_type.io_options.K ):
+            -K '${analysis_type.io_options.K}'
+        #end if
     #end if
 
 #end if
@@ -238,7 +241,7 @@
                 </conditional>
 
                 <conditional name="io_options">
-                    <param name="io_options_selector" type="select" label="Set input/output options" help="Sets -T, -h, -a, -C, -V, -Y, and -M options.">
+                    <param name="io_options_selector" type="select" label="Set input/output options" help="Sets -T, -h, -a, -C, -V, -Y, -M, and -K options.">
                         <option value="set">Set</option>
                         <option value="do_not_set" selected="True">Do not set</option>
                     </param>
@@ -252,6 +255,7 @@
                         <param name="V" type="boolean" truevalue="-V" falsevalue="" label="Output the reference FASTA header in the XR tag" help="-C"/>
                         <param name="Y" type="boolean" truevalue="-Y" falsevalue="" label="Use soft clipping for supplementary alignments" help="-Y; By default, BWA-MEM uses soft clipping for the primary alignment and hard clipping for supplementary alignments" />
                         <param name="M" type="boolean" truevalue="-M" falsevalue="" label="Mark shorter split hits of a chimeric alignment in the FLAG field as 'secondary alignment' instead of 'supplementary alignment'" help="-M; For Picard&lt;1.96 compatibility" />
+                        <param name="K" type="integer" optional="True" label="Process this number of input bases in each batch regardless of nThreads (for reproducibility)" help="-K"/>
                     </when>
                     <when value="do_not_set">
                         <!-- do nothing -->
@@ -279,12 +283,21 @@
     <tests>
         <test>
             <param name="reference_source_selector" value="history" />
+            <param name="ref_file" ftype="bwa_mem2_index" class="Directory" value="test-cache"/>
+            <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"/>
+            <output name="bam_output" ftype="bam" file="bwa-mem-test1.bam" lines_diff="6" />
+        </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"/>
-            <output name="bam_output" ftype="bam" file="bwa-mem-test1.bam" lines_diff="4" />
+            <output name="bam_output" ftype="bam" file="bwa-mem-test1.bam" lines_diff="6" />
         </test>
         <test>
             <param name="reference_source_selector" value="history" />
@@ -292,7 +305,7 @@
             <param name="fastq_input_selector" value="single"/>
             <param name="fastq_input1" ftype="fastqsanger" value="bwa-mem-fasta1.fa"/>
             <param name="analysis_type_selector" value="illumina"/>
-            <output name="bam_output" ftype="bam" file="bwa-mem-test1-fasta.bam" lines_diff="4" />
+            <output name="bam_output" ftype="bam" file="bwa-mem-test1-fasta.bam" lines_diff="6" />
         </test>
         <test>
             <param name="reference_source_selector" value="history" />
@@ -301,7 +314,7 @@
             <param name="fastq_input1" ftype="fastqsanger.gz" value="bwa-mem-fastq1.fq.gz"/>
             <param name="fastq_input2" ftype="fastqsanger" value="bwa-mem-fastq2.fq"/>
             <param name="analysis_type_selector" value="illumina"/>
-            <output name="bam_output" ftype="bam" file="bwa-mem-test1.bam" lines_diff="4" />
+            <output name="bam_output" ftype="bam" file="bwa-mem-test1.bam" lines_diff="6" />
         </test>
         <test>
             <param name="reference_source_selector" value="history" />
@@ -314,7 +327,7 @@
             <param name="PL" value="CAPILLARY"/>
             <param name="LB" value="AARDVARK-1" />
             <param name="analysis_type_selector" value="illumina"/>
-            <output name="bam_output" ftype="bam" file="bwa-mem-test2.bam" lines_diff="4" />
+            <output name="bam_output" ftype="bam" file="bwa-mem-test2.bam" lines_diff="6" />
         </test>
         <test>
             <param name="reference_source_selector" value="history" />
@@ -324,7 +337,7 @@
             <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="4" />
+            <output name="bam_output" ftype="qname_input_sorted.bam" file="bwa-mem-test3.bam" lines_diff="6" />
         </test>
         <test>
             <param name="reference_source_selector" value="history" />
@@ -334,7 +347,7 @@
             <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="4" />
+            <output name="bam_output" ftype="qname_sorted.bam" file="bwa-mem-test4.bam" lines_diff="6" />
         </test>
         <test>
             <param name="reference_source_selector" value="cached" />
@@ -343,7 +356,7 @@
             <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"/>
-            <output name="bam_output" ftype="bam" file="bwa-mem-test1.bam" lines_diff="4" />
+            <output name="bam_output" ftype="bam" file="bwa-mem-test1.bam" lines_diff="6" />
         </test>
     </tests>
     <help><![CDATA[
b
diff -r bbb670b70b54 -r 47195204ebaf macros.xml
--- a/macros.xml Wed Nov 24 21:29:12 2021 +0000
+++ b/macros.xml Wed Mar 19 17:25:15 2025 +0000
[
@@ -2,7 +2,8 @@
     <import>read_group_macros.xml</import>
 
     <token name="@TOOL_VERSION@">2.2.1</token>
-    <token name="@VERSION_SUFFIX@">0</token>
+    <token name="@VERSION_SUFFIX@">1</token>
+    <token name="@PROFILE_VERSION@">20.01</token>
 
     <xml name="xrefs">
         <xrefs>
@@ -29,10 +30,14 @@
 
     <token name="@set_reference_fasta_filename@"><![CDATA[
     #if str( $reference_source.reference_source_selector ) == "history":
-        #set $reference_fasta_filename = "localref.fa"
-        ln -s '${reference_source.ref_file}' '${reference_fasta_filename}' &&
-        bwa-mem2 index
-        '${reference_fasta_filename}' &&
+        #if $reference_source.ref_file.is_of_type("bwa_mem2_index"):
+            #set $reference_fasta_filename = $reference_source.ref_file.extra_files_path + "/reference"
+        #else
+            #set $reference_fasta_filename = "localref." + $reference_source.ref_file.extension
+            ln -s '${reference_source.ref_file}' '${reference_fasta_filename}' &&
+            bwa-mem2 index
+            '${reference_fasta_filename}' &&
+        #end if
     #else:
         #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path )
     #end if
@@ -41,7 +46,7 @@
     <xml name="requirements">
         <requirements>
             <requirement type="package" version="@TOOL_VERSION@">bwa-mem2</requirement>
-            <requirement type="package" version="1.13">samtools</requirement>
+            <yield></yield>
         </requirements>
     </xml>
 
@@ -59,7 +64,7 @@
         <conditional name="reference_source">
             <param name="reference_source_selector" type="select" label="Will you select a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options. See `Indexes` section of help below">
                 <option value="cached">Use a built-in genome index</option>
-                <option value="history">Use a genome from history and build index</option>
+                <option value="history">Use a reference from history and build index if necessary</option>
             </param>
             <when value="cached">
                 <param name="ref_file" type="select" label="Using reference genome" help="Select genome from the list">
@@ -71,7 +76,7 @@
                 </param>
             </when>
             <when value="history">
-                <param name="ref_file" type="data" format="fasta" label="Use the following dataset as the reference sequence" help="You can upload a FASTA sequence to the history and use it as reference" />
+                <param name="ref_file" type="data" format="fasta,fasta.gz,bwa_mem2_index" label="Use the following dataset as the reference" help="You can upload a FASTA sequence to the history and use it as reference. For better performance build a reference index separately." />
             </when>
         </conditional>
     </macro>
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/bwa_mem2_index.loc
--- a/test-data/bwa_mem2_index.loc Wed Nov 24 21:29:12 2021 +0000
+++ b/test-data/bwa_mem2_index.loc Wed Mar 19 17:25:15 2025 +0000
b
@@ -1,1 +1,1 @@
-mtgenome mtGenome Mitochondiral genome ${__HERE__}/test-cache/bwa-mem-mt-genome.fa
\ No newline at end of file
+mtgenome mtGenome Mitochondiral genome ${__HERE__}/test-cache/reference
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/test-cache/bwa-mem-mt-genome.fa.0123
b
Binary file test-data/test-cache/bwa-mem-mt-genome.fa.0123 has changed
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/test-cache/bwa-mem-mt-genome.fa.amb
--- a/test-data/test-cache/bwa-mem-mt-genome.fa.amb Wed Nov 24 21:29:12 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
b
@@ -1,2 +0,0 @@
-16569 1 1
-3106 1 N
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/test-cache/bwa-mem-mt-genome.fa.ann
--- a/test-data/test-cache/bwa-mem-mt-genome.fa.ann Wed Nov 24 21:29:12 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
b
@@ -1,3 +0,0 @@
-16569 1 11
-0 gi|251831106|ref|NC_012920.1| (null)
-0 16569 1
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/test-cache/bwa-mem-mt-genome.fa.bwt.2bit.64
b
Binary file test-data/test-cache/bwa-mem-mt-genome.fa.bwt.2bit.64 has changed
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/test-cache/bwa-mem-mt-genome.fa.pac
b
Binary file test-data/test-cache/bwa-mem-mt-genome.fa.pac has changed
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/test-cache/reference.0123
b
Binary file test-data/test-cache/reference.0123 has changed
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/test-cache/reference.amb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test-cache/reference.amb Wed Mar 19 17:25:15 2025 +0000
b
@@ -0,0 +1,2 @@
+16569 1 1
+3106 1 N
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/test-cache/reference.ann
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test-cache/reference.ann Wed Mar 19 17:25:15 2025 +0000
b
@@ -0,0 +1,3 @@
+16569 1 11
+0 gi|251831106|ref|NC_012920.1| (null)
+0 16569 1
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/test-cache/reference.bwt.2bit.64
b
Binary file test-data/test-cache/reference.bwt.2bit.64 has changed
b
diff -r bbb670b70b54 -r 47195204ebaf test-data/test-cache/reference.pac
b
Binary file test-data/test-cache/reference.pac has changed