changeset 10:a9d4f71dbfb0 draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/bowtie2 commit 320f7fb84d2fda19f6cccdb38b4ef49edec4169d
author devteam
date Tue, 22 Mar 2016 14:58:55 -0400
parents 019c2a81547a
children b4e9cf5f2ae8
files bowtie2_wrapper.xml test-data/bowtie2-stats.out tool_dependencies.xml
diffstat 3 files changed, 95 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bowtie2_wrapper.xml	Wed Nov 18 09:51:30 2015 -0500
+++ b/bowtie2_wrapper.xml	Tue Mar 22 14:58:55 2016 -0400
@@ -1,4 +1,4 @@
-<tool id="bowtie2" name="Bowtie2" version="2.2.6">
+<tool id="bowtie2" name="Bowtie2" version="2.2.6.2">
     <description>- map reads against reference genome</description>
     <macros>
         <import>read_group_macros.xml</import>
@@ -9,7 +9,6 @@
         <requirement type="package" version="1.2">samtools</requirement>
     </requirements>
     <command>
-
         ## prepare bowtie2 index
         #set index_path = ''
         #if str($reference_genome.source) == "history":
@@ -36,6 +35,9 @@
             #if str( $library.unaligned_file ) == "true":
                 --un $output_unaligned_reads_l
             #end if
+            #if str( $library.aligned_file ) == "true":
+                --al $output_aligned_reads_l
+            #end if
         #elif str( $library.type ) == "paired":
             -1 "${library.input_1}"
             -2 "${library.input_2}"
@@ -52,6 +54,9 @@
             #if str( $library.unaligned_file ) == "true":
                 --un-conc $output_unaligned_reads_l
             #end if
+            #if str( $library.aligned_file ) == "true":
+                --al-conc $output_aligned_reads_l
+            #end if
         #else
             ## prepare collection
             -1 $library.input_1.forward
@@ -167,6 +172,11 @@
             ${analysis_type.cline}
         #end if
 
+        ## mapping stats (i.e. stderr from bowtie2)
+        #if $save_mapping_stats
+	  2&gt; "$mapping_stats"
+        #end if
+
         ## output file
         #if ( str( $analysis_type.analysis_type_selector ) != "full" or str( $analysis_type.sam_opt ) != "true" ):
           | samtools view -Su - | samtools sort -o - - &gt; $output
@@ -181,6 +191,12 @@
             &amp;&amp; mv "${ _unaligned_root }.1${_unaligned_ext}" "${ output_unaligned_reads_l }"
             &amp;&amp; mv "${ _unaligned_root }.2${_unaligned_ext}" "${ output_unaligned_reads_r }"
         #end if
+        #if $library.type == "paired" 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 ) )
+            &amp;&amp; mv "${ _aligned_root }.1${_aligned_ext}" "${ output_aligned_reads_l }"
+            &amp;&amp; mv "${ _aligned_root }.2${_aligned_ext}" "${ output_aligned_reads_r }"
+        #end if
 
     </command>
     <!-- basic error handling -->
@@ -200,11 +216,13 @@
             <when value="single">
                 <param name="input_1" format="fastqsanger" type="data" label="FASTQ file" help="Must be of datatype &quot;fastqsanger&quot;" />
                 <param name="unaligned_file" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write unaligned reads (in fastq format) to separate file(s)" help="--un/--un-conc; This triggers --un parameter for single reads and --un-conc for paired reads" />
+                <param name="aligned_file" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write aligned reads (in fastq format) to separate file(s)" help="--al/--al-conc; This triggers --al parameter for single reads and --al-conc for paired reads" />
             </when>
             <when value="paired">
                 <param name="input_1" format="fastqsanger" type="data" label="FASTQ file #1" help="Must be of datatype &quot;fastqsanger&quot;" />
                 <param name="input_2" format="fastqsanger" type="data" label="FASTQ file #2" help="Must be of datatype &quot;fastqsanger&quot;" />
                 <param name="unaligned_file" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write unaligned reads (in fastq format) to separate file(s)" help="--un/--un-conc; This triggers --un parameter for single reads and --un-conc for paired reads" />
