annotate GetNormalizedExpression.R @ 14:eb8e01ed3516 draft

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