comparison GetNormalizedExpression.R @ 1:aebe98ba5c22 draft

Uploaded
author ning
date Fri, 15 Mar 2013 18:19:48 -0400
parents
children
comparison
equal deleted inserted replaced
0:e42c12a40df6 1:aebe98ba5c22
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 }
25
26 GeneMat=do.call(cbind,ReadIn[-1])
27 rownames(GeneMat)=ReadIn[[1]]
28 if(WhetherSampleName=="y")colnames(GeneMat)=Names
29
30
31 Sizes=MedianNorm(GeneMat)
32
33 Data.norm=GetNormalizedMat(GeneMat, Sizes)
34
35 write.table(round(Data.norm,2),file=outputfile,quote=F,col.names=T,row.names=T,sep = "\t")
36 pdf(Boxplots)
37 boxplot(Data.norm,log="y",ylim=c(10^-1,10^6))
38 dev.off()
39
40 write.table(Sizes,file=Sizesout,quote=F,col.names=F,row.names=F,sep = "\t")
41