changeset 33:c3d19e7ee879 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bowtie2 commit 4508a3878ac8d12306a7521aa55fa286710d947a
author iuc
date Wed, 24 Sep 2025 13:36:57 +0000
parents 6b4916819621
children
files bowtie2_macros.xml bowtie2_wrapper.xml test-data/bowtie2-ref.1.bt2 test-data/bowtie2-ref.2.bt2 test-data/bowtie2-ref.3.bt2 test-data/bowtie2-ref.4.bt2 test-data/bowtie2-ref.rev.1.bt2 test-data/bowtie2-ref.rev.2.bt2 test-data/bowtie2-single.bam test-data/bowtie2-test1.bam test-data/bowtie2-test2.bam test-data/bowtie2-test_fasta_in.bam test-data/bowtie2-test_fasta_in_bam_qname_input_sorted.bam test-data/bowtie2-test_il.bam test-data/bowtie2_indices.loc tool_data_table_conf.xml.test
diffstat 16 files changed, 457 insertions(+), 335 deletions(-) [+]
line wrap: on
line diff
--- a/bowtie2_macros.xml	Thu Nov 03 19:37:06 2022 +0000
+++ b/bowtie2_macros.xml	Wed Sep 24 13:36:57 2025 +0000
@@ -1,6 +1,7 @@
 <macros>
-    <token name="@TOOL_VERSION@">2.5.0</token>
+    <token name="@TOOL_VERSION@">2.5.4</token>
     <token name="@VERSION_SUFFIX@">0</token>
+    <token name="@PROFILE@">23.0</token>
     <!-- Import this at the top of your command block and then
          define rg_auto_name. -->
     <token name="@define_read_group_helpers@">
@@ -59,7 +60,7 @@
 #if $use_rg
     #if $rg_param('read_group_id_conditional') is None
         #set $rg_id = $rg_auto_name
-    #elif $rg_param('read_group_id_conditional').do_auto_name
+    #elif $rg_param('read_group_id_conditional').do_auto_name == "yes"
         #set $rg_id = $rg_auto_name
     #else
         #set $rg_id = str($rg_param('read_group_id_conditional').ID)
@@ -67,7 +68,7 @@
 
     #if $rg_param('read_group_sm_conditional') is None
         #set $rg_sm = ''
-    #elif $rg_param('read_group_sm_conditional').do_auto_name
+    #elif $rg_param('read_group_sm_conditional').do_auto_name == "yes"
         #set $rg_sm = $rg_auto_name
     #else
         #set $rg_sm = str($rg_param('read_group_sm_conditional').SM)
@@ -81,7 +82,7 @@
 
     #if $rg_param('read_group_lb_conditional') is None
         #set $rg_lb = ''
-    #elif $rg_param('read_group_lb_conditional').do_auto_name
+    #elif $rg_param('read_group_lb_conditional').do_auto_name == "yes"
         #set $rg_lb = $rg_auto_name
     #else
         #set $rg_lb = str($rg_param('read_group_lb_conditional').LB)
@@ -140,15 +141,17 @@
 #set $use_rg = str($rg.rg_selector) != "do_not_set"
     </token>
     <xml name="read_group_auto_name_conditional">
-        <param name="do_auto_name" type="boolean" label="Auto-assign" help="Use dataset name or collection information to automatically assign this value" checked="false" />
-        <when value="true">
-        </when>
-        <when value="false">
+        <param name="do_auto_name" type="select" optional="false" label="Auto-assign" help="Use dataset name or collection information to automatically assign this value">
+            <option value="yes">Yes</option>
+            <option value="no" selected="true">No</option>
+        </param>
+        <when value="yes"/>
+        <when value="no">
             <yield />
         </when>
     </xml>
     <xml name="read_group_id_param">
-        <param name="ID" type="text" value="" label="Read group identifier (ID)" help="This value must be unique among multiple samples in your experiment" optional="false">
+        <param name="ID" type="text" value="" label="Read group identifier (ID)" help="This value must be unique among multiple samples in your experiment">
             <validator type="empty_field" />
         </param>
     </xml>
@@ -173,7 +176,7 @@
          as per Picard.
     -->
     <xml name="read_group_sm_param_required">
-        <param name="SM" type="text" value="" label="Read group sample name (SM)" optional="false" help="This value should be descriptive. Use pool name where a pool is being sequenced">
+        <param name="SM" type="text" value="" label="Read group sample name (SM)" help="This value should be descriptive. Use pool name where a pool is being sequenced">
             <validator type="empty_field" />
         </param>
     </xml>
@@ -196,7 +199,7 @@
         </param>
     </xml>
     <xml name="read_group_lb_param">
-        <param name="LB" type="text" label="Library name (LB)" optional="true" />
+        <param name="LB" type="text" label="Library name (LB)"/>
     </xml>
     <xml name="read_group_lb_conditional">
         <conditional name="read_group_lb_conditional">
@@ -206,7 +209,7 @@
         </conditional>
     </xml>
     <xml name="read_group_lb_required_param">
-        <param name="LB" type="text" label="Library name (LB)" optional="false">
+        <param name="LB" type="text" label="Library name (LB)">
             <validator type="empty_field" />
         </param>
     </xml>
@@ -227,8 +230,8 @@
         <param name="DT" type="text" label="Date that run was produced (DT)" help="ISO8601 format date or date/time, like YYYY-MM-DD" />
     </xml>
     <xml name="read_group_fo_param">
-        <param name="FO" type="text" optional="true" label="Flow order (FO)" help="The array of nucleotide bases that correspond to the nucleotides used for each flow of each read. Multi-base flows are encoded in IUPAC format, and non-nucleotide flows by various other characters. Format: /\*|[ACMGRSVTWYHKDBN]+/">
-          <validator type="regex" message="Invalid flow order">\*|[ACMGRSVTWYHKDBN]+$</validator>
+        <param name="FO" type="text" label="Flow order (FO)" help="The array of nucleotide bases that correspond to the nucleotides used for each flow of each read. Multi-base flows are encoded in IUPAC format, and non-nucleotide flows by various other characters. Format: /\*|[ACMGRSVTWYHKDBN]+/">
+          <validator type="regex" message="Invalid flow order">|\*|[ACMGRSVTWYHKDBN]+$</validator>
         </param>
     </xml>
     <xml name="read_group_ks_param">
@@ -241,10 +244,10 @@
         <param name="PI" type="integer" optional="true" label="Predicted median insert size (PI)" />
     </xml>
     <xml name="read_group_pu_param">
-        <param name="PU" type="text" label="Platform unit (PU)" help="Unique identifier (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD)" optional="True" />
+        <param name="PU" type="text" label="Platform unit (PU)" help="Unique identifier (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD)" />
     </xml>
     <xml name="read_group_pu_required_param">
-        <param name="PU" type="text" label="Platform unit (PU)" help="Unique identifier (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD)" optional="False" />
+        <param name="PU" type="text" label="Platform unit (PU)" help="Unique identifier (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD)" />
     </xml>
     <!-- Only ID is required - all groups available -->
     <xml name="read_group_inputs_spec">
