annotate MetaRNASeq.R @ 34:0a74b8de4c10 draft

planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 288d0dce1c0877bf9c3431a581d638b0ac336d3f
author sblanck
date Thu, 21 Jun 2018 10:41:50 -0400
parents 2c0df656094a
children a99bbda3cf1f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
1 #!/usr/bin/env Rscript
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
2 # setup R error handling to go to stderr
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
3 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
4
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
5 # we need that to not crash galaxy with an UTF8 error on German LC settings.
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
6 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
7
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
8 library("optparse")
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
9
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
10 ##### Read options
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
11 option_list=list(
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
12 make_option("--input",type="character",default="NULL",help="list of rdata objects containing eset objects"),
29
102e4ef8fed2 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 808ffb34e11a74cd2396e32868ea56f7ce8d83ff
sblanck
parents: 28
diff changeset
13 make_option("--fdr",type="character",default=NULL,help="Adjusted p-value threshold to be declared differentially expressed"),
14
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
14 make_option("--result",type="character",default=NULL,help="text file containing result of the meta-analysis"),
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
15 make_option("--htmloutput",type="character",default=NULL,help="Output html report"),
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
16 make_option("--htmloutputpath",type="character",default="NULL",help="Path of output html report"),
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
17 make_option("--htmltemplate",type="character",default=NULL,help="html template)")
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
18 );
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
19
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
20 opt_parser = OptionParser(option_list=option_list);
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
21 opt = parse_args(opt_parser);
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
22
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
23 if(is.null(opt$input)){
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
24 print_help(opt_parser)
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
25 stop("input required.", call.=FALSE)
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
26 }
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
27
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
28 #loading libraries
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
29
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
30 suppressPackageStartupMessages(require(affy))
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
31 suppressPackageStartupMessages(require(annaffy))
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
32 suppressPackageStartupMessages(require(VennDiagram))
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
33 suppressPackageStartupMessages(require(GEOquery))
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
34
34
0a74b8de4c10 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 288d0dce1c0877bf9c3431a581d638b0ac336d3f
sblanck
parents: 32
diff changeset
35 listInput <- trimws( unlist( strsplit(trimws(opt$input), "|") ) )
14
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
36
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
37 listfiles=vector()
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
38 listfilenames=vector()
29
102e4ef8fed2 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 808ffb34e11a74cd2396e32868ea56f7ce8d83ff
sblanck
parents: 28
diff changeset
39 nbreplicates=vector()
14
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
40
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
41 for (i in 1:length(listInput))
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
42 {
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
43 inputFileInfo <- unlist( strsplit( listInput[i], ';' ) )
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
44 listfiles=c(listfiles,inputFileInfo[1])
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
45 listfilenames=c(listfilenames,inputFileInfo[2])
31
8191cc63589c planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit c9785b0269101a3750bb2fa540f6830515090fba
sblanck
parents: 30
diff changeset
46 nbreplicates[i]=as.numeric(inputFileInfo[3])
14
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
47 }
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
48
29
102e4ef8fed2 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 808ffb34e11a74cd2396e32868ea56f7ce8d83ff
sblanck
parents: 28
diff changeset
49
14
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
50 outputfile <- opt$result
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
51 result.html = opt$htmloutput
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
52 html.files.path=opt$htmloutputpath
e5a94bc69bd6 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit da1436252b5db4e90c39c95140558f0f93544160
sblanck
parents: 2
diff changeset
53 result.template=opt$htmltemplate
2
93451f832736 Uploaded
sblanck
parents:
diff changeset
54
30
4048dae6ace8 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 904ac44909a062b118757205861451a3007158b6
sblanck
parents: 29
diff changeset
55 alpha=as.numeric(opt$fdr)
2
93451f832736 Uploaded
sblanck
parents:
diff changeset
56
93451f832736 Uploaded
sblanck
parents:
diff changeset
57 listData=lapply(listfiles,read.table)
93451f832736 Uploaded
sblanck
parents:
diff changeset
58 orderData=lapply(listData, function(x) x[order(x[1]), ])
93451f832736 Uploaded
sblanck
parents:
diff changeset
59 rawpval=lapply(orderData,function(x) x[6])
93451f832736 Uploaded
sblanck
parents:
diff changeset
60 rawpval=lapply(rawpval, function(x) as.numeric(unlist(x)))
93451f832736 Uploaded
sblanck
parents:
diff changeset
61
93451f832736 Uploaded
sblanck
parents:
diff changeset
62 DE=list()
93451f832736 Uploaded
sblanck
parents:
diff changeset
63 DE=lapply(orderData, function(x) ifelse(x[7]<=0.05,1,0))
93451f832736 Uploaded
sblanck
parents:
diff changeset
64
93451f832736 Uploaded
sblanck
parents:
diff changeset
65 FC=list()
93451f832736 Uploaded
sblanck
parents:
diff changeset
66 FC=lapply(orderData, function(x) x[3])
93451f832736 Uploaded
sblanck
parents:
diff changeset
67
93451f832736 Uploaded
sblanck
parents:
diff changeset
68 DE=as.data.frame(DE)
93451f832736 Uploaded
sblanck
parents:
diff changeset
69 colnames(DE)=listfilenames
93451f832736 Uploaded
sblanck
parents:
diff changeset
70 FC=as.data.frame(FC)
93451f832736 Uploaded
sblanck
parents:
diff changeset
71 colnames(FC)=listfilenames
93451f832736 Uploaded
sblanck
parents:
diff changeset
72
93451f832736 Uploaded
sblanck
parents:
diff changeset
73 # combinations
93451f832736 Uploaded
sblanck
parents:
diff changeset
74 library(metaRNASeq)
28
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
75 library(UpSetR)
2
93451f832736 Uploaded
sblanck
parents:
diff changeset
76 fishcomb<-fishercomb(rawpval, BHth=alpha)
93451f832736 Uploaded
sblanck
parents:
diff changeset
77 warning(length(rawpval))
29
102e4ef8fed2 planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 808ffb34e11a74cd2396e32868ea56f7ce8d83ff
sblanck
parents: 28
diff changeset
78 invnormcomb<-invnorm(rawpval, nrep=nbreplicates, BHth=alpha)
2
93451f832736 Uploaded
sblanck
parents:
diff changeset
79 #DE[["fishercomb"]]<-ifelse(fishcomb$adjpval<=alpha,1,0)
93451f832736 Uploaded
sblanck
parents:
diff changeset
80 #DE[["invnormcomb"]]<-ifelse(invnormcomb$adjpval<=alpha,1,0)
93451f832736 Uploaded
sblanck
parents:
diff changeset
81
93451f832736 Uploaded
sblanck
parents:
diff changeset
82 signsFC<-mapply(FC,FUN=function(x) sign(x))
93451f832736 Uploaded
sblanck
parents:
diff changeset
83 sumsigns<-apply(signsFC,1,sum)
93451f832736 Uploaded
sblanck
parents:
diff changeset
84 commonsgnFC<-ifelse(abs(sumsigns)==dim(signsFC)[2],sign(sumsigns),0)
93451f832736 Uploaded
sblanck
parents:
diff changeset
85
93451f832736 Uploaded
sblanck
parents:
diff changeset
86 DEresults <- data.frame(DE=DE,"DE.fishercomb"=ifelse(fishcomb$adjpval<=alpha,1,0),"DE.invnorm"=ifelse(invnormcomb$adjpval<=alpha,1,0))
93451f832736 Uploaded
sblanck
parents:
diff changeset
87
93451f832736 Uploaded
sblanck
parents:
diff changeset
88 unionDE <- unique(c(fishcomb$DEindices,invnormcomb$DEindices))
93451f832736 Uploaded
sblanck
parents:
diff changeset
89 FC.selecDE <- data.frame(DEresults[unionDE,],FC[unionDE,],signFC=commonsgnFC[unionDE])
93451f832736 Uploaded
sblanck
parents:
diff changeset
90 keepDE <- FC.selecDE[which(abs(FC.selecDE$signFC)==1),]
93451f832736 Uploaded
sblanck
parents:
diff changeset
91
93451f832736 Uploaded
sblanck
parents:
diff changeset
92 fishcomb_de <- rownames(keepDE)[which(keepDE[,"DE.fishercomb"]==1)]
93451f832736 Uploaded
sblanck
parents:
diff changeset
93 invnorm_de <- rownames(keepDE)[which(keepDE[,"DE.invnorm"]==1)]
93451f832736 Uploaded
sblanck
parents:
diff changeset
94 indstudy_de = list()
93451f832736 Uploaded
sblanck
parents:
diff changeset
95 for (i in 1:length(listfiles)) {
93451f832736 Uploaded
sblanck
parents:
diff changeset
96 currentIndstudy_de = rownames(keepDE)[which(keepDE[,i]==1)]
93451f832736 Uploaded
sblanck
parents:
diff changeset
97 indstudy_de[[listfilenames[i]]]=currentIndstudy_de
93451f832736 Uploaded
sblanck
parents:
diff changeset
98 }
93451f832736 Uploaded
sblanck
parents:
diff changeset
99
93451f832736 Uploaded
sblanck
parents:
diff changeset
100 IDDIRRfishcomb=IDD.IRR(fishcomb_de,indstudy_de)
93451f832736 Uploaded
sblanck
parents:
diff changeset
101 IDDIRRinvnorm=IDD.IRR(invnorm_de,indstudy_de)
93451f832736 Uploaded
sblanck
parents:
diff changeset
102
93451f832736 Uploaded
sblanck
parents:
diff changeset
103 conflits<-data.frame(ID=listData[[1]][rownames(DEresults),1],DE=DEresults,FC=FC,signFC=commonsgnFC)
93451f832736 Uploaded
sblanck
parents:
diff changeset
104 #write DE outputfile
93451f832736 Uploaded
sblanck
parents:
diff changeset
105 write.table(conflits, outputfile,sep="\t",,row.names=FALSE)
93451f832736 Uploaded
sblanck
parents:
diff changeset
106 library(VennDiagram)
28
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
107 DE_num=apply(keepDE[,1:(length(listfiles)+2)], 2, FUN=function(x) which(x==1))
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
108 #DE_num=apply(DEresults, 2, FUN=function(x) which(x==1))
32
2c0df656094a planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 071df0c8b84f98fb643b2b9eaa5e238b94ffa254
sblanck
parents: 31
diff changeset
109 temp.venn.plot = file.path( html.files.path, paste("venn.png"))
2c0df656094a planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 071df0c8b84f98fb643b2b9eaa5e238b94ffa254
sblanck
parents: 31
diff changeset
110 if (length(listfiles)<=2) {
28
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
111 title="VENN DIAGRAM"
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
112 width=500
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
113 venn.plot<-venn.diagram(x=as.list(DE_num),filename=NULL, col="black", fill=1:length(DE_num)+1,alpha=0.6)
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
114 png(temp.venn.plot,width=width,height=500)
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
115 grid.draw(venn.plot)
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
116 dev.off()
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
117 } else {
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
118 title="UPSETR DIAGRAM"
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
119 width=1000
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
120 png(temp.venn.plot,width=width,height=500)
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
121 upset(fromList(as.list(DE_num)), order.by = "freq")
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
122 dev.off()
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
123
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
124 }
49ce6fbe11de planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit cb90fdea2a64908e301355aef89de403e107764d
sblanck
parents: 24
diff changeset
125
2
93451f832736 Uploaded
sblanck
parents:
diff changeset
126
93451f832736 Uploaded
sblanck
parents:
diff changeset
127 library(jsonlite)
93451f832736 Uploaded
sblanck
parents:
diff changeset
128 matrixConflits=as.matrix(conflits)
93451f832736 Uploaded
sblanck
parents:
diff changeset
129 datajson=toJSON(matrixConflits,pretty = TRUE)
93451f832736 Uploaded
sblanck
parents:
diff changeset
130 summaryFishcombjson=toJSON(as.matrix(t(IDDIRRfishcomb)),pretty = TRUE)
93451f832736 Uploaded
sblanck
parents:
diff changeset
131 summaryinvnormjson=toJSON(as.matrix(t(IDDIRRinvnorm)),pretty = TRUE)
93451f832736 Uploaded
sblanck
parents:
diff changeset
132
93451f832736 Uploaded
sblanck
parents:
diff changeset
133 vennFilename="venn.png"
93451f832736 Uploaded
sblanck
parents:
diff changeset
134 vennFile=file.path(html.files.path,vennFilename)
93451f832736 Uploaded
sblanck
parents:
diff changeset
135 htmlfile=readChar(result.template, file.info(result.template)$size)
93451f832736 Uploaded
sblanck
parents:
diff changeset
136 htmlfile=gsub(x=htmlfile,pattern = "###DATAJSON###",replacement = datajson, fixed = TRUE)
93451f832736 Uploaded
sblanck
parents:
diff changeset
137 htmlfile=gsub(x=htmlfile,pattern = "###FISHSUMMARYJSON###",replacement = summaryFishcombjson, fixed = TRUE)
93451f832736 Uploaded
sblanck
parents:
diff changeset
138 htmlfile=gsub(x=htmlfile,pattern = "###INVSUMMARYJSON###",replacement = summaryinvnormjson, fixed = TRUE)
93451f832736 Uploaded
sblanck
parents:
diff changeset
139 htmlfile=gsub(x=htmlfile,pattern = "###VENN###",replacement = vennFilename, fixed = TRUE)
32
2c0df656094a planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 071df0c8b84f98fb643b2b9eaa5e238b94ffa254
sblanck
parents: 31
diff changeset
140 htmlfile=gsub(x=htmlfile,pattern = "###WIDTH###",replacement = as.character(width), fixed = TRUE)
2c0df656094a planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 071df0c8b84f98fb643b2b9eaa5e238b94ffa254
sblanck
parents: 31
diff changeset
141 htmlfile=gsub(x=htmlfile,pattern = "###TITLE###",replacement = title, fixed = TRUE)
2
93451f832736 Uploaded
sblanck
parents:
diff changeset
142 write(htmlfile,result.html)
93451f832736 Uploaded
sblanck
parents:
diff changeset
143