diff edger.xml @ 14:c5fa04118f83 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 4b17306763bc8eb92c8967c7b4b57abcc514e670
author iuc
date Wed, 04 Sep 2024 15:49:53 +0000
parents 838b481dc6f9
children 119f41ec0ada
line wrap: on
line diff
--- a/edger.xml	Wed Sep 27 19:52:53 2023 +0000
+++ b/edger.xml	Wed Sep 04 15:49:53 2024 +0000
@@ -4,7 +4,7 @@
     </description>
     <macros>
         <token name="@TOOL_VERSION@">3.36.0</token>
-        <token name="@VERSION_SUFFIX@">2</token>
+        <token name="@VERSION_SUFFIX@">5</token>
     </macros>
     <edam_topics>
         <edam_topic>topic_3308</edam_topic>
@@ -68,7 +68,15 @@
     -a '$anno.geneanno'
 #end if
 
--C '${ ','.join( ['%s' % $x.contrast for x in $rep_contrast] ) }'
+#if $formula:
+    -F '$formula'
+#end if
+
+#if $contrasts.contrastOpt == 'file':
+    -C '$contrasts.cinfo'
+#else: 
+    -C '${ ','.join( ['%s' % $x.contrast for x in $contrasts.rep_contrast] ) }'
+#end if
 
 #if $f.filt.filt_select == 'yes':
     #if $f.filt.cformat.format_select == 'cpm':
@@ -122,11 +130,8 @@
             <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>
+                        <validator type="empty_field"/>
+                        <validator type="regex" message="Please only use letters, numbers or underscores">^[\w]+$</validator>
                     </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">
@@ -176,13 +181,45 @@
             </when>
             <when value="no"/>
         </conditional>
+        <!-- Optional formula -->
+        <param name="formula" type="text" optional="true" label="Formula for linear model" help="An optional formula for the EdgeR linear model, this will override the use of the fields in factors as a simple sum. The formula can only use elements available in the factors file. This needs to be exactly as EdgeR expect the formula, ie. `~ 0 + factor_A + factor_B:factor_C`. See EdgeR documentation for more details.">
+            <sanitizer invalid_char="">
+                <valid initial="string.letters,string.digits">
+                    <add value="_"/>
+                    <add value="-"/>
+                    <add value="+"/>
+                    <add value="*"/>
+                    <add value="/"/>
+                    <add value="^"/>
+                    <add value=":"/>
+                    <add value="."/>
+                    <add value="~"/>
+                    <add value=" "/>
+                    <add value="("/>
+                    <add value=")"/>
+                    <add value="@"/>
+                    <add value="$"/>
+                </valid>
+            </sanitizer>
+        </param>
         <!-- 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="regex" message="Please only use letters, numbers, parentheses or underscores">^[\w\-()]+$</validator>
+        <conditional name="contrasts">
+            <param name="contrastOpt" type="select" label="Input contrasts manually or through a file">
+                <option value="manual">manually</option>
+                <option value="file">file</option>
             </param>
-        </repeat>
+            <when value="manual">
+                <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="regex" message="Please only use letters, numbers, parentheses or underscores">^[\w\-()]+$</validator>
+                    </param>
+                </repeat>
+            </when>
+            <when value="file">
+                <param name="cinfo" optional="true" type="data" format="tabular" label="Contrasts File" help="Setting this file will ignore any manually added contrasts above, make sure to remove any contrast fields above pressing the trash bin icon, or the tool will fail. First line of the file must be a header, below that each separate contrast should be on a line. Contrast formulas need to be based on ther factors data and potentially the formula provided. See EdgeR documentation on contrasts for more details."/>
+            </when>
+        </conditional>
         <!-- Filter Options -->
         <section name="f" expanded="false" title="Filter Low Counts">
             <conditional name="filt">
