changeset 36:22e1325aaa88 draft

planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
author sblanck
date Fri, 22 Jun 2018 04:30:31 -0400
parents a99bbda3cf1f
children 25b828010ca9
files MetaMA.R MetaMA.xml MetaMa_tpl.html MetaRNAseq.xml
diffstat 4 files changed, 62 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/MetaMA.R	Thu Jun 21 11:20:56 2018 -0400
+++ b/MetaMA.R	Fri Jun 22 04:30:31 2018 -0400
@@ -35,6 +35,7 @@
 suppressPackageStartupMessages(require(annaffy))
 suppressPackageStartupMessages(require(VennDiagram))
 suppressPackageStartupMessages(require(GEOquery))
+suppressPackageStartupMessages(require(UpSetR))
 
 listInput <- trimws( unlist( strsplit(trimws(opt$input), ",") ) )
 species=opt$species
@@ -56,23 +57,23 @@
 result.path<-opt$htmloutputpath
 result.template<-opt$htmltemplate
 
-showVenn<-function(res,file)
-{
-	venn.plot<-venn.diagram(x = c(res[c(1:(length(res)-3))],meta=list(res$Meta)),
-			filename = NULL, col = "black", 
-			fill = c(1:(length(res)-2)),
-			margin=0.05, alpha = 0.6)
-	jpeg(file)
-	grid.draw(venn.plot)
-	dev.off()
-}
+#showVenn<-function(res,file)
+#{
+#	venn.plot<-venn.diagram(x = c(res[c(1:(length(res)-3))],meta=list(res$Meta)),
+#			filename = NULL, col = "black", 
+#			fill = c(1:(length(res)-2)),
+#			margin=0.05, alpha = 0.6)
+#	jpeg(file)
+#	grid.draw(venn.plot)
+#	dev.off()
+#}
 
 if(!species %in% installed.packages()[,"Package"]) {
 	source("https://bioconductor.org/biocLite.R")
 	biocLite(species)
 }
 
-library("org.Hs.eg.db")
+library(species,character.only = TRUE)
 x <- org.Hs.egUNIGENE
 mapped_genes <- mappedkeys(x)
 link <- as.list(x[mapped_genes])
@@ -159,7 +160,7 @@
 #write(file="~/galaxy-modal/classes.txt",length(classes))
 res=pvalcombination(esets=esets,classes=classes,moderated="limma")
 resIDDIRR=IDDIRR(res$Meta,res$AllIndStudies)
-length(res$Meta)
+#length(res$Meta)
 Hs.Meta=rownames(esets[[1]])[res$Meta]
 origId.Meta=lapply(conv_unigene,FUN=function(vec) as.vector(unlist(vec[Hs.Meta])))
 
@@ -182,12 +183,6 @@
 
 vennFilename="venn.png"
 vennFile=file.path(result.path,vennFilename)
-htmlfile=readChar(result.template, file.info(result.template)$size)
-htmlfile=gsub(x=htmlfile,pattern = "###DATAJSON###",replacement = datajson, fixed = TRUE)
-htmlfile=gsub(x=htmlfile,pattern = "###SUMMARYJSON###",replacement = summaryjson, fixed = TRUE)
-htmlfile=gsub(x=htmlfile,pattern = "###VENN###",replacement = vennFilename, fixed = TRUE)
-write(htmlfile,result.html)
-
 library(VennDiagram)
 flog.threshold(ERROR)
 
@@ -212,8 +207,28 @@
 	l[[paste("study",i,sep="")]]<-res[[i]]
 }
 l[["Meta"]]=res[[length(res)-1]]
-showVenn(l,vennFile)
+
+if (length(l)<5) {
+	title="Venn diagram"
+	width=500
+	showVenn(l,vennFile)
+}	else {
+	title="Upsetr diagram"
+	width=1000
+	png(vennFile,width=width,height=500)
+	upset(fromList(as.list(l)), order.by = "freq")
+	dev.off()
+}
+
 file.copy(vennFilename,result.path)
