36
|
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 CondIn <- args[3]
|
|
13 PatternFile <- args[5]
|
|
14 Ig.file <- args[4]
|
|
15 outputfile <- args[6]
|
|
16 MAP.out<-args[7]
|
|
17 Sizesout <-args[8]
|
|
18
|
|
19 #write.table(args,file=outputfile,quote=F,col.names=T,row.names=T,sep = "\t")
|
|
20
|
|
21
|
|
22 Conditions=strsplit(CondIn,split=",")[[1]]
|
|
23 if(WhetherSampleName=="y"){
|
|
24 ReadIn=read.table(inputfile,stringsAsFactors=F,header=T, sep="\t")
|
|
25 #ReadIn=read.table(inputfile,stringsAsFactors=F,header=T, sep="\t", row.names=1) ##cms - changed on 11/18/13
|
|
26 Names=names(ReadIn)[-1]
|
|
27 }
|
|
28 if(WhetherSampleName=="n"){
|
|
29 ReadIn=read.table(inputfile,stringsAsFactors=F,header=F, sep="\t")
|
|
30 #ReadIn=read.table(inputfile,stringsAsFactors=F,header=F, sep="\t", row.names=1) ##cms - changed on 11/18/13
|
|
31 Names=paste0("S",1:length(Conditions))
|
|
32 }
|
|
33
|
|
34 #PatternIn=read.table(PatternFile,stringsAsFactors=F,header=T,sep="\t")
|
|
35 PatternIn=read.table(PatternFile,stringsAsFactors=F,header=T,sep="\t",row.names=1) ##cms - changed on 11/15/13
|
|
36 IgVIn=read.table(Ig.file,stringsAsFactors=F,header=F,sep="\t")
|
|
37 IgV=IgVIn[[1]]
|
|
38
|
|
39 if(class(ReadIn[[1]])=="character"){
|
|
40 GeneMat=do.call(cbind,ReadIn[-1])
|
|
41 rownames(GeneMat)=ReadIn[[1]]
|
|
42 colnames(GeneMat)=Names
|
|
43 }
|
|
44 if(class(ReadIn[[1]])=="numeric"){
|
|
45 GeneMat=data.matrix(ReadIn)
|
|
46 colnames(GeneMat)=Names
|
|
47 }
|
|
48
|
|
49 Patterns=data.matrix(PatternIn)
|
|
50
|
|
51 Sizes=MedianNorm(GeneMat)
|
|
52 #write.table(Conditions,file=outputfile,quote=F,col.names=T,row.names=T,sep = "\t")
|
|
53 EBOut=EBMultiTest(Data=GeneMat,NgVector=IgV,Conditions=as.factor(Conditions),
|
|
54 AllParti=Patterns,sizeFactors=Sizes, maxround=5)
|
|
55 PPout=GetMultiPP(EBOut)
|
|
56 MultiPP=PPout$PP
|
|
57 MultiMAP=PPout$MAP
|
|
58 Data.norm=round(GetNormalizedMat(GeneMat, Sizes),2)
|
|
59
|
|
60 Mat=cbind(MultiMAP,Data.norm[names(MultiMAP),])
|
|
61
|
|
62 colnames(Mat)=
|
|
63 c("MAP",Names)
|
|
64 options(warn=-1)
|
|
65
|
|
66 #write.table(round(MultiPP,2),file=outputfile,quote=F,col.names=T,row.names=T,sep = "\t")
|
|
67 write.table(round(MultiPP,2),file=outputfile,quote=F,col.names=NA,row.names=T,sep = "\t") ##cms - changed on 11/20/13
|
|
68 #write.table(Mat,file=MAP.out ,quote=F,col.names=T,row.names=T,sep = "\t")
|
|
69 write.table(Mat,file=MAP.out ,quote=F,col.names=NA,row.names=T,sep = "\t") ##cms - changed on 11/20/13
|
|
70 write.table(Sizes,file=Sizesout,quote=F,col.names=F,row.names=F,sep = "\t")
|
|
71
|