changeset 7:5ba8e317529a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hisat2 commit 5c49c4049418cdca86f40df5a5d8014c2d932dde
author iuc
date Sat, 21 Jan 2017 15:42:34 -0500
parents 5f4da9ec47c7
children 4d0a3173cde0
files hisat2.xml hisat2_macros.xml test-data/test_unaligned_reads.fasta tool_data_table_conf.xml.sample
diffstat 4 files changed, 151 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hisat2.xml	Wed Nov 09 05:57:35 2016 -0500
+++ b/hisat2.xml	Sat Jan 21 15:42:34 2017 -0500
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<tool id="hisat2" name="HISAT" version="2.0.3.1">
+<tool id="hisat2" name="HISAT2" version="2.0.3.2">
     <description>A fast and sensitive alignment program</description>
     <macros>
         <import>hisat2_macros.xml</import>
@@ -38,6 +38,12 @@
             @paired_end_options@
         #else:
             -U "${input_format.paired.reads}"
+            #if str( $input_format.paired.unaligned_file ) == "true":
+                --un '$output_unaligned_reads_l'
+            #end if
+            #if str( $input_format.paired.aligned_file ) == "true":
+                --al '$output_aligned_reads_l'
+            #end if
         #end if
         #if $input_format.input_format_selector == 'fasta':
             -f
@@ -84,6 +90,22 @@
             ${paired_options.dovetail} ${paired_options.contain} ${paired_options.overlap}
         #end if
         | samtools sort - -@ \${GALAXY_SLOTS:-2} -l 6 -o hsbam > "${output_alignments}"
+
+        ## Rename any output fastq files
+        #if str($input_format.paired.paired_selector) == 'paired' or str($input_format.paired.paired_selector) == 'paired_collection':
+            #if $output_unaligned_reads_l and $output_unaligned_reads_r:
+                #set left = str($output_unaligned_reads_l).replace(".dat", ".1.dat")
+                #set right = str($output_unaligned_reads_l).replace(".dat", ".2.dat")
+                && mv '${left}' '${output_unaligned_reads_l}'
+                && mv '${right}' '${output_unaligned_reads_r}'
+            #end if
+            #if $output_aligned_reads_l and $output_aligned_reads_r:
+                #set left = str($output_aligned_reads_l).replace(".dat", ".1.dat")
+                #set right = str($output_aligned_reads_l).replace(".dat", ".2.dat")
+                && mv '${left}' '${output_aligned_reads_l}'
+                && mv '${right}' '${output_aligned_reads_r}'
+            #end if
+        #end if
         ]]>
     </command>
     <inputs>
@@ -243,6 +265,84 @@
               </conditional>
             </actions>
         </data>
+        <data format="fastqsanger" name="output_unaligned_reads_l" label="${tool.name} on ${on_string}: unaligned reads (L)" >
+            <filter>input_format['paired']['unaligned_file'] is True</filter>
+            <actions>
+                <conditional name="input_format.paired.paired_selector">
+                    <when value="single">
+                        <action type="format">
+                            <option type="from_param" name="input_format.paired.reads" param_attribute="ext" />
+                        </action>
+                    </when>
+                    <when value="paired">
+                        <action type="format">
+                            <option type="from_param" name="input_format.paired.reads_f" param_attribute="ext" />
+                        </action>
+                    </when>
+                    <when value="paired_collection">
+                        <action type="format">
+                            <option type="from_param" name="input_format.paired.reads" param_attribute="forward.ext" />
+                        </action>
+                    </when>
+                </conditional>
+            </actions>
+        </data>
+        <data format="fastqsanger" name="output_unaligned_reads_r" label="${tool.name} on ${on_string}: unaligned reads (R)" >
+            <filter>input_format['paired']['unaligned_file'] is True and input_format['paired']['paired_selector'] != 'single'</filter>
+            <actions>
+                <conditional name="input_format.paired.paired_selector">
+                    <when value="paired">
+                        <action type="format">
+                            <option type="from_param" name="input_format.paired.reads_r" param_attribute="ext" />
+                        </action>
+                    </when>
+                    <when value="paired_collection">
+                        <action type="format">
+                            <option type="from_param" name="input_format.paired.reads" param_attribute="forward.ext" />
+                        </action>
+                    </when>
+                </conditional>
+            </actions>
+        </data>
+        <data format="fastqsanger" name="output_aligned_reads_l" label="${tool.name} on ${on_string}: aligned reads${' (L)' if str($input_format.paired.paired_selector) != 'single' else ''}" >
+            <filter>input_format['paired']['aligned_file'] is True</filter>
+            <actions>
+                <conditional name="input_format.paired.paired_selector">
+                    <when value="single">
+                        <action type="format">
+                            <option type="from_param" name="input_format.paired.reads" param_attribute="ext" />
+                        </action>
+                    </when>
+                    <when value="paired">
+                        <action type="format">
+                            <option type="from_param" name="input_format.paired.reads_f" param_attribute="ext" />
+                        </action>
+                    </when>
+                    <when value="paired_collection">
+                        <action type="format">
+                            <option type="from_param" name="input_format.paired.reads" 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>input_format['paired']['aligned_file'] is True and input_format['paired']['paired_selector'] != 'single'</filter>
+            <actions>
+                <conditional name="input_format.paired.paired_selector">
+                    <when value="paired">
+                        <action type="format">
+                            <option type="from_param" name="input_format.paired.reads_r" param_attribute="ext" />
+                        </action>
+                    </when>
+                    <when value="paired_collection">
+                        <action type="format">
+                            <option type="from_param" name="input_format.paired.reads" param_attribute="forward.ext" />
+                        </action>
+                    </when>
+                </conditional>
+            </actions>
+        </data>
     </outputs>
     <tests>
         <test>
