Repository 'edger'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/edger

Changeset 4:4730985c816f (2019-01-05)
Previous changeset 3:d79ed3ec25fe (2018-05-06) Next changeset 5:fb9b9f0f2f06 (2019-02-05)
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/edger commit 230fc767e2e402ee460440afab0e348f2ccab179
modified:
edger.R
edger.xml
test-data/factorinfo.txt
removed:
test-data/out_rscript.txt
b
diff -r d79ed3ec25fe -r 4730985c816f edger.R
--- a/edger.R Sun May 06 13:38:41 2018 -0400
+++ b/edger.R Sat Jan 05 05:32:33 2019 -0500
[
@@ -268,7 +268,9 @@
 
     # Process factors
     if (is.null(opt$factInput)) {
-            factorData <- read.table(opt$factFile, header=TRUE, sep="\t")
+            factorData <- read.table(opt$factFile, header=TRUE, sep="\t", strip.white=TRUE)
+            # order samples as in counts matrix
+            factorData <- factorData[match(colnames(counts), factorData[, 1]), ]
             factors <- factorData[, -1, drop=FALSE]
     }  else {
             factors <- unlist(strsplit(opt$factInput, "|", fixed=TRUE))
b
diff -r d79ed3ec25fe -r 4730985c816f edger.xml
--- a/edger.xml Sun May 06 13:38:41 2018 -0400
+++ b/edger.xml Sat Jan 05 05:32:33 2019 -0500
[
@@ -1,16 +1,16 @@
-<tool id="edger" name="edgeR" version="3.20.7.2">
+<tool id="edger" name="edgeR" version="3.22.5">
     <description>
         Perform differential expression of count data
     </description>
 
     <requirements>
-        <requirement type="package" version="3.20.7">bioconductor-edger</requirement>
-        <requirement type="package" version="3.34.9">bioconductor-limma</requirement>
-        <requirement type="package" version="0.2.15">r-rjson</requirement>
-        <requirement type="package" version="1.20.0">r-getopt</requirement>
+        <requirement type="package" version="3.22.5">bioconductor-edger</requirement>
+        <requirement type="package" version="3.36.5">bioconductor-limma</requirement>
+        <requirement type="package" version="0.2.20">r-rjson</requirement>
+        <requirement type="package" version="1.20.2">r-getopt</requirement>
         <requirement type="package" version="1.4.30">r-statmod</requirement>
         <!-- required for alpha function used with plotMD -->
-        <requirement type="package" version="0.5.0">r-scales</requirement>
+        <requirement type="package" version="1.0.0">r-scales</requirement>
     </requirements>
 
     <version_command><![CDATA[
@@ -351,7 +351,11 @@
                     <has_text text="RData" />
                 </assert_contents>
             </output>
-            <output name="rscript" value="out_rscript.txt"/>
+            <output name="rscript">
+                <assert_contents>
+                    <has_text_matching expression="Task run time" />
+                </assert_contents>
+            </output>
         </test>
         <!-- Ensure secondary factors work -->
         <test>
@@ -378,7 +382,7 @@
                </element>
             </output_collection>
         </test>
-        <!-- Ensure factors file input works -->
+        <!-- Ensure factors file with unordered samples works -->
         <test>
             <param name="format" value="matrix" />
             <param name="ffile" value="yes" />
@@ -659,26 +663,6 @@
     11305      2528    2438    2493    1762     1942     2027
     ========== ======= ======= ======= ======== ======== ========
 
-**Factor Information:**
-Enter factor names and groups in the tool form, or provide a tab-separated file that has the samples in the same order as listed in the columns of the counts matrix. The second column should contain the primary factor levels (e.g. WT, Mut) with optional additional columns for any secondary factors.
-
-Example:
-
-    ========== ============ =========
-    **Sample** **Genotype** **Batch**
-    ---------- ------------ ---------
-    WT1        WT           b1
-    WT2        WT           b2
-    WT3        WT           b3
-    Mut1       Mut          b1
-    Mut2       Mut          b2
-    Mut3       Mut          b3
-    ========== ============ =========
-
-*Factor Name:* The name of the experimental factor being investigated e.g. Genotype, Treatment. One factor must be entered and spaces must not be used. Optionally, additional factors can be included, these are variables that might influence your experiment e.g. Batch, Gender, Subject. If additional factors are entered, edgeR will fit an additive linear model.
-
-*Groups:* The names of the groups for the factor. These must be entered in the same order as the samples (to which the groups correspond) are listed in the columns of the counts matrix. Spaces must not be used and if entered into the tool form above, the values should be separated by commas.
-
 
 **Gene Annotations:**
 Optional input for gene annotations, this can contain more
@@ -698,6 +682,27 @@
     11305        Abca2       ATP-binding cassette, sub-family A (ABC1), member 2
     ==========  ==========  ===================================================
 
+**Factor Information:**
+Enter factor names and groups in the tool form, or provide a tab-separated file that has the names of the samples in the first column and one header row. The sample names must be the same as the names in the columns of the count matrix. The second column should contain the primary factor levels (e.g. WT, Mut) with optional additional columns for any secondary factors.
+
+Example:
+
+    ========== ============ =========
+    **Sample** **Genotype** **Batch**
+    ---------- ------------ ---------
+    WT1        WT           b1
+    WT2        WT           b2
+    WT3        WT           b3
+    Mut1       Mut          b1
+    Mut2       Mut          b2
+    Mut3       Mut          b3
+    ========== ============ =========
+
+*Factor Name:* The name of the experimental factor being investigated e.g. Genotype, Treatment. One factor must be entered and spaces must not be used. Optionally, additional factors can be included, these are variables that might influence your experiment e.g. Batch, Gender, Subject. If additional factors are entered, an additive linear model will be used.
+
+*Groups:* The names of the groups for the factor. These must be entered in the same order as the samples (to which the groups correspond) are listed in the columns of the counts matrix. Spaces must not be used and if entered into the tool form above, the values should be separated by commas.
+
+
 **Contrasts of Interest:**
 The contrasts you wish to make between levels.
 A common contrast would be a simple difference between two levels: "Mut-WT"
b
diff -r d79ed3ec25fe -r 4730985c816f test-data/factorinfo.txt
--- a/test-data/factorinfo.txt Sun May 06 13:38:41 2018 -0400
+++ b/test-data/factorinfo.txt Sat Jan 05 05:32:33 2019 -0500
b
@@ -1,7 +1,7 @@
 Sample Genotype Batch
-Mut1 Mut b1
+WT3 WT b3
 Mut2 Mut b2
 Mut3 Mut b3
 WT1 WT b1
 WT2 WT b2
-WT3 WT b3
+Mut1 Mut b1
b
diff -r d79ed3ec25fe -r 4730985c816f test-data/out_rscript.txt
--- a/test-data/out_rscript.txt Sun May 06 13:38:41 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
b'@@ -1,748 +0,0 @@\n-# This tool takes in a matrix of feature counts as well as gene annotations and\n-# outputs a table of top expressions as well as various plots for differential\n-# expression analysis\n-#\n-# ARGS: htmlPath", "R", 1, "character"      -Path to html file linking to other outputs\n-#       outPath", "o", 1, "character"       -Path to folder to write all output to\n-#       filesPath", "j", 2, "character"     -JSON list object if multiple files input\n-#       matrixPath", "m", 2, "character"    -Path to count matrix\n-#       factFile", "f", 2, "character"      -Path to factor information file\n-#       factInput", "i", 2, "character"     -String containing factors if manually input  \n-#       annoPath", "a", 2, "character"      -Path to input containing gene annotations\n-#       contrastData", "C", 1, "character"  -String containing contrasts of interest\n-#       cpmReq", "c", 2, "double"           -Float specifying cpm requirement\n-#       cntReq", "z", 2, "integer"          -Integer specifying minimum total count requirement\n-#       sampleReq", "s", 2, "integer"       -Integer specifying cpm requirement\n-#       normCounts", "x", 0, "logical"      -String specifying if normalised counts should be output \n-#       rdaOpt", "r", 0, "logical"          -String specifying if RData should be output\n-#       lfcReq", "l", 1, "double"           -Float specifying the log-fold-change requirement   \n-#       pValReq", "p", 1, "double"          -Float specifying the p-value requirement\n-#       pAdjOpt", "d", 1, "character"       -String specifying the p-value adjustment method \n-#       normOpt", "n", 1, "character"       -String specifying type of normalisation used \n-#       robOpt", "b", 0, "logical"          -String specifying if robust options should be used \n-#       lrtOpt", "t", 0, "logical"          -String specifying whether to perform LRT test instead \n-#\n-# OUT: \n-#       MDS Plot \n-#       BCV Plot\n-#       QL Plot\n-#       MD Plot\n-#       Expression Table\n-#       HTML file linking to the ouputs\n-# Optional:\n-#       Normalised counts Table\n-#       RData file\n-#\n-# Author: Shian Su - registertonysu@gmail.com - Jan 2014\n-# Modified by: Maria Doyle - Oct 2017 (some code taken from the DESeq2 wrapper)\n-\n-# Record starting time\n-timeStart <- as.character(Sys.time())\n-\n-# setup R error handling to go to stderr\n-options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )\n-\n-# we need that to not crash galaxy with an UTF8 error on German LC settings.\n-loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")\n-\n-# Load all required libraries\n-library(methods, quietly=TRUE, warn.conflicts=FALSE)\n-library(statmod, quietly=TRUE, warn.conflicts=FALSE)\n-library(splines, quietly=TRUE, warn.conflicts=FALSE)\n-library(edgeR, quietly=TRUE, warn.conflicts=FALSE)\n-library(limma, quietly=TRUE, warn.conflicts=FALSE)\n-library(scales, quietly=TRUE, warn.conflicts=FALSE)\n-library(getopt, quietly=TRUE, warn.conflicts=FALSE)\n-\n-################################################################################\n-### Function Delcaration\n-################################################################################\n-# Function to sanitise contrast equations so there are no whitespaces\n-# surrounding the arithmetic operators, leading or trailing whitespace\n-sanitiseEquation <- function(equation) {\n-    equation <- gsub(" *[+] *", "+", equation)\n-    equation <- gsub(" *[-] *", "-", equation)\n-    equation <- gsub(" *[/] *", "/", equation)\n-    equation <- gsub(" *[*] *", "*", equation)\n-    equation <- gsub("^\\\\s+|\\\\s+$", "", equation)\n-    return(equation)\n-}\n-\n-# Function to sanitise group information\n-sanitiseGroups <- function(string) {\n-    string <- gsub(" *[,] *", ",", string)\n-    string <- gsub("^\\\\s+|\\\\s+$", "", string)\n-    return(string)\n-}\n-\n-# Function to change periods to whitespace in a string\n-unmake.names <- function(string) {\n-    string <- gsub(".", " ", string, fixed=TRUE)'..b'ck floppy disc icon associated history item to download ")\n-cata("all files.</p>\\n")\n-cata("<p>.tsv files can be viewed in Excel or any spreadsheet program.</p>\\n")\n-\n-cata("<h4>Additional Information</h4>\\n")\n-cata("<ul>\\n")\n-\n-if (filtCPM || filtSmpCount || filtTotCount) {\n-    if (filtCPM) {\n-    tempStr <- paste("Genes without more than", opt$cpmReq,\n-                                     "CPM in at least", opt$sampleReq, "samples are insignificant",\n-                                     "and filtered out.")\n-    } else if (filtSmpCount) {\n-        tempStr <- paste("Genes without more than", opt$cntReq,\n-                                     "counts in at least", opt$sampleReq, "samples are insignificant",\n-                                     "and filtered out.")\n-    } else if (filtTotCount) {\n-            tempStr <- paste("Genes without more than", opt$cntReq,\n-                                     "counts, after summing counts for all samples, are insignificant",\n-                                     "and filtered out.")\n-    }\n-\n-    ListItem(tempStr)\n-    filterProp <- round(filteredCount/preFilterCount*100, digits=2)\n-    tempStr <- paste0(filteredCount, " of ", preFilterCount," (", filterProp,\n-                                     "%) genes were filtered out for low expression.")\n-    ListItem(tempStr)\n-}\n-ListItem(opt$normOpt, " was the method used to normalise library sizes.")\n-if (wantLRT) {\n-    ListItem("The edgeR likelihood ratio test was used.")\n-} else {\n-    if (wantRobust) {\n-        ListItem("The edgeR quasi-likelihood test was used with robust settings (robust=TRUE with estimateDisp and glmQLFit).")\n-    } else {\n-            ListItem("The edgeR quasi-likelihood test was used.")\n-    }\n-}\n-if (opt$pAdjOpt!="none") {\n-    if (opt$pAdjOpt=="BH" || opt$pAdjOpt=="BY") {\n-        tempStr <- paste0("MD-Plot highlighted genes are significant at FDR ",\n-                                            "of ", opt$pValReq," and exhibit log2-fold-change of at ", \n-                                            "least ", opt$lfcReq, ".")\n-        ListItem(tempStr)\n-    } else if (opt$pAdjOpt=="holm") {\n-        tempStr <- paste0("MD-Plot highlighted genes are significant at adjusted ",\n-                                            "p-value of ", opt$pValReq,"  by the Holm(1979) ",\n-                                            "method, and exhibit log2-fold-change of at least ", \n-                                            opt$lfcReq, ".")\n-        ListItem(tempStr)\n-    }\n-} else {\n-    tempStr <- paste0("MD-Plot highlighted genes are significant at p-value ",\n-                                        "of ", opt$pValReq," and exhibit log2-fold-change of at ", \n-                                        "least ", opt$lfcReq, ".")\n-    ListItem(tempStr)\n-}\n-cata("</ul>\\n")\n-\n-cata("<h4>Summary of experimental data:</h4>\\n")\n-\n-cata("<p>*CHECK THAT SAMPLES ARE ASSOCIATED WITH CORRECT GROUP(S)*</p>\\n")\n-\n-cata("<table border=\\"1\\" cellpadding=\\"3\\">\\n")\n-cata("<tr>\\n")\n-TableHeadItem("SampleID")\n-TableHeadItem(names(factors)[1], " (Primary Factor)")\n-\n-    if (ncol(factors) > 1) {\n-        for (i in names(factors)[2:length(names(factors))]) {\n-            TableHeadItem(i)\n-        }\n-        cata("</tr>\\n")\n-    }\n-\n-for (i in 1:nrow(factors)) {\n-    cata("<tr>\\n")\n-    TableHeadItem(row.names(factors)[i])\n-    for (j in 1:ncol(factors)) {\n-        TableItem(as.character(unmake.names(factors[i, j])))\n-    }\n-    cata("</tr>\\n")\n-}\n-cata("</table>")\n-\n-for (i in 1:nrow(linkData)) {\n-    if (grepl("session_info", linkData$Link[i])) {\n-        HtmlLink(linkData$Link[i], linkData$Label[i])\n-    }\n-}\n-\n-cata("<table border=\\"0\\">\\n")\n-cata("<tr>\\n")\n-TableItem("Task started at:"); TableItem(timeStart)\n-cata("</tr>\\n")\n-cata("<tr>\\n")\n-TableItem("Task ended at:"); TableItem(timeEnd)\n-cata("</tr>\\n")\n-cata("<tr>\\n")\n-TableItem("Task run time:"); TableItem(timeTaken)\n-cata("<tr>\\n")\n-cata("</table>\\n")\n-\n-cata("</body>\\n")\n-cata("</html>")\n'