diff limma_voom.R @ 9:4255881bebb1 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 5f8052ab47b789da5ea47feb48e1b8e08b5fc1e0
author iuc
date Tue, 05 Jun 2018 04:28:56 -0400
parents 00a42b66e522
children e26047c4562d
line wrap: on
line diff
--- a/limma_voom.R	Tue May 15 02:36:36 2018 -0400
+++ b/limma_voom.R	Tue Jun 05 04:28:56 2018 -0400
@@ -345,6 +345,7 @@
 stripOutPdf <- character()
 mdvolOutPng <- character()
 topOut <- character()
+glimmaOut <- character()
 for (i in 1:length(contrastData)) {
     con <- contrastData[i]
     con <- gsub("\\(|\\)", "", con)
@@ -354,6 +355,7 @@
     stripOutPdf[i] <- makeOut(paste0("stripcharts_", con, ".pdf"))
     mdvolOutPng[i] <- makeOut(paste0("mdvolplot_", con, ".png"))
     topOut[i] <- makeOut(paste0(deMethod, "_", con, ".tsv"))
+    glimmaOut[i] <- makeOut(paste0("glimma_", con, "/MD-Plot.html"))
 }
 
 normOut <- makeOut(paste0(deMethod, "_normcounts.tsv"))
@@ -806,6 +808,17 @@
     linkData <- rbind(linkData, c(linkName, linkAddr))
     invisible(dev.off())
 
+    # Generate Glimma interactive MD plot and table, requires annotation file (assumes gene names in 2nd column)
+    if (haveAnno) {
+        Glimma::glMDPlot(fit, coef=i, counts=y$counts, anno=y$genes, groups=factors[, 1],
+             status=status[, i], sample.cols=col.group,
+             main=paste("MD Plot:", unmake.names(con)), side.main=colnames(y$genes)[2],
+             folder=paste0("glimma_", unmake.names(con)), launch=FALSE)
+        linkName <- paste0("Glimma_MDPlot_", con, ".html")
+        linkAddr <- paste0("glimma_", con, "/MD-Plot.html")
+        linkData <- rbind(linkData, c(linkName, linkAddr))
+    }
+
     # Plot Volcano
     pdf(volOutPdf[i])
     if (haveAnno) {
@@ -1014,6 +1027,13 @@
     }
 }
 
+cata("<h4>Glimma Interactive Results:</h4>\n")
+    for (i in 1:nrow(linkData)) {
+        if (grepl("glimma", linkData$Link[i])) {
+            HtmlLink(linkData$Link[i], linkData$Label[i])
+        }
+    }
+
 cata("<p>Alt-click links to download file.</p>\n")
 cata("<p>Click floppy disc icon associated history item to download ")
 cata("all files.</p>\n")