|
1
|
1 #!/usr/bin/env Rscript
|
|
|
2 args <- commandArgs(trailingOnly = TRUE)
|
|
|
3 fileR=args[1]
|
|
|
4 fileT=args[2]
|
|
|
5 ofile=args[3]
|
|
|
6 data_R=read.table(fileR,header=T)
|
|
|
7 data_T=read.table(fileT,header=T)
|
|
|
8
|
|
|
9 #P=wilcox.test(data_R$Score,data_T$Score,alternative="gr")$p.value
|
|
|
10 range= rev(seq(min(data_R$VINYL_score),max(data_R$VINYL_score),0.5))
|
|
|
11 header=paste("Cut-off","PosD","PosH","FisherPV","OR",sep="\t");
|
|
|
12 cat(header,file=ofile,sep="\n",append=T)
|
|
|
13
|
|
|
14 m=matrix(ncol=2,nrow=2)
|
|
|
15 totR=nrow(data_R)
|
|
|
16 totT=nrow(data_T)
|
|
|
17 for (r in range)
|
|
|
18 {
|
|
|
19 posR=sum(data_R$VINYL_score>=r);
|
|
|
20 posT=sum(data_T$VINYL_score>=r);
|
|
|
21 m[,1]=c(posR,totR);
|
|
|
22 m[,2]=c(posT,totT);
|
|
|
23
|
|
|
24 F=fisher.test(m,alternative="greater")
|
|
|
25 Fpv=F$p.value
|
|
|
26 Fodds=F$estimate
|
|
|
27
|
|
|
28 string=paste(r,posR,posT,Fpv,Fodds,sep="\t")
|
|
|
29 cat(string,file=ofile,sep="\n",append=T)
|
|
|
30 }
|