changeset 10:2eaa365afe7b draft

planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit a54770771e567c7ad8a9dd75cc4689c3935ef11c
author matthias
date Tue, 28 May 2019 12:16:35 -0400
parents e09edc2b553a
children cc856fb738b2
files README.md dada2_filterAndTrim.xml macros.xml test-data/dada2_species.loc test-data/dada2_taxonomy.loc test-data/qualityProfile.pdf test-data/qualityProfileMultiple.pdf test-data/qualityProfileMultiple_rev.pdf test-data/qualityProfileSmallSample.pdf test-data/qualityProfile_rev.pdf tool_data_table_conf.xml.test
diffstat 11 files changed, 75 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Mon May 27 13:23:38 2019 -0400
+++ b/README.md	Tue May 28 12:16:35 2019 -0400
@@ -11,7 +11,7 @@
 Datatypes
 =========
 
-The dada2 Galaxy wrappers use a few extra data types to ensure that only inputs of the correct type can be used. 
+The dada2 Galaxy wrappers use a few extra data types to ensure that only inputs of the correct type can be used, these datatypes are available from Galaxy release 19.05, for earlier releases they need to be added manually. 
 
 For the outputs of derep, dada, learnErrors, and mergePairs the following datatypes are used that derive from  Rdata (which contains the named list that is returned from the corresponding dada function):
 
@@ -35,5 +35,4 @@
 TODOs 
 =====
 
-- implememt getUniques tool to view intermediate results?
-- implement tests for cached reference data
+- implement getUniques tool to view intermediate results?
--- a/dada2_filterAndTrim.xml	Mon May 27 13:23:38 2019 -0400
+++ b/dada2_filterAndTrim.xml	Tue May 28 12:16:35 2019 -0400
@@ -53,13 +53,13 @@
 filt.fwd <- NULL
 filt.rev <- NULL
 #if $paired_cond.paired_select == "paired"
-    fwd <- c(fwd, '$paired_cond.paired_reads.forward')
-    rev <- c(rev, '$paired_cond.paired_reads.reverse')
+    fwd <- c(fwd, '$paired_cond.reads.forward')
+    rev <- c(rev, '$paired_cond.reads.reverse')
     filt.fwd <- c(filt.fwd, '$paired_output.forward')
     filt.rev <- c(filt.rev, '$paired_output.reverse')
 #else if $paired_cond.paired_select == "separate"
-    fwd <- c(fwd, '$paired_cond.forward')
-    rev <- c(rev, '$paired_cond.reverse')
+    fwd <- c(fwd, '$paired_cond.reads')
+    rev <- c(rev, '$paired_cond.sdaer')
     filt.fwd <- c(filt.fwd, '$output_fwd')
     filt.rev <- c(filt.rev, '$output_rev')
 #else
@@ -73,34 +73,12 @@
     truncQ = truncQ, truncLen = truncLen, trimLeft = trimLeft, trimRight = trimRight, maxLen = maxLen,
     minLen = minLen, maxN = maxN, minQ = minQ, maxEE = maxEE, rm.phix = $rmPhiX, orient.fwd = '$orientFwd')
 
-#if $paired_cond.paired_select == "separate":
-    rownames(ftout) <- c( '$paired_cond.forward.element_identifier' )
-#else if $paired_cond.paired_select == "paired"
-    rownames(ftout) <- c( '$paired_cond.paired_reads.element_identifier' )
-#else:
-    rownames(ftout) <- c( '$paired_cond.reads.element_identifier' )
-#end if
+rownames(ftout) <- c( '$paired_cond.reads.element_identifier' )
 write.table(ftout, "$outtab", quote=F, sep="\t", col.names=NA)
     ]]></configfile>
     </configfiles>
     <inputs>
-        <conditional name="paired_cond">
-            <param name="paired_select" type="select" label="Paired reads">
-                <option value="paired">paired - in a data set pair</option>
-                <option value="separate">paired - in two separate data sets</option>
-                <option value="single">single</option>
-            </param>
-            <when value="paired">
-                <param name="paired_reads" argument="fwd/rev" type="data_collection" collection_type="paired" format="fastq,fastq.gz" label="Paired short read data"/>
-            </when>
-            <when value="separate">
-                <param name="forward" argument="fwd" type="data" format="fastq,fastq.gz" label="Forward read data"/>
-                <param name="reverse" argument="rev" type="data" format="fastq,fastq.gz" label="Reverse read data"/>
-            </when>
-            <when value="single">
-                <param name="reads" argument="fwd" type="data" format="fastq,fastq.gz" label="Short read data"/>
-            </when>
-        </conditional>
+        <expand macro="fastq_input" multiple="False" collection_type="paired" argument_fwd="fwd" argument_rev="rev"/>
         <expand macro="trimmers"/>
         <expand macro="filters"/>
         <conditional name="seprev_cond">