@@ -281,6 +381,35 @@
             <param name="no_discordant" value="True" />
             <output name="output_alignments" ftype="bam" file="hisat_output_3.bam" lines_diff="2" />
         </test>
+        <test><!-- testing unaligned output (single dataset) -->
+            <param name="input_format_selector" value="fasta" />
+            <param name="paired_selector" value="single" />
+            <param name="reference_genome_source" value="history" />
+            <param name="history_item" value="phiX.fa" ftype="fasta" />
+            <param name="unaligned_file" value="true" />
+            <param name="aligned_file" value="true" />
+            <param name="reference_genome_source" value="history" />
+            <param name="history_item" value="phiX.fa" ftype="fasta" />
+            <param name="reads" value="test_unaligned_reads.fasta" ftype="fasta" />
+            
+            <output name="output_unaligned_reads_l" file="test_unaligned_reads.fasta" />
+        </test>
+        
+        <test>
+            <param name="input_format_selector" value="fasta" />
+            <param name="paired_selector" value="paired" />
+            <param name="reference_genome_source" value="history" />
+            <param name="history_item" value="phiX.fa" ftype="fasta" />
+            <param name="unaligned_file" value="true" />
+            <param name="aligned_file" value="true" />
+            <param name="reference_genome_source" value="history" />
+            <param name="history_item" value="phiX.fa" ftype="fasta" />
+            <param name="reads_f" value="test_unaligned_reads.fasta" ftype="fasta" />
+            <param name="reads_r" value="test_unaligned_reads.fasta" ftype="fasta" />
+            
+            <output name="output_unaligned_reads_l" file="test_unaligned_reads.fasta" />
+            <output name="output_unaligned_reads_r" file="test_unaligned_reads.fasta" />
+        </test>
     </tests>
     <help>
         <![CDATA[
--- a/hisat2_macros.xml	Wed Nov 09 05:57:35 2016 -0500
+++ b/hisat2_macros.xml	Sat Jan 21 15:42:34 2017 -0500
@@ -23,14 +23,18 @@
             <when value="paired_collection">
                 <param collection_type="paired" format="@FTYPE@" label="Paired reads" name="reads" type="data_collection" />
                 <expand macro="paired_end_conditional" />
+                <expand macro="paired_end_output" />
             </when>
             <when value="paired">
                 <param format="@FTYPE@" label="Forward reads" name="reads_f" type="data" />
                 <param format="@FTYPE@" label="Reverse reads" name="reads_r" type="data" />
                 <expand macro="paired_end_conditional" />
+                <expand macro="paired_end_output" />
             </when>
             <when value="single">
                 <param format="@FTYPE@" label="Reads" name="reads" type="data" />
+                <param name="unaligned_file" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write unaligned reads (in fastq format) to separate file(s)" argument="--un" />
+                <param name="aligned_file" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write aligned reads (in fastq format) to separate file(s)" argument="--al" />
             </when>
         </conditional>
     </xml>
@@ -50,7 +54,17 @@
             </when>
         </conditional>
     </xml>
+    <xml name="paired_end_output">
+        <param name="unaligned_file" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write unaligned reads (in fastq format) to separate file(s)" argument="--un-conc" />
+        <param name="aligned_file" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write aligned reads (in fastq format) to separate file(s)" argument="--al-conc" />
+    </xml>
     <token name="@paired_end_options@">
+        #if str( $input_format.paired.unaligned_file ) == "true":
+            --un-conc '${output_unaligned_reads_l}'
+        #end if
+        #if str( $input_format.paired.aligned_file ) == "true":
+            --al-conc '${output_aligned_reads_l}'
+        #end if  
         #if str($input_format.paired.paired_end_options.paired_end_options_selector) == 'advanced':
             ${input_format.paired.paired_end_options.no_mixed}
             ${input_format.paired.paired_end_options.no_discordant}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_unaligned_reads.fasta	Sat Jan 21 15:42:34 2017 -0500
@@ -0,0 +1,6 @@
+>read1
+aaaaaaaaaaaaaaaaaaaaaaaaaa
+>read2
+aaaaaataaaaaaaaaaaaaaaaaaa
+>read3
+aaaaaagaaaaaaaaaaaaaaaaaaa
--- a/tool_data_table_conf.xml.sample	Wed Nov 09 05:57:35 2016 -0500
+++ b/tool_data_table_conf.xml.sample	Sat Jan 21 15:42:34 2017 -0500
@@ -1,6 +1,6 @@
 <tables>
     <!-- Locations of indexes in the HISAT mapper format -->
-    <table name="hisat2_indexes" comment_char="#">
+    <table name="hisat2_indexes" comment_char="#" allow_duplicate_entries="False">
         <columns>value, dbkey, name, path</columns>
         <file path="tool-data/hisat2_indexes.loc" />
     </table>