@@ -287,10 +290,8 @@
             <when value="set">
                 <expand macro="read_group_inputs_spec" />
             </when>
-            <when value="set_id_auto">
-            </when>
-            <when value="do_not_set">
-            </when>
+            <when value="set_id_auto"/>
+            <when value="do_not_set"/>
         </conditional>
     </xml>
     <xml name="paired_end_options">
@@ -310,11 +311,11 @@
                     <option value="--rf">--rf</option>
                     <option value="--ff">--ff</option>
                 </param>
-                <param argument="--no-mixed" name="no_mixed" type="boolean" truevalue="--no-mixed" falsevalue="" checked="False" label="Disable no-mixed behavior" help="--no-mixed; By default, when `bowtie2` cannot find a concordant or discordant alignment for a pair, it then tries to find alignments for the individual mates; default=False"/>
-                <param argument="--no-discordant" name="no_discordant" type="boolean" truevalue="--no-discordant" falsevalue="" checked="False" label="Disable no-discordant behavior" help="--no-discordant; By default, `bowtie2` looks for discordant alignments if it cannot find any concordant alignments. A discordant alignment is an alignment where both mates align uniquely, but that does not satisfy the paired-end constraints (`--fr`/`--rf`/`--ff`, `-I`, `-X`); default=False"/>
-                <param argument="--dovetail" name="dovetail" type="boolean" truevalue="--dovetail" falsevalue="" checked="False" label="Allow mate dovetailing" help="--dovetail; If the mates `dovetail`, that is if one mate alignment extends past the beginning of the other such that the wrong mate begins upstream, consider that to be concordant. Default=False"/>
-                <param argument="--no-contain" name="no_contain" type="boolean" truevalue="--no-contain" falsevalue="" checked="False" label="Disallow one mate alignment to contain another" help="--no-contain; If one mate alignment contains the other, consider that to be non-concordant. Default=False"/>
-                <param argument="--no-overlap" name="no_overlap" type="boolean" truevalue="--no-overlap" falsevalue="" checked="False" label="Disallow mate alignments to overlap" help="--no-overlap; If one mate alignment overlaps the other at all, consider that to be non-concordant. Default=False"/>
+                <param argument="--no-mixed" type="boolean" truevalue="--no-mixed" falsevalue="" checked="False" label="Disable no-mixed behavior" help="--no-mixed; By default, when `bowtie2` cannot find a concordant or discordant alignment for a pair, it then tries to find alignments for the individual mates; default=False"/>
+                <param argument="--no-discordant" type="boolean" truevalue="--no-discordant" falsevalue="" checked="False" label="Disable no-discordant behavior" help="--no-discordant; By default, `bowtie2` looks for discordant alignments if it cannot find any concordant alignments. A discordant alignment is an alignment where both mates align uniquely, but that does not satisfy the paired-end constraints (`--fr`/`--rf`/`--ff`, `-I`, `-X`); default=False"/>
+                <param argument="--dovetail" type="boolean" truevalue="--dovetail" falsevalue="" checked="False" label="Allow mate dovetailing" help="--dovetail; If the mates `dovetail`, that is if one mate alignment extends past the beginning of the other such that the wrong mate begins upstream, consider that to be concordant. Default=False"/>
+                <param argument="--no-contain" type="boolean" truevalue="--no-contain" falsevalue="" checked="False" label="Disallow one mate alignment to contain another" help="--no-contain; If one mate alignment contains the other, consider that to be non-concordant. Default=False"/>
+                <param argument="--no-overlap" type="boolean" truevalue="--no-overlap" falsevalue="" checked="False" label="Disallow mate alignments to overlap" help="--no-overlap; If one mate alignment overlaps the other at all, consider that to be non-concordant. Default=False"/>
             </when>
             <when value="no">
                 <!-- do nothing -->
--- a/bowtie2_wrapper.xml	Thu Nov 03 19:37:06 2022 +0000
+++ b/bowtie2_wrapper.xml	Wed Sep 24 13:36:57 2025 +0000
@@ -1,4 +1,4 @@
-<tool id="bowtie2" name="Bowtie2" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
+<tool id="bowtie2" name="Bowtie2" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
     <description>- map reads against reference genome</description>
     <macros>
         <import>bowtie2_macros.xml</import>
@@ -8,7 +8,7 @@
     </xrefs>
     <requirements>
         <requirement type="package" version="@TOOL_VERSION@">bowtie2</requirement>
-        <requirement type="package" version="1.16.1">samtools</requirement>
+        <requirement type="package" version="1.22.1">samtools</requirement>
     </requirements>
     <version_command>bowtie2 --version</version_command>
     <command detect_errors="exit_code"><![CDATA[
@@ -28,34 +28,7 @@
 
 #set compressed="False"
 #set reads_are_fastq = True
-#if str($library.type) == 'paired':
-    #if $library.input_1.is_of_type("fastq.gz", "fastqsanger.gz"):
-        #set read1 = "input_f.fastq.gz"
-        #set compressed = "GZ"
-    #else if $library.input_1.is_of_type("fastq.bz2", "fastqsanger.bz2"):
-        #set read1 = "input_f.fastq.bz2"
-        #set compressed = "BZ2"
-    #else if $library.input_1.is_of_type('fasta'):
-        #set reads_are_fastq = False
-        #set read1 = "input_f.fasta"
-    #else:
-        #set read1 = "input_f.fastq"
-    #end if
-    ln -f -s '${library.input_1}' ${read1} &&
-
-    #if $library.input_2.is_of_type("fastq.gz", "fastqsanger.gz"):
-        #set read2 = "input_r.fastq.gz"
-        #set compressed = "GZ"
-    #else if $library.input_2.is_of_type("fastq.bz2", "fastqsanger.bz2"):
-        #set read2 = "input_r.fastq.bz2"
-        #set compressed = "BZ2"
-    #else if $library.input_2.is_of_type('fasta'):
-        #set read2 = "input_r.fasta"
-    #else:
-        #set read2 = "input_r.fastq"
-    #end if
-    ln -f -s '${library.input_2}' ${read2} &&
-#else if str($library.type) == 'paired_collection':
+#if str($library.type) == 'paired_collection':
     #if $library.input_1.forward.is_of_type("fastq.gz", "fastqsanger.gz"):
         #set read1 = "input_f.fastq.gz"
         #set compressed = "GZ"
@@ -68,7 +41,7 @@
     #else:
         #set read1 = "input_f.fastq"
     #end if
-    ln -s '${library.input_1.forward}' ${read1} &&
+    ln -f -s '${library.input_1.forward}' ${read1} &&
 
     #if $library.input_1.reverse.is_of_type("fastq.gz", "fastqsanger.gz"):
         #set read2 = "input_r.fastq.gz"
@@ -81,22 +54,7 @@
     #else:
         #set read2 = "input_r.fastq"
     #end if
-    ln -s '${library.input_1.reverse}' ${read2} &&
-
-#else if str($library.type) == 'paired_interleaved':
-    #if $library.input_1.is_of_type("fastq.gz", "fastqsanger.gz"):
-        #set read1 = "input_il.fastq.gz"
-        #set compressed = "GZ"
-    #else if $library.input_1.is_of_type("fastq.bz2", "fastqsanger.bz2"):
-        #set read1 = "input_il.fastq.bz2"
-        #set compressed = "BZ2"
-    #else if $library.input_1.is_of_type("fasta"):
-        #set reads_are_fastq = False
-        #set read1 = "input_il.fasta"
-    #else:
-        #set read1 = "input_il.fastq"
-    #end if
-    ln -s '${library.input_1}' ${read1} &&
+    ln -f -s '${library.input_1.reverse}' ${read2} &&
 #else:
     #if $library.input_1.is_of_type("fastq.gz", "fastqsanger.gz"):
         #set read1 = "input_f.fastq.gz"
@@ -110,15 +68,25 @@
     #else:
         #set read1 = "input_f.fastq"
     #end if
-    ln -s '${library.input_1}' ${read1} &&
+    ln -f -s '${library.input_1}' ${read1} &&
 #end if
 
+
+## compute number of threads to be used for bowtie2
+## the bowtie parameter -p specifies the number of alignment threads to use (in
+## addition to a control thread) # just using GALAXY_SLOTS will lead to
+## overcommiting ressources (in particular because there may be a samtools sort or view
+## running in parallel). 
+## for now we use one thread less than GALAXY_SLOTS
+THREADS=\${GALAXY_SLOTS:-4} &&
+if [ "\$THREADS" -gt 1 ]; then (( THREADS-- )); fi &&
+
 ## execute bowtie2
 
 bowtie2
 
 ## number of threads
--p \${GALAXY_SLOTS:-4}
+-p "\$THREADS"
 
 ## index file path
 -x '$index_path'
@@ -133,62 +101,42 @@
     -U '${read1}'
     #if str( $library.unaligned_file ) == "true":
         #if $compressed == "GZ":
-            --un-gz '${output_unaligned_reads_l}'
+            --un-gz 'unaligned_reads'
         #else if $compressed == "BZ2":
-            --un-bz2 '${output_unaligned_reads_l}'
+            --un-bz2 'unaligned_reads'
         #else:
-            --un '${output_unaligned_reads_l}'
+            --un 'unaligned_reads'
         #end if
     #end if
     #if str( $library.aligned_file ) == "true":
         #if $compressed == "GZ":
-            --al-gz '${output_aligned_reads_l}'
+            --al-gz 'aligned_reads'
         #else if $compressed == "BZ2":
-            --al-bz2 '${output_aligned_reads_l}'
+            --al-bz2 'aligned_reads'
         #else:
-            --al '${output_aligned_reads_l}'
+            --al 'aligned_reads'
         #end if
     #end if
 
-#elif str( $library.type ) == "paired_interleaved":
-    --interleaved '${read1}'
-    #if str( $library.unaligned_file ) == "true":
-        #if $compressed == "GZ":
-            --un-gz '${output_unaligned_reads_l}'
-        #else if $compressed == "BZ2":
-            --un-bz2 '${output_unaligned_reads_l}'
-        #else:
-            --un '${output_unaligned_reads_l}'
-        #end if
-    #end if
-    #if str( $library.aligned_file ) == "true":
-        #if $compressed == "GZ":
-            --al-gz '${output_aligned_reads_l}'
-        #else if $compressed == "BZ2":
-            --al-bz2 '${output_aligned_reads_l}'
-        #else:
-            --al '${output_aligned_reads_l}'
-        #end if
-    #end if
 #else:
     -1 '${read1}'
     -2 '${read2}'
     #if str( $library.unaligned_file ) == "true":
         #if $compressed == "GZ":
-            --un-conc-gz '${output_unaligned_reads_l}'
+            --un-conc-gz 'unaligned_reads'
         #else if $compressed == "BZ2":
-            --un-conc-bz2 '${output_unaligned_reads_l}'
+            --un-conc-bz2 'unaligned_reads'
         #else:
-            --un-conc '${output_unaligned_reads_l}'
+            --un-conc 'unaligned_reads'
         #end if
     #end if
     #if str( $library.aligned_file ) == "true":
         #if $compressed == "GZ":
-            --al-conc-gz '${output_aligned_reads_l}'
+            --al-conc-gz 'aligned_reads'
         #else if $compressed == "BZ2":
-            --al-conc-bz2 '${output_aligned_reads_l}'
+            --al-conc-bz2 'aligned_reads'
         #else:
-            --al-conc '${output_aligned_reads_l}'
+            --al-conc 'aligned_reads'
         #end if
     #end if
     #if str( $library.paired_options.paired_options_selector ) == "yes":
@@ -207,8 +155,6 @@
 @define_read_group_helpers@
 #if str( $library.type ) == "single":
     #set $rg_auto_name = $read_group_name_default($library.input_1)
-#elif str( $library.type ) == "paired":
-    #set $rg_auto_name = $read_group_name_default($library.input_1, $library.input_2)
 #else
     #set $rg_auto_name = $read_group_name_default($library.input_1)
 #end if
@@ -303,63 +249,43 @@
 
 ## mapping stats (i.e. stderr from bowtie2)
 #if $save_mapping_stats
-    2> '$mapping_stats'
+    2> >(tee '$mapping_stats' >&2) 
 #end if
 
 ## output file
 #if str( $sam_options.sam_options_selector ) == "no" or (str( $sam_options.sam_opt ) == "false" and str($sam_options.reorder) == ''):
-    | samtools sort --no-PG -@\${GALAXY_SLOTS:-2} -T "\${TMPDIR:-.}" -O bam -o '$output'
+    ## Convert SAM output to sorted BAM
+    ## using the two pipe stages has the following effect
+    ## - mapping and sorting run in parallel, during this time sort produces
+    ##   presorted temporary files but does not produce output (hence
+    ##   view does not run)
+    ## - once mapping is finished sort will start to merge the temporary
+    ##   files (which should be fast also on a single thread) gives the
+    ##   sorted output to view which only compresses the files (now
+    ##   using full parallelism again)
+    | samtools sort -l 0 -T "\${TMPDIR:-.}" -O bam | samtools view --no-PG -O bam -@ \${GALAXY_SLOTS:-1} -o '$output'
 #else if $sam_options.reorder:
-    | samtools view --no-PG -bS - -o '$output'
+    | samtools view --no-PG -b -o '$output' 
 #else:
     > '$output'
 #end if
-
-## rename unaligned sequence files
-#if ($library.type == "paired" or $library.type == "paired_collection") and $output_unaligned_reads_l and $output_unaligned_reads_r:
-    #from os.path import splitext
-    #set _unaligned_root, _unaligned_ext = splitext( str( $output_unaligned_reads_l ) )
-    && mv '${ _unaligned_root }.1${_unaligned_ext}' '$output_unaligned_reads_l'
-    && mv '${ _unaligned_root }.2${_unaligned_ext}' '$output_unaligned_reads_r'
-#end if
-#if ($library.type == "paired" or $library.type == "paired_collection") and $output_aligned_reads_l and $output_aligned_reads_r:
-    #from os.path import splitext
-    #set _aligned_root, _aligned_ext = splitext( str( $output_aligned_reads_l ) )
-    && mv '${ _aligned_root }.1${_aligned_ext}' '$output_aligned_reads_l'
-    && mv '${ _aligned_root }.2${_aligned_ext}' '$output_aligned_reads_r'
-#end if
-
         ]]></command>
     <inputs>
         <!-- single/paired -->
         <conditional name="library">
             <param name="type" type="select" label="Is this single or paired library">
               <option value="single">Single-end</option>