@@ -119,16 +97,16 @@
         <param name="output_statistics" truevalue="TRUE" falsevalue="FALSE" type="boolean" checked="true" label="Output statistics" help="Create extra table with the number of reads pre and post filtering" />
     </inputs>
     <outputs>
-        <collection name="paired_output" type="paired" format_source="paired_reads">
+        <collection name="paired_output" type="paired" format_source="reads['forward']">
             <filter>paired_cond['paired_select'] == "paired"</filter>
         </collection>
         <data name="output_single" format_source="reads" >
             <filter>paired_cond['paired_select'] == "single"</filter>
         </data>
-        <data name="output_fwd" format_source="forward" label="${tool.name} on ${on_string}: Forward reads" >
+        <data name="output_fwd" format_source="reads" label="${tool.name} on ${on_string}: Forward reads" >
             <filter>paired_cond['paired_select'] == "separate"</filter>
         </data>
-        <data name="output_rev" format_source="reverse" label="${tool.name} on ${on_string}: Reverse reads" >
+        <data name="output_rev" format_source="sdaer" label="${tool.name} on ${on_string}: Reverse reads" >
             <filter>paired_cond['paired_select'] == "separate"</filter>
         </data>
         <data name="outtab" format="tabular" label="${tool.name} on ${on_string}: Statistics">
@@ -136,12 +114,12 @@
         </data>
     </outputs>
     <tests>
-        <!-- paired data 
+        <!-- paired data
              currently removed `expect_num_outputs="2"` because of https://github.com/galaxyproject/galaxy/pull/7894-->
-        <test expect_num_outputs="3">
+        <test expect_num_outputs="4">
             <conditional name="paired_cond">
                 <param name="paired_select" value="paired"/>
-                <param name="paired_reads">
+                <param name="reads">
                     <collection type="paired">
                         <element name="forward" value="F3D0_S188_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/>
                         <element name="reverse" value="F3D0_S188_L001_R2_001.fastq.gz" ftype="fastqsanger.gz"/>
@@ -158,8 +136,8 @@
         <test expect_num_outputs="3">
             <conditional name="paired_cond">
                 <param name="paired_select" value="separate"/>
-                <param name="forward" value="F3D0_S188_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/>
-                <param name="reverse" value="F3D0_S188_L001_R2_001.fastq.gz" ftype="fastqsanger.gz"/>
+                <param name="reads" value="F3D0_S188_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/>
+                <param name="sdaer" value="F3D0_S188_L001_R2_001.fastq.gz" ftype="fastqsanger.gz"/>
             </conditional>
             <output name="output_fwd" value="filterAndTrim_F3D0_R1.fq.gz" ftype="fastqsanger.gz" />
             <output name="output_rev" value="filterAndTrim_F3D0_R2.fq.gz" ftype="fastqsanger.gz" />
@@ -201,12 +179,12 @@
             <param name="output_statistics" value="FALSE" />
             <output name="output_fwd" value="filterAndTrim_single_filters_F3D0_R1.fq.gz" ftype="fastqsanger.gz" />
         </test>
-        <!-- paired data w separate filters and trimmers for reverse 
+        <!-- paired data w separate filters and trimmers for reverse
              currently removed `expect_num_outputs="1"` because of https://github.com/galaxyproject/galaxy/pull/7894-->
-        <test expect_num_outputs="2">
+        <test expect_num_outputs="3">
             <conditional name="paired_cond" >
                 <param name="paired_select" value="paired"/>
-                <param name="paired_reads">
+                <param name="reads">
                     <collection type="paired">
                         <element name="forward" value="F3D0_S188_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/>
                         <element name="reverse" value="F3D0_S188_L001_R2_001.fastq.gz" ftype="fastqsanger.gz"/>
@@ -237,7 +215,7 @@
 Usage
 .....
 
-**Input** is a FASTQ dataset (or a pair in case of paired end data) containing all reads of a sample. It is suggested to organize them in a (paired) collection (in particular if you have multiple samples). 
+**Input** is a FASTQ dataset (or a pair in case of paired end data) containing all reads of a sample. It is suggested to organize them in a (paired) collection (in particular if you have multiple samples).
 
 **Output** is a (paired) collection of filtered and trimmed paired FASTQ datasets (again one data set or pair per sample).
 
--- a/macros.xml	Mon May 27 13:23:38 2019 -0400
+++ b/macros.xml	Tue May 28 12:16:35 2019 -0400
@@ -26,7 +26,7 @@
     <token name="@DADA_UNIQUES@">dada2_derep,dada2_dada,dada2_mergepairs</token>
 
     <!-- function to read dada2 data types
-         - derep, dada, and mergepairs are simply read as RDS 
+         - derep, dada, and mergepairs are simply read as RDS
          - sequence_table is a named integer matrix (rows=samples, columns=ASVs)
          - uniques is a named integer vector (columns=ASVs, only one rows)-->
     <token name="@READ_FOO@"><![CDATA[
@@ -48,7 +48,7 @@
     #end def
     ]]></token>
     <!-- function to write dada2 data types (the content or the R variable 'out' is written)
