comparison old_version/wilcox.R @ 2:6e4eb4856874 draft

Uploaded
author elixir-it
date Wed, 22 Jul 2020 19:20:30 +0000
parents
children
comparison
equal deleted inserted replaced
1:35c308dd6420 2:6e4eb4856874
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 FoddsB=1;
18 FpvalB=1;
19 Fstring="";
20 for (r in range)
21 {
22 posR=sum(data_R$VINYL_score>=r);
23 posT=sum(data_T$VINYL_score>=r);
24 m[,1]=c(posR,totR);
25 m[,2]=c(posT,totT);
26
27 F=fisher.test(m,alternative="greater")
28 Fpv=F$p.value
29 Fodds=F$estimate
30
31 string=paste(r,posR,posT,Fpv,Fodds,sep="\t")
32 if (Fpv<= FpvalB && Fodds!=Inf && Fodds>=4 && Fodds>FoddsB)
33 {
34 FoddsB= Fodds
35 FpvalB= Fpv
36 Fstring= string
37 }
38 }
39
40 cat(Fstring)