Mercurial > repos > ning > ebseq
comparison EBIsoformMultiCondTest.R @ 9:c20070b11b55 draft
Uploaded
author | ning |
---|---|
date | Fri, 15 Mar 2013 18:22:24 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
8:03aa1c6fe091 | 9:c20070b11b55 |
---|---|
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 Names=names(ReadIn)[-1] | |
26 } | |
27 if(WhetherSampleName=="n"){ | |
28 ReadIn=read.table(inputfile,stringsAsFactors=F,header=F, sep="\t") | |
29 Names=paste0("S",1:length(Conditions)) | |
30 } | |
31 | |
32 PatternIn=read.table(PatternFile,stringsAsFactors=F,header=T,sep="\t") | |
33 IgVIn=read.table(Ig.file,stringsAsFactors=F,header=F,sep="\t") | |
34 IgV=IgVIn[[1]] | |
35 | |
36 if(class(ReadIn[[1]])=="character"){ | |
37 GeneMat=do.call(cbind,ReadIn[-1]) | |
38 rownames(GeneMat)=ReadIn[[1]] | |
39 colnames(GeneMat)=Names | |
40 } | |
41 if(class(ReadIn[[1]])=="numeric"){ | |
42 GeneMat=data.matrix(ReadIn) | |
43 colnames(GeneMat)=Names | |
44 } | |
45 | |
46 Patterns=data.matrix(PatternIn) | |
47 | |
48 Sizes=MedianNorm(GeneMat) | |
49 #write.table(Conditions,file=outputfile,quote=F,col.names=T,row.names=T,sep = "\t") | |
50 EBOut=EBMultiTest(Data=GeneMat,NgVector=IgV,Conditions=as.factor(Conditions), | |
51 AllParti=Patterns,sizeFactors=Sizes, maxround=5) | |
52 PPout=GetMultiPP(EBOut) | |
53 MultiPP=PPout$PP | |
54 MultiMAP=PPout$MAP | |
55 Data.norm=round(GetNormalizedMat(GeneMat, Sizes),2) | |
56 | |
57 Mat=cbind(MultiMAP,Data.norm[names(MultiMAP),]) | |
58 | |
59 colnames(Mat)= | |
60 c("MAP",Names) | |
61 options(warn=-1) | |
62 | |
63 write.table(round(MultiPP,2),file=outputfile,quote=F,col.names=T,row.names=T,sep = "\t") | |
64 write.table(Mat,file=MAP.out ,quote=F,col.names=T,row.names=T,sep = "\t") | |
65 write.table(Sizes,file=Sizesout,quote=F,col.names=F,row.names=F,sep = "\t") | |
66 |