-              <option value="paired">Paired-end</option>
-              <option value="paired_collection">Paired-end Dataset Collection</option>
-              <option value="paired_interleaved">Paired-end data from single interleaved dataset</option>
+              <option value="paired_collection">Paired-end</option>
             </param>
-
             <when value="single">
                 <param name="input_1" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data" label="FASTA/Q file" help="Must be of datatype &quot;fastqsanger&quot; or &quot;fasta&quot;" />
                 <expand macro="align_unalign" />
             </when>
-            <when value="paired">
-                <param name="input_1" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data" label="FASTA/Q file #1" help="Must be of datatype &quot;fastqsanger&quot;or &quot;fasta&quot;" />
-                <param name="input_2" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data" label="FASTA/Q file #2" help="Must be of datatype &quot;fastqsanger&quot;or &quot;fasta&quot;" />
-                <expand macro="align_unalign" />
-                <expand macro="paired_end_options" />
-            </when>
             <when value="paired_collection">
                 <param name="input_1" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data_collection" collection_type="paired" label="FASTQ Paired Dataset" help="Must be of datatype &quot;fastqsanger&quot; or &quot;fasta&quot;" />
                 <expand macro="align_unalign" />
                 <expand macro="paired_end_options" />
             </when>
-            <when value="paired_interleaved">
-                <param name="input_1" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data" label="Interleaved FASTQ file" help="Must be of datatype &quot;fastqsanger&quot; or &quot;fasta&quot;. --interleaved"/>
-                <expand macro="align_unalign" />
-                <expand macro="paired_end_options" />
-            </when>
         </conditional>
         <!-- reference genome -->
         <conditional name="reference_genome">
@@ -523,12 +449,12 @@
             </param>
             <when value="yes">
                 <param name="sam_opt" type="boolean" truevalue="true" falsevalue="false" label="Would you like the output to be a SAM file" help="By default, the output from this Bowtie2 wrapper is a sorted BAM file."/>
-                <param name="no_unal" type="boolean" truevalue="--no-unal" falsevalue="" label="Suppress SAM records for reads that failed to align" help="--no-unal; Default=False"/>
-                <param name="omit_sec_seq" type="boolean" truevalue="--omit-sec-seq" falsevalue="" label="Suppress SEQ and QUAL strings for secondary alignments" help="--omit-sec-seq; Default=False"/>
-                <param name="sam_no_qname_trunc" argument="--sam-no-qname-trunc" type="boolean" truevalue="--sam-no-qname-trunc" falsevalue="" label="Suppress standard behavior of truncating readname at first whitespace at the expense of generating non-standard SAM"/>
+                <param argument="--no-unal" type="boolean" truevalue="--no-unal" falsevalue="" label="Suppress SAM records for reads that failed to align" help="--no-unal; Default=False"/>
+                <param argument="--omit-sec-seq" type="boolean" truevalue="--omit-sec-seq" falsevalue="" label="Suppress SEQ and QUAL strings for secondary alignments" help="--omit-sec-seq; Default=False"/>
+                <param argument="--sam-no-qname-trunc" type="boolean" truevalue="--sam-no-qname-trunc" falsevalue="" label="Suppress standard behavior of truncating readname at first whitespace at the expense of generating non-standard SAM"/>
                 <param argument="--xeq" type="boolean" truevalue="--xeq" falsevalue="" label="Use '='/'X', instead of 'M,' to specify matches/mismatches in SAM record."/>
-                <param name="soft_clipped_unmapped_tlen" argument="--soft-clipped-unmapped-tlen" type="boolean" truevalue="--soft-clipped-unmapped-tlen" falsevalue="" label=" Exclude soft-clipped bases when reporting TLEN"/>
-                <param name="reorder" argument="--reorder" type="boolean" truevalue="--reorder" falsevalue=""
+                <param argument="--soft-clipped-unmapped-tlen" type="boolean" truevalue="--soft-clipped-unmapped-tlen" falsevalue="" label=" Exclude soft-clipped bases when reporting TLEN"/>
+                <param argument="--reorder" type="boolean" truevalue="--reorder" falsevalue=""
                     label="Reorder output to reflect order of the input file"
                     help="Reorder guarantees that output SAM records are printed in an order corresponding to the order of the reads in the original input file, even when -p is set greater than 1." />
             </when>
@@ -538,89 +464,47 @@
     </inputs>
     <!-- define outputs -->
     <outputs>
-        <data format="fastqsanger" name="output_unaligned_reads_l" label="${tool.name} on ${on_string}: unaligned reads (L)" >
-            <filter>library['unaligned_file'] is True</filter>
+        <data name="output_unaligned_reads" format_source="library|input_1" from_work_dir="unaligned_reads" label="${tool.name} on ${on_string}: unaligned reads" >
+            <filter>library['type'] == 'single' and library['unaligned_file'] is True</filter>
             <actions>
-                <conditional name="library.type">
-                    <when value="single">
-                        <action type="format">
-                            <option type="from_param" name="library.input_1" param_attribute="ext" />
-                        </action>
-                    </when>
-                    <when value="paired">
-                        <action type="format">
-                            <option type="from_param" name="library.input_1" param_attribute="ext" />
-                        </action>
-                    </when>
-                    <when value="paired_collection">
-                        <action type="format">
-                            <option type="from_param" name="library.input_1" param_attribute="forward.ext" />
-                        </action>
-                    </when>
-                </conditional>
                 <expand macro="dbKeyActions" />
             </actions>
         </data>
-        <data format="fastqsanger" name="output_aligned_reads_l" label="${tool.name} on ${on_string}: aligned reads (L)" >
-            <filter>library['aligned_file'] is True</filter>
+        <collection name="output_unaligned_read_pairs" type="paired" label="${tool.name} on ${on_string}: unaligned read pairs">
+            <filter>library['type'] != 'single' and library['unaligned_file'] is True</filter>
+            <data name="forward" from_work_dir="unaligned_reads.1" format_source="library|input_1['forward']">
+                <actions>
+                    <expand macro="dbKeyActions" />
+                </actions>
+            </data>
+            <data name="reverse" from_work_dir="unaligned_reads.2" format_source="library|input_1['reverse']">
+                <actions>
+                    <expand macro="dbKeyActions" />
+                </actions>
+            </data>
+        </collection>
+
+        <data name="output_aligned_reads" format_source="library|input_1" from_work_dir="aligned_reads" label="${tool.name} on ${on_string}: aligned reads" >
+            <filter>library['type'] == 'single' and library['aligned_file'] is True</filter>
             <actions>
