comparison GetNormalizedExpression.R @ 44:2ef1ee253951 draft

Uploaded
author ning
date Mon, 16 Jun 2014 16:24:48 -0400
parents
children
comparison
equal deleted inserted replaced
43:95d6a7a59632 44:2ef1ee253951
1 sink(file="/tmp/none")
2 sink("/dev/null")
3 options(warn=-1)
4 options(echo=F)
5
6 invisible("EBSeq")
7 suppressMessages(library("EBSeq"))
8
9 args <- commandArgs(trailingOnly = T)
10 inputfile <- args[1]
11 WhetherSampleName <- args[2]
12 outputfile <- args[3]
13 Boxplots<-args[4]
14 Sizesout <-args[5]
15
16 print(args)
17
18 if(WhetherSampleName=="y"){
19 ReadIn=read.table(inputfile,stringsAsFactors=F,header=T, sep="\t")
20 Names=names(ReadIn)[-1]
21 }
22 if(WhetherSampleName=="n"){
23 ReadIn=read.table(inputfile,stringsAsFactors=F,header=F, sep="\t")
24 Names=paste0("S",1:(length(ReadIn[1,])-1)) ##cms - added 11/11/13
25 }
26
27 GeneMat=do.call(cbind,ReadIn[-1])
28 rownames(GeneMat)=ReadIn[[1]]
29 if(WhetherSampleName=="y")colnames(GeneMat)=Names
30 if(WhetherSampleName=="n")colnames(GeneMat)=Names ##cms - added 11/11/13
31
32 Sizes=MedianNorm(GeneMat)
33
34 Data.norm=GetNormalizedMat(GeneMat, Sizes)
35
36 #write.table(round(Data.norm,2),file=outputfile,quote=F,col.names=T,row.names=T,sep = "\t")
37 write.table(round(Data.norm,2),file=outputfile,quote=F,col.names=NA,row.names=T,sep = "\t") ##cms - fixed on 11/11/13
38 pdf(Boxplots)
39 boxplot(Data.norm,log="y",ylim=c(10^-1,10^6),xlab="Sample",ylab="Normalized Expression") ##cms - added axis labels on 11/11/13
40 dev.off()
41
42 write.table(Sizes,file=Sizesout,quote=F,col.names=F,row.names=F,sep = "\t")
43