Mercurial > repos > sblanck > smagexp
annotate AffyQCnormalization.R @ 8:e4e6e583b8d9 draft default tip
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit ad301f84e16455ca3886e9b56e908180dfd66d4f
| author | sblanck | 
|---|---|
| date | Thu, 26 Jul 2018 08:17:53 -0400 | 
| parents | 1024245abc70 | 
| children | 
| rev | line source | 
|---|---|
| 0 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 1 #!/usr/bin/env Rscript | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 2 # setup R error handling to go to stderr | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 3 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 4 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 5 # we need that to not crash galaxy with an UTF8 error on German LC settings. | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 6 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 7 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 8 library("optparse") | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 9 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 10 ##### Read options | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 11 option_list=list( | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 12 make_option("--input",type="character",default="NULL",help="rdata object containing eset object"), | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 13 make_option("--normalization",type="character",default=NULL,help="normalization method"), | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 14 make_option("--nbresult",type="character",default=NULL,help="number of result displayed results"), | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 15 make_option("--rdataoutput",type="character",default="NULL",help="output rdata object containing eset object"), | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 16 make_option("--htmloutput",type="character",default=NULL,help="Output html report"), | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 17 make_option("--htmloutputpath",type="character",default="NULL",help="Path of output html report"), | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 18 make_option("--htmltemplate",type="character",default=NULL,help="html template)") | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 19 ); | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 20 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 21 opt_parser = OptionParser(option_list=option_list); | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 22 opt = parse_args(opt_parser); | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 23 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 24 if(is.null(opt$input)){ | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 25 print_help(opt_parser) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 26 stop("input required.", call.=FALSE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 27 } | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 28 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 29 #loading libraries | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 30 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 31 suppressPackageStartupMessages(require(Biobase)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 32 suppressPackageStartupMessages(require(GEOquery)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 33 suppressPackageStartupMessages(require(GEOmetadb)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 34 suppressPackageStartupMessages(require(limma)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 35 suppressPackageStartupMessages(require(jsonlite)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 36 suppressPackageStartupMessages(require(affy)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 37 suppressPackageStartupMessages(require(affyPLM)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 38 suppressPackageStartupMessages(require(dplyr)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 39 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 40 listInput <- trimws( unlist( strsplit(trimws(opt$input), ",") ) ) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 41 | 
| 8 
e4e6e583b8d9
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit ad301f84e16455ca3886e9b56e908180dfd66d4f
 sblanck parents: 
0diff
changeset | 42 listInput <- trimws( unlist( strsplit(trimws(opt$input), ",") ) ) | 
| 
e4e6e583b8d9
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit ad301f84e16455ca3886e9b56e908180dfd66d4f
 sblanck parents: 
0diff
changeset | 43 if(length(listInput)<2){ | 
| 
e4e6e583b8d9
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit ad301f84e16455ca3886e9b56e908180dfd66d4f
 sblanck parents: 
0diff
changeset | 44 stop("To few .CEL files selected : At least 2 .CEL files are required", call.=FALSE) | 
| 
e4e6e583b8d9
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit ad301f84e16455ca3886e9b56e908180dfd66d4f
 sblanck parents: 
0diff
changeset | 45 } | 
| 
e4e6e583b8d9
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit ad301f84e16455ca3886e9b56e908180dfd66d4f
 sblanck parents: 
0diff
changeset | 46 | 
| 
e4e6e583b8d9
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit ad301f84e16455ca3886e9b56e908180dfd66d4f
 sblanck parents: 
0diff
changeset | 47 | 
| 0 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 48 celList=vector() | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 49 celFileNameList=vector() | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 50 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 51 for (i in 1:length(listInput)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 52 { | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 53 inputFileInfo <- unlist( strsplit( listInput[i], ';' ) ) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 54 celList=c(celList,inputFileInfo[1]) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 55 celFileNameList=c(celFileNameList,inputFileInfo[2]) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 56 } | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 57 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 58 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 59 normalization=opt$normalization | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 60 result_export_eset=opt$rdataoutput | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 61 result=opt$htmloutput | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 62 result.path=opt$htmloutputpath | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 63 result.template=opt$htmltemplate | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 64 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 65 dir.create(result.path, showWarnings = TRUE, recursive = TRUE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 66 for(i in 1:length(celList)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 67 { | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 68 file.copy(celList[i],paste0("./",celFileNameList[i])) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 69 } | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 70 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 71 data <- ReadAffy(filenames=celFileNameList, celfile.path=".") | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 72 htmlfile=readChar(result.template, file.info(result.template)$size) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 73 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 74 boxplot="boxplot.png" | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 75 png(boxplot,width=800,height = 400) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 76 par(mar=c(7,5,1,1)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 77 boxplot(data,las=2,outline=FALSE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 78 dev.off() | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 79 htmlfile=gsub(x=htmlfile,pattern = "###BOXPLOT###",replacement = boxplot, fixed = TRUE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 80 file.copy(boxplot,result.path) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 81 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 82 images="images.png" | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 83 nblines=length(celList)%/%4 + as.numeric((length(celList)%%4)!=0) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 84 png(images,width=800,height = 200*nblines) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 85 par(mfrow=c(nblines,4)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 86 image(data) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 87 dev.off() | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 88 htmlfile=gsub(x=htmlfile,pattern = "###IMAGES###",replacement = images, fixed = TRUE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 89 file.copy(images,result.path) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 90 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 91 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 92 plotMA="plotMA.png" | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 93 nblines=length(celList)%/%3 + as.numeric((length(celList)%%3)!=0) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 94 png(plotMA,width=800,height =300*nblines ) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 95 par(mfrow=c(nblines,3)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 96 MAplot(data) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 97 dev.off() | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 98 htmlfile=gsub(x=htmlfile,pattern = "###PLOTMA###",replacement = plotMA, fixed = TRUE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 99 file.copy(plotMA,result.path) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 100 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 101 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 102 if (normalization == "rma") { | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 103 eset <- rma(data) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 104 } else if (normalization == "quantile") { | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 105 eset = rma(data,background = FALSE,normalize = TRUE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 106 } else if (normalization == "background"){ | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 107 eset = rma(data,background = TRUE ,normalize = FALSE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 108 } else if (normalization == "log2") { | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 109 eset = rma(data,background = FALSE ,normalize = FALSE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 110 } | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 111 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 112 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 113 boxplotnorm="boxplotnorm.png" | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 114 png(boxplotnorm,width=800,height = 400) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 115 par(mar=c(7,5,1,1)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 116 boxplot(data.frame(exprs(eset)),las=2,outline=FALSE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 117 dev.off() | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 118 htmlfile=gsub(x=htmlfile,pattern = "###BOXPLOTNORM###",replacement = boxplotnorm, fixed = TRUE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 119 file.copy(boxplotnorm,result.path) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 120 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 121 plotMAnorm="plotMAnorm.png" | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 122 nblines=length(celList)%/%3 + as.numeric((length(celList)%%3)!=0) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 123 png(plotMAnorm,width=800,height =300*nblines ) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 124 par(mfrow=c(nblines,3)) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 125 #for (i in 1:length(celList)){ | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 126 MAplot(eset) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 127 #} | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 128 | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 129 dev.off() | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 130 htmlfile=gsub(x=htmlfile,pattern = "###PLOTMANORM###",replacement = plotMAnorm, fixed = TRUE) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 131 file.copy(plotMAnorm,result.path) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 132 save(eset,file=result_export_eset) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 133 write(htmlfile,result) | 
| 
1024245abc70
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit 5974f806f344dbcc384b931492d7f023bfbbe03b
 sblanck parents: diff
changeset | 134 | 