+
+htmlfile=readChar(result.template, file.info(result.template)$size)
+htmlfile=gsub(x=htmlfile,pattern = "###DATAJSON###",replacement = datajson, fixed = TRUE)
+htmlfile=gsub(x=htmlfile,pattern = "###SUMMARYJSON###",replacement = summaryjson, fixed = TRUE)
+htmlfile=gsub(x=htmlfile,pattern = "###VENN###",replacement = vennFilename, fixed = TRUE)
+tmlfile=gsub(x=htmlfile,pattern = "###WIDTH###",replacement = as.character(width), fixed = TRUE)
+htmlfile=gsub(x=htmlfile,pattern = "###TITLE###",replacement = title, fixed = TRUE)
+write(htmlfile,result.html)
 #l=list()
 #for(i in 1:length(esets))
 #{
@@ -224,4 +239,4 @@
 #writeLines(c("<h2>Venn diagram</h2>"),file.conn)
 #writeLines(c("<img src='venn.png'><br/><br/>"),file.conn)
 #writeLines(c("</body></html>"),file.conn)
-#close(file.conn)
\ No newline at end of file
+#close(file.conn)
--- a/MetaMA.xml	Thu Jun 21 11:20:56 2018 -0400
+++ b/MetaMA.xml	Fri Jun 22 04:30:31 2018 -0400
@@ -10,6 +10,7 @@
         <requirement type="package">r-venndiagram</requirement>
         <requirement type="package">r-metama</requirement>
         <requirement type="package">r-optparse</requirement>
+        <requirement type="package" version="1.3.3">r-upsetr</requirement>
     </requirements>
 
     <stdio>
@@ -57,7 +58,7 @@
 		
 **Results**
 		
-- Venn Diagram summarizing the results of the meta-analysis
+- Venn Diagram or upsetR diagram (when the number of studies is greater than 2) summarizing the results of the meta-analysis
 - A list of indicators to evaluate the quality of the performance of the meta-analysis
 		
 	- DE : Number of differentially expressed genes 
--- a/MetaMa_tpl.html	Thu Jun 21 11:20:56 2018 -0400
+++ b/MetaMa_tpl.html	Fri Jun 22 04:30:31 2018 -0400
@@ -167,8 +167,8 @@
 <body>
 
 <table><tr><td>
-<h2>Venn diagram</h2>
-<img src='###VENN###'  height="400" width="400"><br/>
+<h2>###TITLE###</h2>
+<img src='###VENN###'  height="500" width=###WIDTH###><br/>
 </td><td>
 
 </td></tr></table>
--- a/MetaRNAseq.xml	Thu Jun 21 11:20:56 2018 -0400
+++ b/MetaRNAseq.xml	Fri Jun 22 04:30:31 2018 -0400
@@ -64,7 +64,29 @@
     </tests>
 
     <help>
-
+<![CDATA[ 
+**What it does**
+		
+Given several DESeq2 results this tool runs a meta-analysis using the metaRNAseq R package.
+		
+**Inputs**
+At list 2 studies
+- Results of DESeq2 study
+- Number of replicate of the study			
+	
+**Results**
+		
+- Venn Diagram or upsetR diagram (when the number of studies is greater than 2) summarizing the results of the meta-analysis
+- A list of indicators to evaluate the quality of the performance of the meta-analysis
+		
+	- DE : Number of differentially expressed genes 
+	- IDD (Integration Driven discoveries) : number of genes that are declared differentially expressed in the meta-analysis that were not identified in any of the single studies alone
+	- Loss : Number of genes that are identified differentially expressed in single studies but not in meta-analysis 
+	- DR (Integration-driven Discovery Rate) : corresponding proportion of IDD
+	- IRR (Integration-driven Revision) : corresponding proportion of Loss
+		
+- Fully sortable and requestable table, with gene annotations and hypertext links to NCBI gene database.
+]]>
     </help>
 
 </tool>