comparison MetaRNASeq.R @ 35:a99bbda3cf1f draft

planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit e956e308e78c1c2d2c5ac7420621527f0d4dad28
author sblanck
date Thu, 21 Jun 2018 11:20:56 -0400
parents 0a74b8de4c10
children 07ac07715f22
comparison
equal deleted inserted replaced
34:0a74b8de4c10 35:a99bbda3cf1f
8 library("optparse") 8 library("optparse")
9 9
10 ##### Read options 10 ##### Read options
11 option_list=list( 11 option_list=list(
12 make_option("--input",type="character",default="NULL",help="list of rdata objects containing eset objects"), 12 make_option("--input",type="character",default="NULL",help="list of rdata objects containing eset objects"),
13 make_option("--fdr",type="character",default=NULL,help="Adjusted p-value threshold to be declared differentially expressed"), 13 make_option("--inputName",type="character",default=NULL,help="filenames of the Rddata objects"),
14 make_option("--nbreplicates",type="character",default=NULL,help="number of replicate per study"),
15 make_option("--fdr",type="character",default=NULL,help="Adjusted p-value threshold to be declared differentially expressed"),
14 make_option("--result",type="character",default=NULL,help="text file containing result of the meta-analysis"), 16 make_option("--result",type="character",default=NULL,help="text file containing result of the meta-analysis"),
15 make_option("--htmloutput",type="character",default=NULL,help="Output html report"), 17 make_option("--htmloutput",type="character",default=NULL,help="Output html report"),
16 make_option("--htmloutputpath",type="character",default="NULL",help="Path of output html report"), 18 make_option("--htmloutputpath",type="character",default="NULL",help="Path of output html report"),
17 make_option("--htmltemplate",type="character",default=NULL,help="html template)") 19 make_option("--htmltemplate",type="character",default=NULL,help="html template)")
18 ); 20 );
30 suppressPackageStartupMessages(require(affy)) 32 suppressPackageStartupMessages(require(affy))
31 suppressPackageStartupMessages(require(annaffy)) 33 suppressPackageStartupMessages(require(annaffy))
32 suppressPackageStartupMessages(require(VennDiagram)) 34 suppressPackageStartupMessages(require(VennDiagram))
33 suppressPackageStartupMessages(require(GEOquery)) 35 suppressPackageStartupMessages(require(GEOquery))
34 36
35 listInput <- trimws( unlist( strsplit(trimws(opt$input), "|") ) ) 37 listfiles <- trimws( unlist( strsplit(trimws(opt$input), ";") ) )
38 listfilenames <- trimws( unlist( strsplit(trimws(opt$inputName), ";") ) )
39 nbreplicates <- as.numeric(trimws( unlist( strsplit(trimws(opt$nbreplicates), ";") ) ))
36 40
37 listfiles=vector() 41 listfiles
38 listfilenames=vector() 42 listfilenames
39 nbreplicates=vector() 43 nbreplicates
40 44
41 for (i in 1:length(listInput)) 45
42 { 46
43 inputFileInfo <- unlist( strsplit( listInput[i], ';' ) ) 47 #for (i in 1:length(listInput))
44 listfiles=c(listfiles,inputFileInfo[1]) 48 #{
45 listfilenames=c(listfilenames,inputFileInfo[2]) 49 # inputFileInfo <- unlist( strsplit( listInput[i], ';' ) )
46 nbreplicates[i]=as.numeric(inputFileInfo[3]) 50 # listfiles=c(listfiles,inputFileInfo[1])
47 } 51 # listfilenames=c(listfilenames,inputFileInfo[2])
52 # nbreplicates[i]=as.numeric(inputFileInfo[3])
53 #}
48 54
49 55
50 outputfile <- opt$result 56 outputfile <- opt$result
51 result.html = opt$htmloutput 57 result.html = opt$htmloutput
52 html.files.path=opt$htmloutputpath 58 html.files.path=opt$htmloutputpath
53 result.template=opt$htmltemplate 59 result.template=opt$htmltemplate
60
61
62 html.files.path
54 63
55 alpha=as.numeric(opt$fdr) 64 alpha=as.numeric(opt$fdr)
56 65
57 listData=lapply(listfiles,read.table) 66 listData=lapply(listfiles,read.table)
58 orderData=lapply(listData, function(x) x[order(x[1]), ]) 67 orderData=lapply(listData, function(x) x[order(x[1]), ])
104 #write DE outputfile 113 #write DE outputfile
105 write.table(conflits, outputfile,sep="\t",,row.names=FALSE) 114 write.table(conflits, outputfile,sep="\t",,row.names=FALSE)
106 library(VennDiagram) 115 library(VennDiagram)
107 DE_num=apply(keepDE[,1:(length(listfiles)+2)], 2, FUN=function(x) which(x==1)) 116 DE_num=apply(keepDE[,1:(length(listfiles)+2)], 2, FUN=function(x) which(x==1))
108 #DE_num=apply(DEresults, 2, FUN=function(x) which(x==1)) 117 #DE_num=apply(DEresults, 2, FUN=function(x) which(x==1))
118 dir.create(html.files.path, showWarnings = TRUE, recursive = FALSE)
109 temp.venn.plot = file.path( html.files.path, paste("venn.png")) 119 temp.venn.plot = file.path( html.files.path, paste("venn.png"))
110 if (length(listfiles)<=2) { 120 if (length(listfiles)<=2) {
111 title="VENN DIAGRAM" 121 title="VENN DIAGRAM"
112 width=500 122 width=500
113 venn.plot<-venn.diagram(x=as.list(DE_num),filename=NULL, col="black", fill=1:length(DE_num)+1,alpha=0.6) 123 venn.plot<-venn.diagram(x=as.list(DE_num),filename=NULL, col="black", fill=1:length(DE_num)+1,alpha=0.6)