-                <conditional name="library.type">
-                    <when value="single">
-                        <action type="format">
-                            <option type="from_param" name="library.input_1" param_attribute="ext" />
-                        </action>
-                    </when>
-                    <when value="paired">
-                        <action type="format">
-                            <option type="from_param" name="library.input_1" param_attribute="ext" />
-                        </action>
-                    </when>
-                    <when value="paired_collection">
-                        <action type="format">
-                            <option type="from_param" name="library.input_1" param_attribute="forward.ext" />
-                        </action>
-                    </when>
-                </conditional>
                 <expand macro="dbKeyActions" />
             </actions>
         </data>
-        <data format="fastqsanger" name="output_aligned_reads_r" label="${tool.name} on ${on_string}: aligned reads (R)">
-            <filter>( library['type'] == "paired" or library['type'] == "paired_collection" ) and library['aligned_file'] is True</filter>
-            <actions>
-                <conditional name="library.type">
-                    <when value="paired">
-                        <action type="format">
-                            <option type="from_param" name="library.input_2" param_attribute="ext" />
-                        </action>
-                    </when>
-                    <when value="paired_collection">
-                        <action type="format">
-                            <option type="from_param" name="library.input_1" param_attribute="reverse.ext" />
-                        </action>
-                    </when>
-                </conditional>
-                <expand macro="dbKeyActions" />
-            </actions>
-        </data>
-        <data format="fastqsanger" name="output_unaligned_reads_r" label="${tool.name} on ${on_string}: unaligned reads (R)">
-            <filter>( library['type'] == "paired" or library['type'] == "paired_collection" ) and library['unaligned_file'] is True</filter>
-            <actions>
-                <conditional name="library.type">
-                    <when value="paired">
-                        <action type="format">
-                            <option type="from_param" name="library.input_2" param_attribute="ext" />
-                        </action>
-                    </when>
-                    <when value="paired_collection">
-                        <action type="format">
-                            <option type="from_param" name="library.input_1" param_attribute="reverse.ext" />
-                        </action>
-                    </when>
-                </conditional>
-                <expand macro="dbKeyActions" />
-            </actions>
-        </data>
-        <data format="bam" name="output" label="${tool.name} on ${on_string}: alignments">
+        <collection name="output_aligned_read_pairs" type="paired" label="${tool.name} on ${on_string}: aligned read pairs">
+            <filter>library['type'] != 'single' and library['aligned_file'] is True</filter>
+            <data name="forward" from_work_dir="aligned_reads.1" format_source="library|input_1['forward']">
+                <actions>
+                    <expand macro="dbKeyActions" />
+                </actions>
+            </data>
+            <data name="reverse" from_work_dir="aligned_reads.2" format_source="library|input_1['forward']">
+                <actions>
+                    <expand macro="dbKeyActions" />
+                </actions>
+            </data>
+        </collection>
+
+        <data name="output" format="bam" label="${tool.name} on ${on_string}: alignments">
           <change_format>
               <when input="sam_options.reorder" value="--reorder" format="qname_input_sorted.bam" />
               <when input="sam_options.sam_opt" value="true" format="sam" />
@@ -652,65 +536,157 @@
         </data>
     </outputs>
     <tests>
+        <!-- test on single-end datasets -->
+        <test expect_num_outputs="2">
+            <conditional name="library">
+                <param name="type" value="single"/>
+                <param name="unaligned_file" value="true"/>
+                <param name="input_1" value="bowtie2-fq1.fq" ftype="fastqsanger" />
+            </conditional>
+            <conditional name="reference_genome">
+                <param name="source" value="history" />
+                <param name="own_file" value="bowtie2-ref.fasta" />
+            </conditional>
+            <conditional name="analysis_type">
+                <param name="analysis_type_selector" value="simple"/>
+            </conditional>
+            <output name="output_unaligned_reads" ftype="fastqsanger">
+                <assert_contents>
+                    <has_n_lines n="312"/>
+                </assert_contents>
+            </output>
+            <output name="output" file="bowtie2-single.bam" ftype="bam" lines_diff="4" sort="true">
+                <metadata name="sort_order" value="coordinate"/>
+            </output>
+        </test>
+        <!-- test on paired-end datasets -->
         <test expect_num_outputs="1">
-            <!-- test on paired-end datasets -->
-            <param name="type" value="paired"/>
-            <param name="paired_options_selector" value="no"/>
-            <param name="unaligned_file" value="false"/>
-            <param name="analysis_type_selector" value="simple"/>
-            <param name="source" value="history" />
-            <param name="input_1" value="bowtie2-fq1.fq" ftype="fastqsanger"/>
-            <param name="input_2" value="bowtie2-fq2.fq" ftype="fastqsanger"/>
-            <param name="own_file" value="bowtie2-ref.fasta" />
+            <conditional name="library">
+                <param name="type" value="paired_collection"/>
+                <conditional name="paired_options">
+                    <param name="paired_options_selector" value="no"/>
+                </conditional>
+                <param name="unaligned_file" value="false"/>
+                <param name="input_1">
+                    <collection type="paired">
+                        <element name="forward" value="bowtie2-fq1.fq" ftype="fastqsanger" />
+                        <element name="reverse" value="bowtie2-fq2.fq" ftype="fastqsanger" />
+                    </collection>
+                </param>
+            </conditional>
+            <conditional name="reference_genome">
+                <param name="source" value="history" />
+                <param name="own_file" value="bowtie2-ref.fasta" />
+            </conditional>
+            <conditional name="analysis_type">
+                <param name="analysis_type_selector" value="simple"/>
+            </conditional>
             <output name="output" file="bowtie2-test1.bam" ftype="bam" lines_diff="4" sort="true">
                 <metadata name="sort_order" value="coordinate"/>
             </output>
         </test>
-        <test expect_num_outputs="3">
-            <!-- test on list paired collection -->
-            <param name="type" value="paired_collection"/>
-            <param name="paired_options_selector" value="no"/>
-            <param name="unaligned_file" value="true"/>
-            <param name="analysis_type_selector" value="simple"/>
-            <param name="source" value="history" />
-            <param name="input_1">
-                <collection type="paired">
-                    <element name="forward" value="bowtie2-fq1.fq" ftype="fastqsanger" />
-                    <element name="reverse" value="bowtie2-fq2.fq" ftype="fastqsanger" />
-                </collection>
-            </param>
-            <param name="own_file" value="bowtie2-ref.fasta" />
+        <!-- test on paired-end datasets + unaligned output -->
+        <test expect_num_outputs="4">
+            <conditional name="library">
+                <param name="type" value="paired_collection"/>
+                <conditional name="paired_options">
+                    <param name="paired_options_selector" value="no"/>
+                </conditional>
+                <param name="unaligned_file" value="true"/>
+                <param name="input_1">
+                    <collection type="paired">
+                        <element name="forward" value="bowtie2-fq1.fq" ftype="fastqsanger" />
+                        <element name="reverse" value="bowtie2-fq2.fq" ftype="fastqsanger" />
+                    </collection>
+                </param>
+            </conditional>
+            <conditional name="reference_genome">
+                <param name="source" value="history" />
+                <param name="own_file" value="bowtie2-ref.fasta" />
+            </conditional>
+            <conditional name="analysis_type">
+                <param name="analysis_type_selector" value="simple"/>
+            </conditional>
+            <output_collection name="output_unaligned_read_pairs" type="paired">
+                <element name="forward" ftype="fastqsanger">
+                    <assert_contents>
+                        <has_n_lines n="388"/>
+                    </assert_contents>
+                </element>
+                <element name="reverse" ftype="fastqsanger">
+                    <assert_contents>
+                        <has_n_lines n="388"/>
+                    </assert_contents>
+                </element>
+            </output_collection>
             <output name="output" file="bowtie2-test1.bam" ftype="bam" lines_diff="4" sort="true">
                 <metadata name="sort_order" value="coordinate"/>
             </output>
         </test>
         <test expect_num_outputs="1">
             <!-- test on paired-end datasets with read group info -->
-            <param name="type" value="paired"/>
-            <param name="paired_options_selector" value="no"/>
-            <param name="unaligned_file" value="false"/>
-            <param name="analysis_type_selector" value="simple"/>
-            <param name="rg_selector" value="set"/>
-            <param name="ID" value="rg1"/>
-            <param name="PL" value="CAPILLARY"/>
-            <param name="source" value="history" />
-            <param name="input_1" value="bowtie2-fq1.fq" ftype="fastqsanger"/>
-            <param name="input_2" value="bowtie2-fq2.fq" ftype="fastqsanger"/>
-            <param name="own_file" value="bowtie2-ref.fasta" />
-            <output name="output" file="bowtie2-test2.bam" ftype="bam" lines_diff="4" sort="true">
-                <metadata name="sort_order" value="coordinate"/>
+            <conditional name="library">
+                <param name="type" value="paired_collection"/>
+                <conditional name="paired_options">
+                    <param name="paired_options_selector" value="no"/>
+                </conditional>
+                <param name="unaligned_file" value="false"/>
+                <param name="input_1">
+                    <collection type="paired">
+                        <element name="forward" value="bowtie2-fq1.fq" ftype="fastqsanger" />
+                        <element name="reverse" value="bowtie2-fq2.fq" ftype="fastqsanger" />
+                    </collection>
+                </param>
+            </conditional>
+            <conditional name="reference_genome">
+                <param name="source" value="history" />
+                <param name="own_file" value="bowtie2-ref.fasta" />
+            </conditional>
+            <conditional name="analysis_type">
+                <param name="analysis_type_selector" value="simple"/>
+            </conditional>
+            <conditional name="sam_options">
+                <param name="sam_options_selector" value="yes" />
+                <param name="sam_opt" value="true" />
+            </conditional>
+            <conditional name="rg">
+                <param name="rg_selector" value="set"/>
+                <conditional name="read_group_id_conditional">
+                    <param name="do_auto_name" value="no"/>
+                    <param name="ID" value="rg1"/>
+                </conditional>
+                <param name="PL" value="CAPILLARY"/>
+            </conditional>
+            <output name="output" ftype="sam" lines_diff="4" sort="true">
+                <metadata name="sort_order" value="unsorted"/>
+                <assert_contents>
+                    <has_line line="@RG&#009;ID:rg1&#009;PL:CAPILLARY"/>
+                    <has_text text="RG:Z:rg1" n="200"/>
+                </assert_contents>
             </output>
         </test>
+        <!-- test on paired-end datasets with stats output -->
         <test expect_num_outputs="2">
-            <!-- test on paired-end datasets with stats output -->
-            <param name="type" value="paired"/>
-            <param name="paired_options_selector" value="no"/>
-            <param name="unaligned_file" value="false"/>
-            <param name="analysis_type_selector" value="simple"/>
-            <param name="source" value="history" />
-            <param name="input_1" value="bowtie2-fq1.fq" ftype="fastqsanger"/>
-            <param name="input_2" value="bowtie2-fq2.fq" ftype="fastqsanger"/>
-            <param name="own_file" value="bowtie2-ref.fasta" />
+            <conditional name="library">
+                <param name="type" value="paired_collection"/>
+                <conditional name="paired_options">
+                    <param name="paired_options_selector" value="no"/>
+                </conditional>
+                <param name="unaligned_file" value="false"/>
+                <param name="input_1">
+                    <collection type="paired">
+                        <element name="forward" value="bowtie2-fq1.fq" ftype="fastqsanger" />
+                        <element name="reverse" value="bowtie2-fq2.fq" ftype="fastqsanger" />
+                    </collection>
+                </param>
+            </conditional>
+            <conditional name="reference_genome">
+                <param name="source" value="history" />
+                <param name="own_file" value="bowtie2-ref.fasta" />
+            </conditional>
+            <conditional name="analysis_type">
+                <param name="analysis_type_selector" value="simple"/>
+            </conditional>
             <param name="save_mapping_stats" value="true" />
             <output name="output" file="bowtie2-test1.bam" ftype="bam" lines_diff="4" sort="true">
                 <metadata name="sort_order" value="coordinate"/>
@@ -721,92 +697,191 @@
                 </assert_contents>
             </output>
         </test>
-        <test expect_num_outputs="1">
-            <!-- test on interleaved dataset -->
-            <param name="type" value="paired_interleaved"/>
-            <!-- <param name="paired_options_selector" value="no"/> -->
-            <param name="unaligned_file" value="false"/>
-            <param name="analysis_type_selector" value="simple"/>
-            <param name="rg_selector" value="set"/>
-            <param name="ID" value="rg1"/>
-            <param name="PL" value="CAPILLARY"/>
-            <param name="source" value="history" />
-            <param name="input_1" value="bowtie2-fq_il.fq" ftype="fastqsanger"/>
-            <param name="own_file" value="bowtie2-ref.fasta" />
-            <output name="output" file="bowtie2-test_il.bam" ftype="bam" lines_diff="4" sort="true">
+        <!-- test on fastqsanger.gz paired-end datasets plus reference from data table -->
+        <test expect_num_outputs="4">
+            <conditional name="library">
+                <param name="type" value="paired_collection"/>
+                <conditional name="paired_options">
+                    <param name="paired_options_selector" value="no"/>
+                </conditional>
+                <param name="unaligned_file" value="true"/>
+                <param name="input_1">
+                    <collection type="paired">
+                        <element name="forward" value="bowtie2-fq1.fq.gz" ftype="fastqsanger.gz" />
+                        <element name="reverse" value="bowtie2-fq2.fq.gz" ftype="fastqsanger.gz" />
+                    </collection>
+                </param>
+            </conditional>
+            <conditional name="analysis_type">
+                <param name="analysis_type_selector" value="simple"/>
+            </conditional>
+            <conditional name="reference_genome">
+                <param name="source" value="indexed" />
+                <param name="index" value="test_value" />
+            </conditional>
+            <output name="output" file="bowtie2-test1.bam" ftype="bam" lines_diff="4" sort="true">
                 <metadata name="sort_order" value="coordinate"/>
             </output>