+                <param name="aligned_file" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write aligned reads (in fastq format) to separate file(s)" help="--al/--al-conc; This triggers --al parameter for single reads and --al-conc for paired reads" />
                 <conditional name="paired_options">
                     <param name="paired_options_selector" type="select" label="Do you want to set paired-end options?" help="See &quot;Alignment Options&quot; section of Help below for information">
                         <option value="no" selected="True">No</option>
@@ -232,6 +250,7 @@
             <when value="paired_collection">
                 <param name="input_1" format="fastqsanger" type="data_collection" collection_type="paired" label="FASTQ Paired Dataset" help="Must be of datatype &quot;fastqsanger&quot;" />
                 <param name="unaligned_file" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write unaligned reads (in fastq format) to separate file(s)" help="--un/--un-conc; This triggers --un parameter for single reads and --un-conc for paired reads" />
+                <param name="aligned_file" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write aligned reads (in fastq format) to separate file(s)" help="--al/--al-conc; This triggers --al parameter for single reads and --al-conc for paired reads" />
                 <conditional name="paired_options">
                     <param name="paired_options_selector" type="select" label="Do you want to set paired-end options?" help="See &quot;Alignment Options&quot; section of Help below for information">
                         <option value="no" selected="True">No</option>
@@ -430,6 +449,7 @@
                 <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."/>
             </when>
         </conditional>
+        <param name="save_mapping_stats" type="boolean" checked="False" label="Save the bowtie2 mapping statistics to the history" />
     </inputs>
 
     <!-- define outputs -->
@@ -458,6 +478,45 @@
                 </conditional>
             </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>
+            <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>
+            </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>
+            </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>
@@ -517,6 +576,9 @@
             </conditional>
           </actions>
         </data>
+        <data format="txt" name="mapping_stats" label="${tool.name} on ${on_string}: mapping stats">
+          <filter>save_mapping_stats is True</filter>
+        </data>
 
     </outputs>
 
@@ -550,6 +612,21 @@
             <param name="own_file" value="bowtie2-ref.fasta" />
             <output name="output" file="bowtie2-test2.bam" ftype="bam" lines_diff="2"/>
         </test>
+        <test>
+            <!-- basic test on single paired default run with stats-->
+            <param name="type" value="paired"/>
+            <param name="selection" value="no"/>
+            <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" />
+            <param name="save_mapping_stats" value="true" />
+            <output name="output" file="bowtie2-test1.bam" ftype="bam" lines_diff="2"/>
+            <output name="mapping_stats" file="bowtie2-stats.out" ftype="txt"/>
+        </test>
     </tests>
 
     <help>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/bowtie2-stats.out	Tue Mar 22 14:58:55 2016 -0400
@@ -0,0 +1,15 @@
+100 reads; of these:
+  100 (100.00%) were paired; of these:
+    97 (97.00%) aligned concordantly 0 times
+    3 (3.00%) aligned concordantly exactly 1 time
+    0 (0.00%) aligned concordantly >1 times
+    ----
+    97 pairs aligned concordantly 0 times; of these:
+      8 (8.25%) aligned discordantly 1 time
+    ----
+    89 pairs aligned 0 times concordantly or discordantly; of these:
+      178 mates make up the pairs; of these:
+        153 (85.96%) aligned 0 times
+        25 (14.04%) aligned exactly 1 time
+        0 (0.00%) aligned >1 times
+23.50% overall alignment rate
--- a/tool_dependencies.xml	Wed Nov 18 09:51:30 2015 -0500
+++ b/tool_dependencies.xml	Tue Mar 22 14:58:55 2016 -0400
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <tool_dependency>
   <package name="bowtie2" version="2.2.6">
-      <repository changeset_revision="6d6cca69a34a" name="package_bowtie_2_2_6" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+      <repository changeset_revision="0d9cd7487cc9" name="package_bowtie_2_2_6" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
     <package name="samtools" version="1.2">
       <repository changeset_revision="f6ae3ba3f3c1" name="package_samtools_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />