annotate GetNormalizedExpression.R @ 45:9bebd9fd9f1b draft default tip

Uploaded
author ning
date Mon, 16 Jun 2014 16:24:58 -0400
parents 2ef1ee253951
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
44
2ef1ee253951 Uploaded
ning
parents:
diff changeset
1 sink(file="/tmp/none")
2ef1ee253951 Uploaded
ning
parents:
diff changeset
2 sink("/dev/null")
2ef1ee253951 Uploaded
ning
parents:
diff changeset
3 options(warn=-1)
2ef1ee253951 Uploaded
ning
parents:
diff changeset
4 options(echo=F)
2ef1ee253951 Uploaded
ning
parents:
diff changeset
5
2ef1ee253951 Uploaded
ning
parents:
diff changeset
6 invisible("EBSeq")
2ef1ee253951 Uploaded
ning
parents:
diff changeset
7 suppressMessages(library("EBSeq"))
2ef1ee253951 Uploaded
ning
parents:
diff changeset
8
2ef1ee253951 Uploaded
ning
parents:
diff changeset
9 args <- commandArgs(trailingOnly = T)
2ef1ee253951 Uploaded
ning
parents:
diff changeset
10 inputfile <- args[1]
2ef1ee253951 Uploaded
ning
parents:
diff changeset
11 WhetherSampleName <- args[2]
2ef1ee253951 Uploaded
ning
parents:
diff changeset
12 outputfile <- args[3]
2ef1ee253951 Uploaded
ning
parents:
diff changeset
13 Boxplots<-args[4]
2ef1ee253951 Uploaded
ning
parents:
diff changeset
14 Sizesout <-args[5]
2ef1ee253951 Uploaded
ning
parents:
diff changeset
15
2ef1ee253951 Uploaded
ning
parents:
diff changeset
16 print(args)
2ef1ee253951 Uploaded
ning
parents:
diff changeset
17
2ef1ee253951 Uploaded
ning
parents:
diff changeset
18 if(WhetherSampleName=="y"){
2ef1ee253951 Uploaded
ning
parents:
diff changeset
19 ReadIn=read.table(inputfile,stringsAsFactors=F,header=T, sep="\t")
2ef1ee253951 Uploaded
ning
parents:
diff changeset
20 Names=names(ReadIn)[-1]
2ef1ee253951 Uploaded
ning
parents:
diff changeset
21 }
2ef1ee253951 Uploaded
ning
parents:
diff changeset
22 if(WhetherSampleName=="n"){
2ef1ee253951 Uploaded
ning
parents:
diff changeset
23 ReadIn=read.table(inputfile,stringsAsFactors=F,header=F, sep="\t")
2ef1ee253951 Uploaded
ning
parents:
diff changeset
24 Names=paste0("S",1:(length(ReadIn[1,])-1)) ##cms - added 11/11/13
2ef1ee253951 Uploaded
ning
parents:
diff changeset
25 }
2ef1ee253951 Uploaded
ning
parents:
diff changeset
26
2ef1ee253951 Uploaded
ning
parents:
diff changeset
27 GeneMat=do.call(cbind,ReadIn[-1])
2ef1ee253951 Uploaded
ning
parents:
diff changeset
28 rownames(GeneMat)=ReadIn[[1]]
2ef1ee253951 Uploaded
ning
parents:
diff changeset
29 if(WhetherSampleName=="y")colnames(GeneMat)=Names
2ef1ee253951 Uploaded
ning
parents:
diff changeset
30 if(WhetherSampleName=="n")colnames(GeneMat)=Names ##cms - added 11/11/13
2ef1ee253951 Uploaded
ning
parents:
diff changeset
31
2ef1ee253951 Uploaded
ning
parents:
diff changeset
32 Sizes=MedianNorm(GeneMat)
2ef1ee253951 Uploaded
ning
parents:
diff changeset
33
2ef1ee253951 Uploaded
ning
parents:
diff changeset
34 Data.norm=GetNormalizedMat(GeneMat, Sizes)
2ef1ee253951 Uploaded
ning
parents:
diff changeset
35
2ef1ee253951 Uploaded
ning
parents:
diff changeset
36 #write.table(round(Data.norm,2),file=outputfile,quote=F,col.names=T,row.names=T,sep = "\t")
2ef1ee253951 Uploaded
ning
parents:
diff changeset
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
2ef1ee253951 Uploaded
ning
parents:
diff changeset
38 pdf(Boxplots)
2ef1ee253951 Uploaded
ning
parents:
diff changeset
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
2ef1ee253951 Uploaded
ning
parents:
diff changeset
40 dev.off()
2ef1ee253951 Uploaded
ning
parents:
diff changeset
41
2ef1ee253951 Uploaded
ning
parents:
diff changeset
42 write.table(Sizes,file=Sizesout,quote=F,col.names=F,row.names=F,sep = "\t")
2ef1ee253951 Uploaded
ning
parents:
diff changeset
43