+            <output_collection name="output_unaligned_read_pairs" type="paired">
+                <element name="forward" ftype="fastqsanger.gz" decompress="true">
+                    <assert_contents>
+                        <has_n_lines n="388"/>
+                    </assert_contents>
+                </element>
+                <element name="reverse" ftype="fastqsanger.gz" decompress="true">
+                    <assert_contents>
+                        <has_n_lines n="388"/>
+                    </assert_contents>
+                </element>
+            </output_collection>
         </test>
-        <test expect_num_outputs="1">
-            <!-- test on fastqsanger.gz paired-end datasets -->
-            <param name="type" value="paired"/>
-            <param name="paired_options_selector" value="no"/>
-            <param name="unaligned_file" value="false"/>
-            <param name="analysis_type_selector" value="simple"/>
-            <param name="source" value="history" />
-            <param name="input_1" value="bowtie2-fq1.fq.gz" ftype="fastqsanger.gz"/>
-            <param name="input_2" value="bowtie2-fq2.fq.gz" ftype="fastqsanger.gz"/>
-            <param name="own_file" value="bowtie2-ref.fasta" />
+        <!-- test on fastqsanger.bz2 paired-end datasets -->
+        <test expect_num_outputs="4">
+            <conditional name="library">
+                <param name="type" value="paired_collection"/>
+                <conditional name="paired_options">
+                    <param name="paired_options_selector" value="no"/>
+                </conditional>
+                <param name="aligned_file" value="true"/>
+                <param name="input_1">
+                    <collection type="paired">
+                        <element name="forward" value="bowtie2-fq1.fq.bz2" ftype="fastqsanger.bz2" />
+                        <element name="reverse" value="bowtie2-fq2.fq.bz2" ftype="fastqsanger.bz2" />
+                    </collection>
+                </param>
+            </conditional>
+            <conditional name="reference_genome">
+                <param name="source" value="history" />
+                <param name="own_file" value="bowtie2-ref.fasta" />
+            </conditional>
+            <conditional name="analysis_type">
+                <param name="analysis_type_selector" value="simple"/>
+            </conditional>
             <output name="output" file="bowtie2-test1.bam" ftype="bam" lines_diff="4" sort="true">
                 <metadata name="sort_order" value="coordinate"/>
             </output>
+            <output_collection name="output_aligned_read_pairs" type="paired">
+                <element name="forward" ftype="fastqsanger.bz2" decompress="true">
+                    <assert_contents>
+                        <has_n_lines n="12"/>
+                    </assert_contents>
+                </element>
+                <element name="reverse" ftype="fastqsanger.bz2" decompress="true">
+                    <assert_contents>
+                        <has_n_lines n="12"/>
+                    </assert_contents>
+                </element>
+            </output_collection>
         </test>
-        <test expect_num_outputs="1">
-            <!-- test on fastqsanger.bz2 paired-end datasets -->
-            <param name="type" value="paired"/>
-            <param name="paired_options_selector" value="no"/>
-            <param name="unaligned_file" value="false"/>
-            <param name="analysis_type_selector" value="simple"/>
-            <param name="source" value="history" />
-            <param name="input_1" value="bowtie2-fq1.fq.bz2" ftype="fastqsanger.bz2"/>
-            <param name="input_2" value="bowtie2-fq2.fq.bz2" ftype="fastqsanger.bz2"/>
-            <param name="own_file" value="bowtie2-ref.fasta" />
-            <output name="output" file="bowtie2-test1.bam" ftype="bam" lines_diff="4" sort="true">
-                <metadata name="sort_order" value="coordinate"/>
-            </output>
-        </test>
-        <test expect_num_outputs="1">
-            <!-- test on fasta paired-end datasets -->
-            <param name="type" value="paired"/>
-            <param name="paired_options_selector" value="no"/>
-            <param name="unaligned_file" value="false"/>
-            <param name="analysis_type_selector" value="simple"/>
-            <param name="source" value="history" />
-            <param name="input_1" value="bowtie2-fq1.fa" ftype="fasta"/>
-            <param name="input_2" value="bowtie2-fq2.fa" ftype="fasta"/>
-            <param name="own_file" value="bowtie2-ref.fasta" />
+        <!-- test on fasta paired-end datasets + aligned + unaligned -->
+        <test expect_num_outputs="7">
+            <conditional name="library">
+                <param name="type" value="paired_collection"/>
+                <conditional name="paired_options">
+                    <param name="paired_options_selector" value="no"/>
+                </conditional>
+                <param name="unaligned_file" value="true"/>
+                <param name="aligned_file" value="true"/>
+                <param name="input_1">
+                    <collection type="paired">
+                        <element name="forward" value="bowtie2-fq1.fa" ftype="fasta" />
+                        <element name="reverse" value="bowtie2-fq2.fa" ftype="fasta" />
+                    </collection>
+                </param>
+            </conditional>
+            <conditional name="reference_genome">
+                <param name="source" value="history" />
+                <param name="own_file" value="bowtie2-ref.fasta" />
+            </conditional>
+            <conditional name="analysis_type">
+                <param name="analysis_type_selector" value="simple"/>
+            </conditional>
+
+            <output_collection name="output_unaligned_read_pairs" type="paired">
+                <element name="forward" ftype="fasta" decompress="true">
+                    <assert_contents>
+                        <has_n_lines n="194"/>
+                    </assert_contents>
+                </element>
+                <element name="reverse" ftype="fasta" decompress="true">
+                    <assert_contents>
+                        <has_n_lines n="194"/>
+                    </assert_contents>
+                </element>
+            </output_collection>
+            <output_collection name="output_aligned_read_pairs" type="paired">
+                <element name="forward" ftype="fasta" decompress="true">
+                    <assert_contents>
+                        <has_n_lines n="6"/>
+                    </assert_contents>
+                </element>
+                <element name="reverse" ftype="fasta" decompress="true">
+                    <assert_contents>
+                        <has_n_lines n="6"/>
+                    </assert_contents>
+                </element>
+            </output_collection>
+
             <output name="output" file="bowtie2-test_fasta_in.bam" ftype="bam" lines_diff="4" sort="true">
                 <metadata name="sort_order" value="coordinate"/>
             </output>
         </test>
+        <!-- test on fasta paired-end datasets with bam_native as output -->
         <test expect_num_outputs="1">
