changeset 5:306077e393d4 draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/bowtie_wrappers commit b2e1043bf4db38be490fec298a1829f8e4a1c48e
author devteam
date Thu, 18 Aug 2016 10:20:09 -0400
parents df86f29bedee
children ecbbc8be6266
files bowtie_wrapper.py bowtie_wrapper.xml test-data/bowtie_indices.loc test-data/bowtie_out11.txt tool_data_table_conf.xml.test tool_dependencies.xml
diffstat 6 files changed, 68 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/bowtie_wrapper.py	Tue Jul 21 13:04:45 2015 -0400
+++ b/bowtie_wrapper.py	Thu Aug 18 10:20:09 2016 -0400
@@ -2,7 +2,6 @@
 
 """
 Runs Bowtie on single-end or paired-end data.
-For use with Bowtie v. 0.12.7
 
 usage: bowtie_wrapper.py [options]
     -t, --threads=t: The number of threads to run
@@ -13,6 +12,7 @@
     --output_suppressed_reads=: File name for suppressed reads because of max setting (single-end)
     --output_suppressed_reads_l=: File name for suppressed reads because of max setting (left, paired-end)
     --output_suppressed_reads_r=: File name for suppressed reads because of max setting (right, paired-end)
+    --output_mapping_stats=: File name for mapping statistics (output on stderr by bowtie)
     -i, --input1=i: The (forward or single-end) reads file in Sanger FASTQ format
     -I, --input2=I: The reverse reads file in Sanger FASTQ format
     -4, --dataType=4: The type of data (SOLiD or Solexa)
@@ -86,6 +86,7 @@
     parser.add_option( '', '--output_suppressed_reads', dest='output_suppressed_reads', help='File name for suppressed reads because of max setting (single-end)' )
     parser.add_option( '', '--output_suppressed_reads_l', dest='output_suppressed_reads_l', help='File name for suppressed reads because of max setting (left, paired-end)' )
     parser.add_option( '', '--output_suppressed_reads_r', dest='output_suppressed_reads_r', help='File name for suppressed reads because of max setting (right, paired-end)' )
+    parser.add_option( '', '--output_mapping_stats', dest='output_mapping_stats', help='File for mapping statistics (i.e. stderr from bowtie)' )
     parser.add_option( '-4', '--dataType', dest='dataType', help='The type of data (SOLiD or Solexa)' )
     parser.add_option( '-i', '--input1', dest='input1', help='The (forward or single-end) reads file in Sanger FASTQ format' )
     parser.add_option( '-I', '--input2', dest='input2', help='The reverse reads file in Sanger FASTQ format' )
@@ -415,7 +416,7 @@
             # align
             tmp = tempfile.NamedTemporaryFile( dir=tmp_index_dir ).name
             tmp_stderr = open( tmp, 'wb' )
-            proc = subprocess.Popen( args=cmd2, shell=True, cwd=tmp_index_dir, stderr=tmp_stderr.fileno() )
+            proc = subprocess.Popen( args=cmd2, shell=True, cwd=tmp_index_dir, stdout=sys.stdout, stderr=tmp_stderr.fileno() )
             returncode = proc.wait()
             tmp_stderr.close()
             # get stderr, allowing for case where it's very large
@@ -432,6 +433,10 @@
             tmp_stderr.close()
             if returncode != 0:
                 raise Exception, stderr
+            elif options.output_mapping_stats is not None:
+                # Write stderr (containing the mapping statistics) to a named file
+                with open(options.output_mapping_stats, 'w') as mapping_stats:
+                    mapping_stats.write( stderr )
             # get suppressed and unmapped reads output files in place if appropriate
             if options.paired == 'paired' and tmp_suppressed_file_name and \
                                options.output_suppressed_reads_l and options.output_suppressed_reads_r:
--- a/bowtie_wrapper.xml	Tue Jul 21 13:04:45 2015 -0400
+++ b/bowtie_wrapper.xml	Thu Aug 18 10:20:09 2016 -0400
@@ -1,6 +1,6 @@
-<tool id="bowtie_wrapper" name="Map with Bowtie for Illumina" version="1.1.3">
+<tool id="bowtie_wrapper" name="Map with Bowtie for Illumina" version="1.1.5">
   <requirements>
-    <requirement type="package" version="0.12.7">bowtie</requirement>
+    <requirement type="package" version="1.1.2">bowtie</requirement>
   </requirements>
   <description></description>
   <version_command>bowtie --version</version_command>
@@ -148,6 +148,9 @@
           --seed="${singlePaired.pParams.pSeed}"
         #end if
       #end if
+      #if $save_mapping_stats
+        --output_mapping_stats="$mapping_stats"
+      #end if
   </command>
   <inputs>
     <conditional name="refGenomeSource">
@@ -415,6 +418,7 @@
         </conditional> <!-- pParams -->
       </when> <!-- paired -->
     </conditional> <!-- singlePaired -->
+    <param name="save_mapping_stats" type="boolean" checked="False" label="Save the bowtie mapping statistics to the history" />
     <param name="suppressHeader" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Suppress the header in the output SAM file (--sam-nohead)" help="Bowtie produces SAM with several lines of header information by default" />
   </inputs>
   <outputs>
@@ -437,6 +441,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>
     <data format="fastq" name="output_suppressed_reads_l" label="${tool.name} on ${on_string}: suppressed reads (L)">
       <filter>((
           singlePaired['sPaired'] == "single" and
@@ -545,7 +552,9 @@
       <param name="sInput1" ftype="fastqsanger" value="bowtie_in2.fastqsanger" />
       <param name="sSettingsType" value="preSet" />
       <param name="suppressHeader" value="true" />
-      <output name="output" ftype="sam" file="bowtie_out6.sam" sort="True" />
+      <output name="output" ftype="sam" file="bowtie_out6.sam" sort="True">
+        <metadata name="dbkey" value="equCab2" />
+      </output>
     </test>
     <test>
       <!--
@@ -713,7 +722,9 @@
       <param name="sOffrate" value="-1" />
       <param name="sSeed" value="-1" />
       <param name="suppressHeader" value="true" />
-      <output name="output" ftype="sam" file="bowtie_out9.sam" sort="True" />
+      <output name="output" ftype="sam" file="bowtie_out9.sam" sort="True">
+        <metadata name="dbkey" value="equCab2" />
+      </output>
     </test>
     <test>
       <!--
@@ -744,6 +755,37 @@
       <param name="suppressHeader" value="true" />
       <output name="output" ftype="sam" file="bowtie_out10.sam" sort="True" />
     </test>
+    <test>
+      <!--
+      Bowtie command:
+      bowtie-build +offrate 5 +ftabchars 10 +little -f test-data/phiX.fasta phiX_base
+      bowtie -q -X 1000 +ff -p 4 -S +sam-nohead phiX_base -1 test-data/bowtie_in5.fastqsanger -2 test-data/bowtie_in6.fastqsanger > bowtie_out10_u.sam
+      sort bowtie_out10_u.sam > bowtie_out10.sam
+      -p is the number of threads. You need to replace the + with 2 dashes.
+      chrM_base is the index files' location/base name.
+      -->
+      <param name="genomeSource" value="history" />
+      <param name="ownFile" value="phiX.fasta" />
+      <param name="indexSettings" value="indexFull" />
+      <param name="autoB" value="auto" />
+      <param name="nodc" value="dc" />
+      <param name="noref" value="ref" />
+      <param name="offrate" value="5" />
+      <param name="ftab" value="10" />
+      <param name="ntoa" value="no" />
+      <param name="endian" value="little" />
+      <param name="seed" value="-1" />
+      <param name="sPaired" value="paired" />
+      <param name="pInput1" ftype="fastqsanger" value="bowtie_in5.fastqsanger" />
+      <param name="pInput2" ftype="fastqsanger" value="bowtie_in6.fastqsanger" />
+      <param name="pMaxInsert" value="1000" />
+      <param name="pMateOrient" value="ff" />
+      <param name="pSettingsType" value="preSet" />
+      <param name="suppressHeader" value="true" />
+      <param name="save_mapping_stats" value="true" />
+      <output name="output" ftype="sam" file="bowtie_out10.sam" sort="True" />
+      <output name="mapping_stats" ftype="txt" file="bowtie_out11.txt" sort="True" />
+    </test>
   </tests>
 
   <help>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/bowtie_indices.loc	Thu Aug 18 10:20:09 2016 -0400
@@ -0,0 +1,1 @@
+equCab2chrM	equCab2	Horse (Equus caballus): equCab2 chrM	${__HERE__}/indexes/equCab2chrM/equCab2chrM
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/bowtie_out11.txt	Thu Aug 18 10:20:09 2016 -0400
@@ -0,0 +1,4 @@
+# reads processed: 18
+# reads with at least one reported alignment: 13 (72.22%)
+# reads that failed to align: 5 (27.78%)
+Reported 13 paired-end alignments to 1 output stream(s)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.test	Thu Aug 18 10:20:09 2016 -0400
@@ -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 Bowtie mapper format -->
+    <table name="bowtie_indexes" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="${__HERE__}/test-data/bowtie_indices.loc" />
+    </table>
+</tables>
--- a/tool_dependencies.xml	Tue Jul 21 13:04:45 2015 -0400
+++ b/tool_dependencies.xml	Thu Aug 18 10:20:09 2016 -0400
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <tool_dependency>
-    <package name="bowtie" version="0.12.7">
-        <repository changeset_revision="9f9f38617a98" name="package_bowtie_0_12_7" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" />
+    <package name="bowtie" version="1.1.2">
+        <repository changeset_revision="a1c1a92e13a6" name="package_bowtie_1_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
 </tool_dependency>