Mercurial > repos > sblanck > smagexp
annotate MetaMA.R @ 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 | f953fdee364c |
children |
rev | line source |
---|---|
9
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
1 #!/usr/bin/env Rscript |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
2 # setup R error handling to go to stderr |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
3 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
4 |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
5 # we need that to not crash galaxy with an UTF8 error on German LC settings. |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
6 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
7 |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
8 library("optparse") |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
9 |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
10 ##### Read options |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
11 option_list=list( |
20
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
12 make_option("--input",type="character",default="NULL",help="List of rdata objects containing eset objects"), |
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
13 make_option("--species",type="character",default="NULL",help="Species for annotations"), |
9
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
14 make_option("--htmloutput",type="character",default=NULL,help="Output html report"), |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
15 make_option("--htmloutputpath",type="character",default="NULL",help="Path of output html report"), |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
16 make_option("--htmltemplate",type="character",default=NULL,help="html template)") |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
17 ); |
2 | 18 |
9
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
19 opt_parser = OptionParser(option_list=option_list); |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
20 opt = parse_args(opt_parser); |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
21 |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
22 if(is.null(opt$input)){ |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
23 print_help(opt_parser) |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
24 stop("input required.", call.=FALSE) |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
25 } |
20
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
26 if(is.null(opt$species)){ |
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
27 print_help(opt_parser) |
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
28 stop("input required.", call.=FALSE) |
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
29 } |
2 | 30 |
9
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
31 #loading libraries |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
32 |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
33 suppressPackageStartupMessages(require(metaMA)) |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
34 suppressPackageStartupMessages(require(affy)) |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
35 suppressPackageStartupMessages(require(annaffy)) |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
36 suppressPackageStartupMessages(require(VennDiagram)) |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
37 suppressPackageStartupMessages(require(GEOquery)) |
36
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
38 suppressPackageStartupMessages(require(UpSetR)) |
9
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
39 |
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
40 listInput <- trimws( unlist( strsplit(trimws(opt$input), ",") ) ) |
20
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
41 species=opt$species |
9
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
42 |
2 | 43 rdataList=list() |
44 condition1List=list() | |
45 condition2List=list() | |
9
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
46 for (input in listInput) |
2 | 47 { |
9
328f4031e5d3
planemo upload commit f882a5ba78afeb368605beb3986936e86c485cbb-dirty
sblanck
parents:
2
diff
changeset
|
48 load(input) |
2 | 49 |
50 rdataList=c(rdataList,(eset)) | |
51 condition1List=c(condition1List,saveConditions[1]) | |
52 condition2List=c(condition2List,saveConditions[2]) | |
53 | |
54 } | |
55 | |
10
56267e3293b2
planemo upload commit 0ad899de37d891f387912b7abd63506605a25976-dirty
sblanck
parents:
9
diff
changeset
|
56 result.html<-opt$htmloutput |
56267e3293b2
planemo upload commit 0ad899de37d891f387912b7abd63506605a25976-dirty
sblanck
parents:
9
diff
changeset
|
57 result.path<-opt$htmloutputpath |
56267e3293b2
planemo upload commit 0ad899de37d891f387912b7abd63506605a25976-dirty
sblanck
parents:
9
diff
changeset
|
58 result.template<-opt$htmltemplate |
2 | 59 |
36
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
60 #showVenn<-function(res,file) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
61 #{ |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
62 # venn.plot<-venn.diagram(x = c(res[c(1:(length(res)-3))],meta=list(res$Meta)), |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
63 # filename = NULL, col = "black", |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
64 # fill = c(1:(length(res)-2)), |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
65 # margin=0.05, alpha = 0.6) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
66 # jpeg(file) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
67 # grid.draw(venn.plot) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
68 # dev.off() |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
69 #} |
2 | 70 |
20
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
71 if(!species %in% installed.packages()[,"Package"]) { |
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
72 source("https://bioconductor.org/biocLite.R") |
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
73 biocLite(species) |
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
74 } |
a4015af2ae12
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit a25677963b28019d4434bbe411b28168c912d71d
sblanck
parents:
10
diff
changeset
|
75 |
36
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
76 library(species,character.only = TRUE) |
2 | 77 x <- org.Hs.egUNIGENE |
78 mapped_genes <- mappedkeys(x) | |
79 link <- as.list(x[mapped_genes]) | |
80 | |
81 probe2unigene<-function(expset){ | |
82 #construction of the map probe->unigene | |
83 probes=rownames(exprs(expset)) | |
84 gene_id=fData(expset)[probes,"ENTREZ_GENE_ID"] | |
85 unigene=link[gene_id] | |
86 names(unigene)<-probes | |
87 probe_unigene=unigene | |
88 } | |
89 | |
90 unigene2probe<-function(map) | |
91 { | |
92 suppressWarnings(x <- cbind(unlist(map), names(map))) | |
93 unigene_probe=split(x[,2], x[,1]) | |
94 } | |
95 | |
96 convert2metaMA<-function(listStudies,mergemeth=mean) | |
97 { | |
98 if (!(class(listStudies) %in% c("list"))) { | |
99 stop("listStudies must be a list") | |
100 } | |
101 conv_unigene=lapply(listStudies, | |
102 FUN=function(x) unigene2probe(probe2unigene(x))) | |
103 | |
104 id=lapply(conv_unigene,names) | |
105 inter=Reduce(intersect,id) | |
106 if(length(inter)<=0){stop("no common genes")} | |
107 print(paste(length(inter),"genes in common")) | |
108 esets=lapply(1:length(listStudies),FUN=function(i){ | |
109 l=lapply(conv_unigene[[i]][inter], | |
110 FUN=function(x) exprs(listStudies[[i]])[x,,drop=TRUE]) | |
111 esetsgr=t(sapply(l,FUN=function(ll) if(is.null(dim(ll))){ll} | |
112 else{apply(ll,2,mergemeth)})) | |
113 esetsgr | |
114 }) | |
115 return(list(esets=esets,conv.unigene=conv_unigene)) | |
116 } | |
117 | |
118 normalization<-function(data){ | |
119 ex <- exprs(data) | |
120 qx <- as.numeric(quantile(ex, c(0., 0.25, 0.5, 0.75, 0.99, 1.0), na.rm=T)) | |
121 LogC <- (qx[5] > 100) || | |
122 (qx[6]-qx[1] > 50 && qx[2] > 0) || | |
123 (qx[2] > 0 && qx[2] < 1 && qx[4] > 1 && qx[4] < 2) | |
124 if (LogC) { ex[which(ex <= 0)] <- NaN | |
125 return (log2(ex)) } else { | |
126 return (ex) | |
127 } | |
128 } | |
129 | |
130 | |
131 filterCondition<-function(gset,condition1, condition2){ | |
132 selected=c(which((tolower(as.character(pData(gset)["source_name_ch1"][,1]))==condition1)), | |
133 which(tolower(as.character(pData(gset)["source_name_ch1"][,1]))==condition2)) | |
134 | |
135 return(gset[,selected]) | |
136 } | |
137 | |
138 rdatalist <- lapply(rdataList, FUN=function(datalist) normalization(datalist)) | |
139 | |
140 classes=list() | |
141 filteredRdataList=list() | |
142 for (i in 1:length(rdatalist)) | |
143 { | |
144 currentData=rdataList[[i]] | |
145 currentCondition1=condition1List[[i]] | |
146 currentCondition2=condition2List[[i]] | |
147 #currentData=filterCondition(currentData,currentCondition1,currentCondition2) | |
148 currentClasses=as.numeric(tolower(as.character(pData(currentData)["source_name_ch1"][,1]))==currentCondition1) | |
149 filteredRdataList=c(filteredRdataList,currentData) | |
150 classes=c(classes,list(currentClasses)) | |
151 #write(file="~/galaxy-modal/classes.txt",classes) | |
152 } | |
153 | |
154 #rdataList=filteredRdataList | |
155 conv=convert2metaMA(rdataList) | |
156 esets=conv$esets | |
157 conv_unigene=conv$conv.unigene | |
158 | |
159 #write(file="~/galaxy-modal/esets.txt",length(esets)) | |
160 #write(file="~/galaxy-modal/classes.txt",length(classes)) | |
161 res=pvalcombination(esets=esets,classes=classes,moderated="limma") | |
162 resIDDIRR=IDDIRR(res$Meta,res$AllIndStudies) | |
36
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
163 #length(res$Meta) |
2 | 164 Hs.Meta=rownames(esets[[1]])[res$Meta] |
165 origId.Meta=lapply(conv_unigene,FUN=function(vec) as.vector(unlist(vec[Hs.Meta]))) | |
166 | |
167 gpllist <- lapply(rdataList, FUN=function(ann) annotation(ann)) | |
168 platflist <- lapply(gpllist, FUN=function(gpl) getGEO(gpl, AnnotGPL=TRUE)) | |
169 ncbifdlist <- lapply(platflist, FUN=function(data) data.frame(attr(dataTable(data), "table"))) | |
170 ncbifdresult=lapply(1:length(origId.Meta), FUN=function(i) ncbifdlist[[i]][which(ncbifdlist[[i]]$ID %in% origId.Meta[[i]]),]) | |
171 ncbidfannot=do.call(rbind,ncbifdresult) | |
172 ncbidfannot <- subset(ncbidfannot, select=c("Platform_SPOTID","ID","Gene.symbol","Gene.title","Gene.ID","Chromosome.annotation","GO.Function.ID")) | |
173 | |
174 library(jsonlite) | |
175 matrixncbidfannot=as.matrix(ncbidfannot) | |
176 datajson=toJSON(matrixncbidfannot,pretty = TRUE) | |
177 summaryjson=toJSON(as.matrix(t(resIDDIRR)),pretty = TRUE) | |
178 | |
179 | |
180 #vennsplit=strsplit(result.venn,split="/")[[1]] | |
181 #venn=paste0("./",vennsplit[length(vennsplit)]) | |
182 | |
183 | |
184 vennFilename="venn.png" | |
185 vennFile=file.path(result.path,vennFilename) | |
186 library(VennDiagram) | |
187 flog.threshold(ERROR) | |
188 | |
189 #venn.plot<-venn.diagram(x = c(res[c(1:(length(res)-3))],meta=list(res$Meta)),filename = v, col = "black", fill = c(1:(length(res)-2)), margin=0.05, alpha = 0.6,imagetype = "png") | |
190 dir.create(result.path, showWarnings = TRUE, recursive = FALSE) | |
191 | |
192 showVenn<-function(liste,file) | |
193 { | |
194 venn.plot<-venn.diagram(x = liste, | |
195 filename = vennFilename, col = "black", | |
196 fill = 1:length(liste)+1, | |
197 margin=0.05, alpha = 0.6,imagetype = "png") | |
198 # png(file); | |
199 # grid.draw(venn.plot); | |
200 # dev.off(); | |
201 | |
202 } | |
203 | |
204 l=list() | |
205 for(i in 1:length(esets)) | |
206 { | |
207 l[[paste("study",i,sep="")]]<-res[[i]] | |
208 } | |
209 l[["Meta"]]=res[[length(res)-1]] | |
36
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
210 |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
211 if (length(l)<5) { |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
212 title="Venn diagram" |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
213 width=500 |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
214 showVenn(l,vennFile) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
215 } else { |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
216 title="Upsetr diagram" |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
217 width=1000 |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
218 png(vennFile,width=width,height=500) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
219 upset(fromList(as.list(l)), order.by = "freq") |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
220 dev.off() |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
221 } |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
222 |
2 | 223 file.copy(vennFilename,result.path) |
36
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
224 |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
225 htmlfile=readChar(result.template, file.info(result.template)$size) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
226 htmlfile=gsub(x=htmlfile,pattern = "###DATAJSON###",replacement = datajson, fixed = TRUE) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
227 htmlfile=gsub(x=htmlfile,pattern = "###SUMMARYJSON###",replacement = summaryjson, fixed = TRUE) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
228 htmlfile=gsub(x=htmlfile,pattern = "###VENN###",replacement = vennFilename, fixed = TRUE) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
229 tmlfile=gsub(x=htmlfile,pattern = "###WIDTH###",replacement = as.character(width), fixed = TRUE) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
230 htmlfile=gsub(x=htmlfile,pattern = "###TITLE###",replacement = title, fixed = TRUE) |
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
231 write(htmlfile,result.html) |
2 | 232 #l=list() |
233 #for(i in 1:length(esets)) | |
234 #{ | |
235 # l[[paste("study",i,sep="")]]<-res[[i]] | |
236 #} | |
237 #l[["Meta"]]=res[[length(res)-1]] | |
238 #showVenn(res,result.venn) | |
239 #writeLines(c("<h2>Venn diagram</h2>"),file.conn) | |
240 #writeLines(c("<img src='venn.png'><br/><br/>"),file.conn) | |
241 #writeLines(c("</body></html>"),file.conn) | |
36
22e1325aaa88
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 0d3497e4f84869670647f7a6ffceca64469a4c00
sblanck
parents:
21
diff
changeset
|
242 #close(file.conn) |