changeset 12:a8305cf0c951 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 4955aeed800ea8e45057b7e8578dc878a07f9cfc
author iuc
date Thu, 21 Sep 2023 10:01:55 +0000
parents f2843df56434
children 0cb907a2a810
files edger.R edger.xml
diffstat 2 files changed, 242 insertions(+), 273 deletions(-) [+]
line wrap: on
line diff
--- a/edger.R	Sat Dec 18 16:15:09 2021 +0000
+++ b/edger.R	Thu Sep 21 10:01:55 2023 +0000
@@ -40,9 +40,9 @@
 time_start <- as.character(Sys.time())
 
 # setup R error handling to go to stderr
-options(show.error.messages = F, error = function() {
+options(show.error.messages = FALSE, error = function() {
   cat(geterrmessage(), file = stderr())
-  q("no", 1, F)
+  q("no", 1, FALSE)
 })
 
 # we need that to not crash galaxy with an UTF8 error on German LC settings.
@@ -105,8 +105,7 @@
     } else if (substring(file, 1L, 1L) == "|") {
       file <- pipe(substring(file, 2L), "w")
       on.exit(close(file))
-    }
-    else {
+    } else {
       file <- file(file, ifelse(append, "a", "w"))
       on.exit(close(file))
     }
@@ -181,7 +180,7 @@
 opt <- getopt(spec)
 
 
-if (is.null(opt$matrixPath) & is.null(opt$filesPath)) {
+if (is.null(opt$matrixPath) && is.null(opt$filesPath)) {
   cat("A counts matrix (or a set of counts files) is required.\n")
   q(status = 1)
 }
@@ -387,7 +386,7 @@
 
 # Name rows of factors according to their sample
 row.names(factors) <- names(data$counts)
-factor_list <- sapply(names(factors), paste_listname)
+factor_list <- names(factors)
 
 # Generating the DGEList object "data"
 samplenames <- colnames(data$counts)
@@ -405,7 +404,7 @@
 }
 
 formula <- formula(formula)
-design <- model.matrix(formula)
+design <- model.matrix(formula, factors)
 
 for (i in seq_along(factor_list)) {
   colnames(design) <- gsub(factor_list[i], "", colnames(design), fixed = TRUE)
--- a/edger.xml	Sat Dec 18 16:15:09 2021 +0000
+++ b/edger.xml	Thu Sep 21 10:01:55 2023 +0000
@@ -4,11 +4,8 @@
     </description>
     <macros>
         <token name="@TOOL_VERSION@">3.36.0</token>
-        <token name="@VERSION_SUFFIX@">0</token>
+        <token name="@VERSION_SUFFIX@">1</token>
     </macros>
-    <xrefs>
-        <xref type="bio.tools">edger</xref>
-    </xrefs>
     <edam_topics>
         <edam_topic>topic_3308</edam_topic>
     </edam_topics>
@@ -16,7 +13,10 @@
         <edam_operation>operation_3563</edam_operation>
         <edam_operation>operation_3223</edam_operation>
     </edam_operations>
-
+    <xrefs>
+        <xref type="bio.tools">edger</xref>
+        <xref type="bioconductor">edger</xref>
+    </xrefs>
     <requirements>
         <requirement type="package" version="@TOOL_VERSION@">bioconductor-edger</requirement>
         <requirement type="package" version="3.50.0">bioconductor-limma</requirement>
@@ -26,11 +26,9 @@
         <!-- required for alpha function used with plotMD -->
         <requirement type="package" version="1.1.1">r-scales</requirement>
     </requirements>
-
     <version_command><![CDATA[
 echo $(R --version | grep version | grep -v GNU)", edgeR version" $(R --vanilla --slave -e "library(edgeR); cat(sessionInfo()\$otherPkgs\$edgeR\$Version)" 2> /dev/null | grep -v -i "WARNING: ")", limma version" $(R --vanilla --slave -e "library(limma); cat(sessionInfo()\$otherPkgs\$limma\$Version)" 2> /dev/null | grep -v -i "WARNING: ")", scales version" $(R --vanilla --slave -e "library(scales); cat(sessionInfo()\$otherPkgs\$scales\$Version)" 2> /dev/null | grep -v -i "WARNING: ")", rjson version" $(R --vanilla --slave -e "library(rjson); cat(sessionInfo()\$otherPkgs\$rjson\$Version)" 2> /dev/null | grep -v -i "WARNING: ")", getopt version" $(R --vanilla --slave -e "library(getopt); cat(sessionInfo()\$otherPkgs\$getopt\$Version)" 2> /dev/null | grep -v -i "WARNING: ")
     ]]></version_command>
-
     <command detect_errors="exit_code"><![CDATA[
 #import json
 Rscript '$__tool_directory__/edger.R'
@@ -114,58 +112,52 @@
     && cp '$__tool_directory__/edger.R' '$rscript'
 #end if
     ]]></command>
-
     <inputs>
-
         <!-- Counts and Factors -->
         <conditional name="input">
-            <param name="format" type="select" label="Count Files or Matrix?"
-                help="You can choose to input either separate count files (one per sample) or a single count matrix">
+            <param name="format" type="select" label="Count Files or Matrix?" help="You can choose to input either separate count files (one per sample) or a single count matrix">
                 <option value="files">Separate Count Files</option>
                 <option value="matrix">Single Count Matrix</option>
             </param>
-
             <when value="files">
                 <repeat name="rep_factor" title="Factor" min="1">
                     <param name="factorName" type="text" label="Name" help="Name of experiment factor of interest (e.g. Genotype). One factor must be entered and there must be two or more groups per factor. Optional additional factors (e.g. Batch) can be entered using the Insert Factor button below, see Help section for more information. NOTE: Please only use letters, numbers or underscores, and the first character of each factor must be a letter">
-                    <sanitizer>
-                        <valid initial="string.letters,string.digits"><add value="_" /></valid>
-                    </sanitizer>
+                        <sanitizer>
+                            <valid initial="string.letters,string.digits">
+                                <add value="_"/>
+                            </valid>
+                        </sanitizer>
                     </param>
                     <repeat name="rep_group" title="Group" min="2" default="2">
-                        <param name="groupName" type="text" label="Name"
-                        help="Name of group that the counts files belong to (e.g. WT or Mut). NOTE: Please only use letters, numbers or underscores (case sensitive), and the first character of each group must be a letter">
-                        <sanitizer>
-                            <valid initial="string.letters,string.digits"><add value="_" /></valid>
-                        </sanitizer>
+                        <param name="groupName" type="text" label="Name" help="Name of group that the counts files belong to (e.g. WT or Mut). NOTE: Please only use letters, numbers or underscores (case sensitive), and the first character of each group must be a letter">
+                            <sanitizer>
+                                <valid initial="string.letters,string.digits">
+                                    <add value="_"/>
+                                </valid>
+                            </sanitizer>
                         </param>
                         <param name="countsFile" type="data" format="tabular" multiple="true" label="Counts files"/>
                     </repeat>
                 </repeat>
             </when>
-
             <when value="matrix">
                 <param name="counts" type="data" format="tabular" label="Count Matrix"/>
-
                 <conditional name="fact">
-                    <param name="ffile" type="select" label="Input factor information from file?"
-                        help="You can choose to input the factor and group information for the samples from a file or manually enter below. NOTE: Please only use letters, numbers or underscores (case sensitive), and the first character of each sample, factor and group must be a letter">
+                    <param name="ffile" type="select" label="Input factor information from file?" help="You can choose to input the factor and group information for the samples from a file or manually enter below. NOTE: Please only use letters, numbers or underscores (case sensitive), and the first character of each sample, factor and group must be a letter">
                         <option value="no">No</option>
                         <option value="yes">Yes</option>
                     </param>
                     <when value="yes">
                         <param name="finfo" type="data" format="tabular" label="Factor File"/>
                     </when>
-                    <when value="no" >
+                    <when value="no">
                         <repeat name="rep_factor" title="Factor" min="1">
-                            <param name="factorName" type="text" label="Factor Name"
-                                help="Name of experiment factor of interest (e.g. Genotype). One factor must be entered and there must be two or more groups per factor. Additional factors (e.g. Batch) can be entered using the Insert Factor button below, see Help section below. NOTE: Please only use letters, numbers or underscores, and the first character of each factor must be a letter">
-                                <validator type="empty_field" />
+                            <param name="factorName" type="text" label="Factor Name" help="Name of experiment factor of interest (e.g. Genotype). One factor must be entered and there must be two or more groups per factor. Additional factors (e.g. Batch) can be entered using the Insert Factor button below, see Help section below. NOTE: Please only use letters, numbers or underscores, and the first character of each factor must be a letter">
+                                <validator type="empty_field"/>
                                 <validator type="regex" message="Please only use letters, numbers or underscores">^[\w]+$</validator>
                             </param>
-                            <param name="groupNames" type="text" label="Groups"
-                                help="Enter the group names for the samples separated with commas e.g. WT,WT,WT,Mut,Mut,Mut. The order of the names must match the order of the samples in the columns of the count matrix. NOTE: Please only use letters, numbers or underscores (case sensitive), and the first character of each group must be a letter">
-                                <validator type="empty_field" />
+                            <param name="groupNames" type="text" label="Groups" help="Enter the group names for the samples separated with commas e.g. WT,WT,WT,Mut,Mut,Mut. The order of the names must match the order of the samples in the columns of the count matrix. NOTE: Please only use letters, numbers or underscores (case sensitive), and the first character of each group must be a letter">
+                                <validator type="empty_field"/>
                                 <validator type="regex" message="Please only use letters, numbers or underscores, and separate levels by commas">^[\w,]+$</validator>
                             </param>
                         </repeat>
@@ -173,28 +165,24 @@
                 </conditional>
             </when>
         </conditional>
-
         <!-- Gene Annotations -->
         <conditional name="anno">
-            <param name="annoOpt" type="select" label="Use Gene Annotations?"
-                    help="If you provide an annotation file, annotations will be added to the table(s) of differential expression results to provide descriptions for each gene. See Help section below.">
+            <param name="annoOpt" type="select" label="Use Gene Annotations?" help="If you provide an annotation file, annotations will be added to the table(s) of differential expression results to provide descriptions for each gene. See Help section below.">
                 <option value="no">No</option>
                 <option value="yes">Yes</option>
             </param>
             <when value="yes">
                 <param name="geneanno" type="data" format="tabular" label="Gene Annotations"/>
             </when>
-            <when value="no" />
+            <when value="no"/>
         </conditional>
-
         <!-- Contrasts -->
         <repeat name="rep_contrast" title="Contrast" min="1" default="1">
             <param name="contrast" type="text" label="Contrast of Interest" help="Names of two groups to compare separated by a hyphen e.g. Mut-WT. If the order is Mut-WT the fold changes in the results will be up/down in Mut relative to WT. If you have more than one contrast enter each separately using the Insert Contrast button below. For differences between contrasts use e.g. (MT.t1-MT.t0)-(WT.t1-WT.t0). For more info, see Chapter 8 in the limma User's guide: https://www.bioconductor.org/packages/release/bioc/vignettes/limma/inst/doc/usersguide.pdf or https://bioconductor.org/packages/release/bioc/vignettes/edgeR/inst/doc/edgeRUsersGuide.pdf page 36 for nested comparisons.">
-                <validator type="empty_field" />
+                <validator type="empty_field"/>
                 <validator type="regex" message="Please only use letters, numbers, parentheses or underscores">^[\w\-()]+$</validator>
             </param>
         </repeat>
-
         <!-- Filter Options -->
         <section name="f" expanded="false" title="Filter Low Counts">
             <conditional name="filt">
@@ -210,50 +198,38 @@
                         </param>
                         <when value="cpm">
                             <param name="cpmReq" type="float" value="1" min="0" label="Minimum CPM" help="Treat genes with CPM below this value as unexpressed and filter out. See the Filter Low Counts section below for more information."/>
-                             <param name="cpmSampleReq" type="integer" value="0" min="0" label="Minimum Samples"
-                             help="Filter out all genes that do not meet the Minimum CPM in at least this many samples. See the Filter Low Counts section below for more information."/>
+                            <param name="cpmSampleReq" type="integer" value="0" min="0" label="Minimum Samples" help="Filter out all genes that do not meet the Minimum CPM in at least this many samples. See the Filter Low Counts section below for more information."/>
                         </when>
                         <when value="counts">
-                            <param name="cntReq" type="integer" value="0" min="0" label="Minimum Count" help="Filter out all genes that do not meet this minimum count. You can choose below to apply this filter to the total count for all samples or specify the number of samples under Minimum Samples. See the Filter Low Counts section below for more information." />
+                            <param name="cntReq" type="integer" value="0" min="0" label="Minimum Count" help="Filter out all genes that do not meet this minimum count. You can choose below to apply this filter to the total count for all samples or specify the number of samples under Minimum Samples. See the Filter Low Counts section below for more information."/>
                             <conditional name="samples">
-                                <param name="count_select" type="select" label="Filter on Total Count or per Sample Count values?" >
+                                <param name="count_select" type="select" label="Filter on Total Count or per Sample Count values?">
                                     <option value="total">Total</option>
                                     <option value="sample">Sample</option>
                                 </param>
                                 <when value="total"/>
                                 <when value="sample">
-                                    <param name="cntSampleReq" type="integer" value="0" min="0" label="Minimum Samples"
-                                    help="Filter out all genes that do not meet the Minimum Count in at least this many samples. See the Filter Low Counts section below for more information."/>
+                                    <param name="cntSampleReq" type="integer" value="0" min="0" label="Minimum Samples" help="Filter out all genes that do not meet the Minimum Count in at least this many samples. See the Filter Low Counts section below for more information."/>
                                 </when>
                             </conditional>
                         </when>
                     </conditional>
                 </when>
-                <when value="no" />
+                <when value="no"/>
             </conditional>
         </section>
-
         <!-- Output Options -->
         <section name="out" expanded="false" title="Output Options">
-            <param name="normCounts" type="boolean" truevalue="1" falsevalue="0" checked="false"
-                label="Output Normalised Counts Table?"
-                help="Output a file containing the normalised counts, these are in log2 counts per million (logCPM). Default: No">
+            <param name="normCounts" type="boolean" truevalue="1" falsevalue="0" checked="false" label="Output Normalised Counts Table?" help="Output a file containing the normalised counts, these are in log2 counts per million (logCPM). Default: No">
             </param>
             <param name="rscript" type="boolean" truevalue="True" falsevalue="False" checked="False" label="Output Rscript?" help="If this option is set to Yes, the Rscript used will be provided as a text file in the output. Default: No"/>
-            <param name="rdaOption" type="boolean" truevalue="1" falsevalue="0" checked="false"
-                label="Output RData file?"
-                help="Output all the data used by R to construct the plots and tables, can be loaded into R. A link to the RData file will be provided in the HTML report. Default: No">
+            <param name="rdaOption" type="boolean" truevalue="1" falsevalue="0" checked="false" label="Output RData file?" help="Output all the data used by R to construct the plots and tables, can be loaded into R. A link to the RData file will be provided in the HTML report. Default: No">
             </param>
         </section>
-
         <!-- Advanced Options -->
         <section name="adv" expanded="false" title="Advanced Options">
-            <param name="lfc" type="float" value="0" min="0"
-                label="Minimum Log2 Fold Change"
-                help="Genes above this threshold and below the p-value threshold are considered significant and highlighted in the MD plot. Default: 0."/>
-            <param name="pVal" type="float" value="0.05" min="0" max="1"
-                label="P-Value Adjusted Threshold"
-                help="Genes below this threshold are considered significant and highlighted in the MD plot. If either BH(1995) or BY(2001) are selected then this value is a false-discovery-rate control. If Holm(1979) is selected then this is an adjusted p-value for family-wise error rate. Default: 0.05."/>
+            <param name="lfc" type="float" value="0" min="0" label="Minimum Log2 Fold Change" help="Genes above this threshold and below the p-value threshold are considered significant and highlighted in the MD plot. Default: 0."/>
+            <param name="pVal" type="float" value="0.05" min="0" max="1" label="P-Value Adjusted Threshold" help="Genes below this threshold are considered significant and highlighted in the MD plot. If either BH(1995) or BY(2001) are selected then this value is a false-discovery-rate control. If Holm(1979) is selected then this is an adjusted p-value for family-wise error rate. Default: 0.05."/>
             <param name="pAdjust" type="select" label="P-Value Adjustment Method" help="Default: BH">
                 <option value="BH" selected="true">Benjamini and Hochberg (1995)</option>
                 <option value="BY">Benjamini and Yekutieli (2001)</option>
@@ -266,233 +242,230 @@
                 <option value="upperquartile">Upperquartile</option>
                 <option value="none">None (Don't normalise)</option>
             </param>
-            <param name="robOption" type="boolean" truevalue="1" falsevalue="0" checked="true" label="Use Robust Settings?" help="Using robust settings is usually recommended to protect against outlier genes. Default: Yes" />
+            <param name="robOption" type="boolean" truevalue="1" falsevalue="0" checked="true" label="Use Robust Settings?" help="Using robust settings is usually recommended to protect against outlier genes. Default: Yes"/>
             <param name="lrtOption" type="boolean" truevalue="1" falsevalue="0" checked="false" label="Use Likelihood Ratio Test?" help="Use likelihood ratio test instead of quasi-likelihood F-test. Default: No"/>
         </section>
-
     </inputs>
-
     <outputs>
-        <data name="outReport" format="html" label="${tool.name} on ${on_string}: Report" />
+        <data name="outReport" format="html" label="${tool.name} on ${on_string}: Report"/>
         <collection name="outTables" type="list" label="${tool.name} on ${on_string}: Tables">
-            <discover_datasets pattern="(?P&lt;name&gt;.+)\.tsv$" format="tabular" directory="output_dir" visible="false" />
+            <discover_datasets pattern="(?P&lt;name&gt;.+)\.tsv$" format="tabular" directory="output_dir" visible="false"/>
         </collection>
         <data name="rscript" format="txt" label="${tool.name} on ${on_string}: Rscript">
             <filter>out['rscript']</filter>
         </data>
     </outputs>
-
     <tests>
         <!-- Ensure report is output -->
-        <test>
-            <param name="format" value="matrix" />
-            <param name="counts" value="matrix.txt" />
+        <test expect_num_outputs="2">
+            <param name="format" value="matrix"/>
+            <param name="counts" value="matrix.txt"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
-                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" />
+                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="WT-Mut" />
+                <param name="contrast" value="WT-Mut"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
+            <param name="normalisationOption" value="TMM"/>
             <output_collection name="outTables" count="2">
-                <element name="edgeR_Mut-WT" ftype="tabular" >
+                <element name="edgeR_Mut-WT" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*0.4582" />
-                   </assert_contents>
-               </element>
-                <element name="edgeR_WT-Mut" ftype="tabular" >
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*0.4582"/>
+                    </assert_contents>
+                </element>
+                <element name="edgeR_WT-Mut" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*-0.4582" />
-                   </assert_contents>
-               </element>
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*-0.4582"/>
+                    </assert_contents>
+                </element>
             </output_collection>
-            <output name="outReport" >
+            <output name="outReport">
                 <assert_contents>
-                    <has_text text="edgeR Analysis Output" />
-                    <has_text text="quasi-likelihood" />
-                    <not_has_text text="likelihood ratio" />
-                    <not_has_text text="RData" />
+                    <has_text text="edgeR Analysis Output"/>
+                    <has_text text="quasi-likelihood"/>
+                    <not_has_text text="likelihood ratio"/>
+                    <not_has_text text="RData"/>
                 </assert_contents>
             </output>
         </test>
         <!-- Complex contrasts constructions -->
-        <test>
-            <param name="format" value="matrix" />
-            <param name="counts" value="matrix-complex.txt" />
+        <test expect_num_outputs="2">
+            <param name="format" value="matrix"/>
+            <param name="counts" value="matrix-complex.txt"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
-                <param name="groupNames" value="MutA,MutA,MutA,MutB,MutB,MutB,WTA,WTA,WTA,WTB,WTB,WTB" />
+                <param name="groupNames" value="MutA,MutA,MutA,MutB,MutB,MutB,WTA,WTA,WTA,WTB,WTB,WTB"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="(MutA-MutB)-(WTA-WTB)" />
+                <param name="contrast" value="(MutA-MutB)-(WTA-WTB)"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
+            <param name="normalisationOption" value="TMM"/>
             <output_collection name="outTables" count="1">
-                <element name="edgeR_(MutA-MutB)-(WTA-WTB)" ftype="tabular" >
+                <element name="edgeR_(MutA-MutB)-(WTA-WTB)" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*15.53" />
-                   </assert_contents>
-               </element>
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*15.53"/>
+                    </assert_contents>
+                </element>
             </output_collection>
-            <output name="outReport" >
+            <output name="outReport">
                 <assert_contents>
-                    <has_text text="edgeR Analysis Output" />
-                    <has_text text="quasi-likelihood" />
-                    <not_has_text text="likelihood ratio" />
-                    <not_has_text text="RData" />
+                    <has_text text="edgeR Analysis Output"/>
+                    <has_text text="quasi-likelihood"/>
+                    <not_has_text text="likelihood ratio"/>
+                    <not_has_text text="RData"/>
                 </assert_contents>
             </output>
         </test>
         <!-- Ensure annotation file input works -->
-        <test>
-            <param name="format" value="matrix" />
-            <param name="annoOpt" value="yes" />
-            <param name="geneanno" value="anno.txt" />
-            <param name="counts" value="matrix.txt" />
+        <test expect_num_outputs="2">
+            <param name="format" value="matrix"/>
+            <param name="annoOpt" value="yes"/>
+            <param name="geneanno" value="anno.txt"/>
+            <param name="counts" value="matrix.txt"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
-                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" />
+                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
+            <param name="normalisationOption" value="TMM"/>
             <output_collection name="outTables" count="1">
-                <element name="edgeR_Mut-WT" ftype="tabular" >
+                <element name="edgeR_Mut-WT" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="EntrezID.*Symbol.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*Abca4.*0.4582" />
-                   </assert_contents>
-               </element>
+                        <has_text_matching expression="EntrezID.*Symbol.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*Abca4.*0.4582"/>
+                    </assert_contents>
+                </element>
             </output_collection>
         </test>
         <!-- Ensure RScript and RData file can be output -->
-        <test>
-            <param name="format" value="matrix" />
+        <test expect_num_outputs="3">
+            <param name="format" value="matrix"/>
             <param name="rscript" value="True"/>
-            <param name="rdaOption" value="true" />
-            <param name="counts" value="matrix.txt" />
+            <param name="rdaOption" value="true"/>
+            <param name="counts" value="matrix.txt"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
-                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" />
+                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
-            <output name="outReport" >
+            <param name="normalisationOption" value="TMM"/>
+            <output name="outReport">
                 <assert_contents>
-                    <has_text text="RData" />
+                    <has_text text="RData"/>
                 </assert_contents>
             </output>
             <output name="rscript">
                 <assert_contents>
-                    <has_text_matching expression="Task run time" />
+                    <has_text_matching expression="Task run time"/>
                 </assert_contents>
             </output>
         </test>
         <!-- Ensure secondary factors work -->
-        <test>
-            <param name="format" value="matrix" />
-            <param name="counts" value="matrix.txt" />
+        <test expect_num_outputs="2">
+            <param name="format" value="matrix"/>
+            <param name="counts" value="matrix.txt"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
-                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" />
+                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
             <repeat name="rep_factor">
                 <param name="factorName" value="Batch"/>
                 <param name="groupNames" value="b1,b2,b3,b1,b2,b3"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
-            <output_collection name="outTables" count="1" >
-                <element name="edgeR_Mut-WT" ftype="tabular" >
+            <param name="normalisationOption" value="TMM"/>
+            <output_collection name="outTables" count="1">
+                <element name="edgeR_Mut-WT" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*0.4584" />
-                   </assert_contents>
-               </element>
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*0.4584"/>
+                    </assert_contents>
+                </element>
             </output_collection>
         </test>
         <!-- Ensure factors file with unordered samples works -->
-        <test>
-            <param name="format" value="matrix" />
-            <param name="ffile" value="yes" />
-            <param name="finfo" value="factorinfo.txt" />
-            <param name="counts" value="matrix.txt" />
+        <test expect_num_outputs="2">
+            <param name="format" value="matrix"/>
+            <param name="ffile" value="yes"/>
+            <param name="finfo" value="factorinfo.txt"/>
+            <param name="counts" value="matrix.txt"/>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
+            <param name="normalisationOption" value="TMM"/>
             <output_collection name="outTables" count="1">
-                <element name="edgeR_Mut-WT" ftype="tabular" >
+                <element name="edgeR_Mut-WT" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*0.4584" />
-                   </assert_contents>
-               </element>
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*0.4584"/>
+                    </assert_contents>
+                </element>
             </output_collection>
         </test>
         <!-- Ensure normalised counts file output works-->
-        <test>
-            <param name="format" value="matrix" />
-            <param name="normCounts" value="true" />
-            <param name="counts" value="matrix.txt" />
+        <test expect_num_outputs="2">
+            <param name="format" value="matrix"/>
+            <param name="normCounts" value="true"/>
+            <param name="counts" value="matrix.txt"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
-                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" />
+                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
+            <param name="normalisationOption" value="TMM"/>
             <output_collection name="outTables" count="2">
-                <element name="edgeR_Mut-WT" ftype="tabular" >
+                <element name="edgeR_Mut-WT" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*0.4582" />
-                   </assert_contents>
-               </element>
-                <element name="edgeR_normcounts" ftype="tabular" >
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*0.4582"/>
+                    </assert_contents>
+                </element>
+                <element name="edgeR_normcounts" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="GeneID.*Mut1.*Mut2.*Mut3.*WT1.*WT2.*WT3" />
-                        <has_text_matching expression="11304.*15.75" />
-                   </assert_contents>
-               </element>
+                        <has_text_matching expression="GeneID.*Mut1.*Mut2.*Mut3.*WT1.*WT2.*WT3"/>
+                        <has_text_matching expression="11304.*15.75"/>
+                    </assert_contents>
+                </element>
             </output_collection>
         </test>
         <!-- Ensure likelihood ratio option works -->
-        <test>
-            <param name="format" value="matrix" />
-            <param name="counts" value="matrix.txt" />
+        <test expect_num_outputs="2">
+            <param name="format" value="matrix"/>
+            <param name="counts" value="matrix.txt"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
-                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" />
+                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
-            <param name="lrtOption" value="true" />
-            <output name="outReport" >
+            <param name="normalisationOption" value="TMM"/>
+            <param name="lrtOption" value="true"/>
+            <output name="outReport">
                 <assert_contents>
-                    <has_text text="likelihood ratio" />
-                    <not_has_text text="quasi-likelihood" />
+                    <has_text text="likelihood ratio"/>
+                    <not_has_text text="quasi-likelihood"/>
                 </assert_contents>
             </output>
         </test>
         <!-- Ensure multiple counts files input works -->
-        <test>
-            <param name="format" value="files" />
+        <test expect_num_outputs="2">
+            <param name="format" value="files"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
                 <repeat name="rep_group">
@@ -519,144 +492,141 @@
                     <param name="countsFile" value="WT3.counts,Mut3.counts"/>
                 </repeat>
             </repeat>
-            <param name="annoOpt" value="yes" />
-            <param name="geneanno" value="anno.txt" />
+            <param name="annoOpt" value="yes"/>
+            <param name="geneanno" value="anno.txt"/>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="WT-Mut" />
+                <param name="contrast" value="WT-Mut"/>
             </repeat>
-            <param name="normCounts" value="true" />
+            <param name="normCounts" value="true"/>
             <output_collection name="outTables" count="3">
-                <element name="edgeR_Mut-WT" ftype="tabular" >
+                <element name="edgeR_Mut-WT" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="EntrezID.*Symbol.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*Abca4.*0.4584" />
-                   </assert_contents>
-               </element>
-                <element name="edgeR_WT-Mut" ftype="tabular" >
+                        <has_text_matching expression="EntrezID.*Symbol.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*Abca4.*0.4584"/>
+                    </assert_contents>
+                </element>
+                <element name="edgeR_WT-Mut" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*Abca4.*-0.4584" />
-                   </assert_contents>
-               </element>
-                <element name="edgeR_normcounts" ftype="tabular" >
+                        <has_text_matching expression="logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*Abca4.*-0.4584"/>
+                    </assert_contents>
+                </element>
+                <element name="edgeR_normcounts" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="Mut1.*Mut2.*Mut3.*WT1.*WT2.*WT3" />
-                        <has_text_matching expression="11304.*Abca4.*15.75" />
-                   </assert_contents>
-               </element>
+                        <has_text_matching expression="Mut1.*Mut2.*Mut3.*WT1.*WT2.*WT3"/>
+                        <has_text_matching expression="11304.*Abca4.*15.75"/>
+                    </assert_contents>
+                </element>
             </output_collection>
         </test>
         <!-- Ensure filtering on CPM in Mnimum Samples works -->
-        <test>
-            <param name="format" value="matrix" />
-            <param name="counts" value="matrix.txt" />
+        <test expect_num_outputs="2">
+            <param name="format" value="matrix"/>
+            <param name="counts" value="matrix.txt"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
-                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" />
+                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
-            <param name="filt_select" value="yes" />
-            <param name="format_select" value="cpm" />
+            <param name="normalisationOption" value="TMM"/>
+            <param name="filt_select" value="yes"/>
+            <param name="format_select" value="cpm"/>
             <!-- real cpmReq values would be a lot lower
                  this is just for this tiny test dataset -->
-            <param name="cpmReq" value="1000" />
-            <param name="cpmSampleReq" value="3" />
-            <output name="outReport" >
+            <param name="cpmReq" value="1000"/>
+            <param name="cpmSampleReq" value="3"/>
+            <output name="outReport">
                 <assert_contents>
-                    <has_text text="CPM in at least" />
-                    <not_has_text text="after summing counts for all samples" />
-                    <not_has_text text="counts in at least" />
+                    <has_text text="CPM in at least"/>
+                    <not_has_text text="after summing counts for all samples"/>
+                    <not_has_text text="counts in at least"/>
                 </assert_contents>
             </output>
-            <output_collection name="outTables" count="1" >
-                <element name="edgeR_Mut-WT" ftype="tabular" >
+            <output_collection name="outTables" count="1">
+                <element name="edgeR_Mut-WT" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*0.4568" />
-                        <not_has_text text="-0.0682" />
-                   </assert_contents>
-               </element>
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*0.4568"/>
+                        <not_has_text text="-0.0682"/>
+                    </assert_contents>
+                </element>
             </output_collection>
         </test>
         <!-- Ensure filtering on Count in Minmum Samples works -->
-        <test>
-            <param name="format" value="matrix" />
-            <param name="counts" value="matrix.txt" />
+        <test expect_num_outputs="2">
+            <param name="format" value="matrix"/>
+            <param name="counts" value="matrix.txt"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
-                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" />
+                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
-            <param name="filt_select" value="yes" />
-            <param name="format_select" value="counts" />
-            <param name="cntReq" value="10" />
-            <param name="count_select" value="sample" />
-            <param name="cntSampleReq" value="3" />
-            <output name="outReport" >
+            <param name="normalisationOption" value="TMM"/>
+            <param name="filt_select" value="yes"/>
+            <param name="format_select" value="counts"/>
+            <param name="cntReq" value="10"/>
+            <param name="count_select" value="sample"/>
+            <param name="cntSampleReq" value="3"/>
+            <output name="outReport">
                 <assert_contents>
-                    <has_text text="counts in at least" />
-                    <not_has_text text="after summing counts for all samples" />
-                    <not_has_text text="CPM in at least" />
+                    <has_text text="counts in at least"/>
+                    <not_has_text text="after summing counts for all samples"/>
+                    <not_has_text text="CPM in at least"/>
                 </assert_contents>
             </output>
-            <output_collection name="outTables" count="1" >
-                <element name="edgeR_Mut-WT" ftype="tabular" >
+            <output_collection name="outTables" count="1">
+                <element name="edgeR_Mut-WT" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*0.4568" />
-                        <not_has_text text="-0.0682" />
-                   </assert_contents>
-               </element>
-
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*0.4568"/>
+                        <not_has_text text="-0.0682"/>
+                    </assert_contents>
+                </element>
             </output_collection>
         </test>
         <!-- Ensure filtering on Total Count works -->
-        <test>
-            <param name="format" value="matrix" />
-            <param name="counts" value="matrix.txt" />
+        <test expect_num_outputs="2">
+            <param name="format" value="matrix"/>
+            <param name="counts" value="matrix.txt"/>
             <repeat name="rep_factor">
                 <param name="factorName" value="Genotype"/>
-                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" />
+                <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
             <repeat name="rep_contrast">
-                <param name="contrast" value="Mut-WT" />
+                <param name="contrast" value="Mut-WT"/>
             </repeat>
-            <param name="normalisationOption" value="TMM" />
-            <param name="filt_select" value="yes" />
-            <param name="format_select" value="counts" />
+            <param name="normalisationOption" value="TMM"/>
+            <param name="filt_select" value="yes"/>
+            <param name="format_select" value="counts"/>
             <!-- real cntReq values would be a lot lower
                  this is just for this tiny test dataset -->
-            <param name="cntReq" value="1000" />
-            <param name="count_select" value="total" />
-            <param name="totReq" value="true" />
-            <output name="outReport" >
+            <param name="cntReq" value="1000"/>
+            <param name="count_select" value="total"/>
+            <output name="outReport">
                 <assert_contents>
-                    <has_text text="after summing counts for all samples" />
-                    <not_has_text text="counts in at least" />
-                    <not_has_text text="CPM in at least" />
+                    <has_text text="after summing counts for all samples"/>
+                    <not_has_text text="counts in at least"/>
+                    <not_has_text text="CPM in at least"/>
                 </assert_contents>
             </output>
-            <output_collection name="outTables" count="1" >
-                <element name="edgeR_Mut-WT" ftype="tabular" >
+            <output_collection name="outTables" count="1">
+                <element name="edgeR_Mut-WT" ftype="tabular">
                     <assert_contents>
-                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR" />
-                        <has_text_matching expression="11304.*0.4568" />
-                        <not_has_text text="-0.0682" />
-                   </assert_contents>
-               </element>
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                        <has_text_matching expression="11304.*0.4568"/>
+                        <not_has_text text="-0.0682"/>
+                    </assert_contents>
+                </element>
             </output_collection>
         </test>
     </tests>
-
     <help><![CDATA[
 .. class:: infomark