@@ -264,6 +301,7 @@
                 <param name="factorName" value="Genotype"/>
                 <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -302,6 +340,7 @@
                 <param name="factorName" value="Genotype"/>
                 <param name="groupNames" value="MutA,MutA,MutA,MutB,MutB,MutB,WTA,WTA,WTA,WTB,WTB,WTB"/>
             </repeat>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="(MutA-MutB)-(WTA-WTB)"/>
             </repeat>
@@ -333,6 +372,7 @@
                 <param name="factorName" value="Genotype"/>
                 <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -356,6 +396,7 @@
                 <param name="factorName" value="Genotype"/>
                 <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -383,6 +424,7 @@
                 <param name="factorName" value="Batch"/>
                 <param name="groupNames" value="b1,b2,b3,b1,b2,b3"/>
             </repeat>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -402,6 +444,7 @@
             <param name="ffile" value="yes"/>
             <param name="finfo" value="factorinfo.txt"/>
             <param name="counts" value="matrix.txt"/>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -424,6 +467,7 @@
                 <param name="factorName" value="Genotype"/>
                 <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -451,6 +495,7 @@
                 <param name="factorName" value="Genotype"/>
                 <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -494,6 +539,7 @@
             </repeat>
             <param name="annoOpt" value="yes"/>
             <param name="geneanno" value="anno.txt"/>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -530,6 +576,7 @@
                 <param name="factorName" value="Genotype"/>
                 <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -565,6 +612,7 @@
                 <param name="factorName" value="Genotype"/>
                 <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -599,6 +647,7 @@
                 <param name="factorName" value="Genotype"/>
                 <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT"/>
             </repeat>
+            <param name="contrastOpt" value="manual"/>
             <repeat name="rep_contrast">
                 <param name="contrast" value="Mut-WT"/>
             </repeat>
@@ -626,6 +675,41 @@
                 </element>
             </output_collection>
         </test>
+        <!-- Ensure formula and contrast file work -->
+        <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"/>
+            </repeat>
+            <repeat name="rep_factor">
+                <param name="factorName" value="Batch"/>
+                <param name="groupNames" value="b1,b2,b3,b1,b2,b3"/>
+            </repeat>
+            <param name="contrastOpt" value="file"/>
+            <param name="cinfo" value="contrasts_file.txt"/>
+            <param name="formula" value="~ 0 + Genotype + Batch"/>
+            <param name="normalisationOption" value="TMM"/>
+            <output_collection name="outTables" count="3">
+                <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>
+                <element name="edgeR_WT-Mut" ftype="tabular">
+                    <assert_contents>
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                    </assert_contents>
+                </element>
+                <element name="edgeR_(2*Mut_3*WT)-WT" ftype="tabular">
+                    <assert_contents>
+                        <has_text_matching expression="GeneID.*logFC.*logCPM.*F.*PValue.*FDR"/>
+                    </assert_contents>
+                </element>
+            </output_collection>
+        </test>
     </tests>
     <help><![CDATA[
 .. class:: infomark
@@ -713,12 +797,20 @@
 
 *Groups:* The names of the groups for the factor. The names should start with a letter, and only contain letters, numbers and underscores, other characters such as spaces and hyphens must not be used. If entered into the tool form above, the order must be the same as the samples (to which the groups correspond) are listed in the columns of the counts matrix, with the values separated by commas.
 
+**Formula:**
+By default the tool will construct a formula for modelling counts based on the contents of the factors files or the factors given.
+This can be overriden by directly providing the EdgeR formula in section named Formula.
+
 **Contrasts of Interest:**
 The contrasts you wish to make between levels.
 A common contrast would be a simple difference between two levels: "Mut-WT"
 represents the difference between the mutant and wild type genotypes.
 Multiple contrasts must be entered separately using the Insert Contrast button, spaces must not be used.
 
+Alternatively, you can specify a file with contrasts. The file must contain a header (it's value is irrelevant)
+and one contrast per line on the first column (other columns are ignored). If using this option, make sure to
+remove any contrast section from the manual part, or the tool will fail.
+
 **Filter Low Counts:**
 Genes with very low counts across all libraries provide little evidence for differential expression.
 In the biological point of view, a gene must be expressed at some minimal level before