-         - derep, dada, and mergepairs are written as RDS 
+         - derep, dada, and mergepairs are written as RDS
          - sequence_table is a named integer matrix (rows=samples, columns=ASVs)
          - uniques is a named integer vector (columns=ASVs, only one rows)-->
     <token name="@WRITE_FOO@"><![CDATA[
@@ -61,7 +61,27 @@
         saveRDS(data, file=fname)
     }
 }
-    ]]></token> 
+    ]]></token>
+
+    <xml name="fastq_input" token_multiple="" token_collection_type="" token_argument_fwd="" token_argument_rev="">
+        <conditional name="paired_cond">
+            <param name="paired_select" type="select" label="Paired reads">
+                <option value="paired">paired - in a data set pair</option>
+                <option value="separate">paired - in two separate data sets</option>
+                <option value="single">single</option>
+            </param>
+            <when value="paired">
+                <param name="reads" argument="@ARGUMENT_FWD@/@ARGUMENT_REV@" type="data_collection" collection_type="@COLLECTION_TYPE@" format="fastq,fastq.gz" label="Paired short read data"/>
+            </when>
+            <when value="separate">
+                <param name="reads" argument="@ARGUMENT_FWD@" type="data" format="fastq,fastq.gz" multiple="@MULTIPLE@" label="Forward read data"/>
+                <param name="sdaer" argument="@ARGUMENT_REV@" type="data" format="fastq,fastq.gz" multiple="@MULTIPLE@" label="Reverse read data"/>
+            </when>
+            <when value="single">
+                <param name="reads" argument="@ARGUMENT_FWD@" type="data" format="fastq,fastq.gz" multiple="@MULTIPLE@" label="Short read data"/>
+            </when>
+        </conditional>
+    </xml>
 
     <!-- for filterAndTrim -->
     <xml name="trimmers">
@@ -69,7 +89,7 @@
             <param argument="truncQ" type="integer" value="2" min="0" label="Truncate reads at quality threshold" help="Truncate reads at the first instance of a quality score less than or equal to this threshold"/>
             <param argument="trimLeft" type="integer" value="0" min="0" label="Trim start of each read" help="The number of nucleotides to remove from the start of each read."/>
             <param argument="trimRight" type="integer" value="0" min="0" label="Trim end of each read" help="The number of nucleotides to remove from the end of each read"/>
-			<param argument="truncLen" type="integer" value="0" min="0" label="Truncate read length" help="Truncate reads after this amount of bases. Reads shorter than this are discarded. (default 0: no truncation)"/>
+            <param argument="truncLen" type="integer" value="0" min="0" label="Truncate read length" help="Truncate reads after this amount of bases. Reads shorter than this are discarded. (default 0: no truncation)"/>
         </section>
     </xml>
     <xml name="filters">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/dada2_species.loc	Tue May 28 12:16:35 2019 -0400
@@ -0,0 +1,10 @@
+# This is a sample file distributed with Galaxy that is used to define a
+# list of dada2 reference data sets for species assignment, using three
+# tab separated columns:
+#
+# <unique_build_id>	<display_name>	<fasta_file_path>
+#
+# Datasets can be retrieved from http://busco.ezlab.org/frame_wget.html
+#
+# Datasets can be retrieved from https://benjjneb.github.io/dada2/training.html
+test_buildid	test_displayname	${__HERE__}/reference_species.fa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/dada2_taxonomy.loc	Tue May 28 12:16:35 2019 -0400
@@ -0,0 +1,10 @@
+# This is a sample file distributed with Galaxy that is used to define a
+# list of dada2 reference data sets for taxonomy assignment, using three
+# tab separated columns:
+#
+# <unique_build_id>	<display_name>	<fasta_file_path>	<taxlevels>
+#
+# Datasets can be retrieved from https://benjjneb.github.io/dada2/training.html
+# 
+# taxlevels is a comma separated list of taxonomy levels
+test_buildid	test_displayname	${__HERE__}/reference.fa	Level1,Level2,Level3,Level4,Level5
Binary file test-data/qualityProfile.pdf has changed
Binary file test-data/qualityProfileMultiple.pdf has changed
Binary file test-data/qualityProfileMultiple_rev.pdf has changed
Binary file test-data/qualityProfileSmallSample.pdf has changed
Binary file test-data/qualityProfile_rev.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.test	Tue May 28 12:16:35 2019 -0400
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<tables>
+    <table name="dada2_species" comment_char="#">
+        <columns>value, name, path</columns>
+        <file path="${__HERE__}/test-data/dada2_species.loc" />
+    </table>
+    <table name="dada2_taxonomy" comment_char="#">
+        <columns>value, name, path, taxlevels</columns>
+        <file path="${__HERE__}/test-data/dada2_taxonomy.loc" />
+    </table>
+</tables>