-            <!-- test on fasta paired-end datasets with bam_native as output -->
-            <param name="type" value="paired"/>
-            <param name="paired_options_selector" value="no"/>
-            <param name="unaligned_file" value="false"/>
-            <param name="analysis_type_selector" value="simple"/>
-            <param name="source" value="history" />
-            <param name="input_1" value="bowtie2-fq1.fa" ftype="fasta"/>
-            <param name="input_2" value="bowtie2-fq2.fa" ftype="fasta"/>
-            <param name="own_file" value="bowtie2-ref.fasta" />
-            <param name="sam_options_selector" value="yes" />
-            <param name="reorder" value="true" />
+            <conditional name="library">
+                <param name="type" value="paired_collection"/>
+                <conditional name="paired_options">
+                    <param name="paired_options_selector" value="no"/>
+                </conditional>
+                <param name="unaligned_file" value="false"/>
+                <param name="input_1">
+                    <collection type="paired">
+                        <element name="forward" value="bowtie2-fq1.fa" ftype="fasta" />
+                        <element name="reverse" value="bowtie2-fq2.fa" ftype="fasta" />
+                    </collection>
+                </param>
+            </conditional>
+            <conditional name="analysis_type">
+                <param name="analysis_type_selector" value="simple"/>
+            </conditional>
+            <conditional name="reference_genome">
+                <param name="source" value="history" />
+                <param name="own_file" value="bowtie2-ref.fasta" />
+            </conditional>
+            <conditional name="sam_options">
+                <param name="sam_options_selector" value="yes" />
+                <param name="reorder" value="true" />
+            </conditional>
             <output name="output" file="bowtie2-test_fasta_in_bam_qname_input_sorted.bam" ftype="qname_input_sorted.bam" lines_diff="4">
                 <metadata name="sort_order" value="unsorted"/>
             </output>
         </test>
+        <!-- test on fasta paired-end datasets with sam as output -->
         <test expect_num_outputs="1">
-            <!-- test on fasta paired-end datasets with sam as output -->
-            <param name="type" value="paired"/>
-            <param name="paired_options_selector" value="no"/>
-            <param name="unaligned_file" value="false"/>
-            <param name="analysis_type_selector" value="simple"/>
-            <param name="source" value="history" />
-            <param name="input_1" value="bowtie2-fq1.fa" ftype="fasta"/>
-            <param name="input_2" value="bowtie2-fq2.fa" ftype="fasta"/>
-            <param name="own_file" value="bowtie2-ref.fasta" />
-            <param name="sam_options_selector" value="yes" />
-            <param name="sam_options|sam_opt" value="true" />
+            <conditional name="library">
+                <param name="type" value="paired_collection"/>
+                <conditional name="paired_options">
+                    <param name="paired_options_selector" value="no"/>
+                </conditional>
+                <param name="unaligned_file" value="false"/>
+                <param name="input_1">
+                    <collection type="paired">
+                        <element name="forward" value="bowtie2-fq1.fa" ftype="fasta" />
+                        <element name="reverse" value="bowtie2-fq2.fa" ftype="fasta" />
+                    </collection>
+                </param>
+            </conditional>
+            <conditional name="analysis_type">
+                <param name="analysis_type_selector" value="simple"/>
+            </conditional>
+            <conditional name="reference_genome">
+                <param name="source" value="history" />
+                <param name="own_file" value="bowtie2-ref.fasta" />
+            </conditional>
+            <conditional name="sam_options">
+                <param name="sam_options_selector" value="yes" />
+                <param name="sam_opt" value="true" />
+            </conditional>
             <output name="output" ftype="sam">
                 <metadata name="sort_order" value="unsorted"/>
                 <assert_contents>
Binary file test-data/bowtie2-ref.1.bt2 has changed
Binary file test-data/bowtie2-ref.2.bt2 has changed
Binary file test-data/bowtie2-ref.3.bt2 has changed
Binary file test-data/bowtie2-ref.4.bt2 has changed
Binary file test-data/bowtie2-ref.rev.1.bt2 has changed
Binary file test-data/bowtie2-ref.rev.2.bt2 has changed
Binary file test-data/bowtie2-single.bam has changed
Binary file test-data/bowtie2-test1.bam has changed
Binary file test-data/bowtie2-test2.bam has changed
Binary file test-data/bowtie2-test_fasta_in.bam has changed
Binary file test-data/bowtie2-test_fasta_in_bam_qname_input_sorted.bam has changed
Binary file test-data/bowtie2-test_il.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/bowtie2_indices.loc	Wed Sep 24 13:36:57 2025 +0000
@@ -0,0 +1,38 @@
+# bowtie2_indices.loc.sample
+# This is a *.loc.sample file distributed with Galaxy that enables tools
+# to use a directory of indexed data files. This one is for Bowtie2 and Tophat2.
+# See the wiki: http://wiki.galaxyproject.org/Admin/NGS%20Local%20Setup
+# First create these data files and save them in your own data directory structure.
+# Then, create a bowtie_indices.loc file to use those indexes with tools.
+# Copy this file, save it with the same name (minus the .sample), 
+# follow the format examples, and store the result in this directory.
+# The file should include an one line entry for each index set.
+# The path points to the "basename" for the set, not a specific file.
+# It has four text columns seperated by TABS.
+#
+# <unique_build_id>	<dbkey>	<display_name>	<file_base_path>
+#
+# So, for example, if you had hg18 indexes stored in:
+#
+#    /depot/data2/galaxy/hg19/bowtie2/
+#
+# containing hg19 genome and hg19.*.bt2 files, such as:
+#    -rw-rw-r-- 1 james   james   914M Feb 10 18:56 hg19canon.fa
+#    -rw-rw-r-- 1 james   james   914M Feb 10 18:56 hg19canon.1.bt2
+#    -rw-rw-r-- 1 james   james   683M Feb 10 18:56 hg19canon.2.bt2
+#    -rw-rw-r-- 1 james   james   3.3K Feb 10 16:54 hg19canon.3.bt2
+#    -rw-rw-r-- 1 james   james   683M Feb 10 16:54 hg19canon.4.bt2
+#    -rw-rw-r-- 1 james   james   914M Feb 10 20:45 hg19canon.rev.1.bt2
+#    -rw-rw-r-- 1 james   james   683M Feb 10 20:45 hg19canon.rev.2.bt2
+#
+# then the bowtie2_indices.loc entry could look like this:
+#
+#hg19	hg19	Human (hg19)	/depot/data2/galaxy/hg19/bowtie2/hg19canon
+#
+#More examples:
+#
+#mm10	mm10	Mouse (mm10)	/depot/data2/galaxy/mm10/bowtie2/mm10
+#dm3	dm3		D. melanogaster (dm3)	/depot/data2/galaxy/mm10/bowtie2/dm3
+#
+#
+test_value	test_dbkey	test_name	${__HERE__}/bowtie2-ref
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.test	Wed Sep 24 13:36:57 2025 +0000
@@ -0,0 +1,8 @@
+<!-- Use the file tool_data_table_conf.xml.oldlocstyle if you don't want to update your loc files as changed in revision 4550:535d276c92bc-->
+<tables>
+    <!-- Locations of indexes in the Bowtie2 mapper format -->
+    <table name="bowtie2_indexes" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="${__HERE__}/test-data/bowtie2_indices.loc" />
+    </table>
+</tables>