Mercurial > repos > elixir-it > vinyl_optimizer
diff old_version/wilcox.R @ 2:6e4eb4856874 draft
Uploaded
| author | elixir-it |
|---|---|
| date | Wed, 22 Jul 2020 19:20:30 +0000 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/old_version/wilcox.R Wed Jul 22 19:20:30 2020 +0000 @@ -0,0 +1,40 @@ +#!/usr/bin/env Rscript +args <- commandArgs(trailingOnly = TRUE) +fileR=args[1] +fileT=args[2] +#ofile=args[3] +data_R=read.table(fileR,header=T) +data_T=read.table(fileT,header=T) + +#P=wilcox.test(data_R$Score,data_T$Score,alternative="gr")$p.value +range= rev(seq(min(data_R$VINYL_score),max(data_R$VINYL_score),0.5)) +#header=paste("Cut-off","PosD","PosH","FisherPV","OR",sep="\t"); +#cat(header,file=ofile,sep="\n",append=T) + +m=matrix(ncol=2,nrow=2) +totR=nrow(data_R) +totT=nrow(data_T) +FoddsB=1; +FpvalB=1; +Fstring=""; +for (r in range) +{ + posR=sum(data_R$VINYL_score>=r); + posT=sum(data_T$VINYL_score>=r); + m[,1]=c(posR,totR); + m[,2]=c(posT,totT); + + F=fisher.test(m,alternative="greater") + Fpv=F$p.value + Fodds=F$estimate + + string=paste(r,posR,posT,Fpv,Fodds,sep="\t") + if (Fpv<= FpvalB && Fodds!=Inf && Fodds>=4 && Fodds>FoddsB) + { + FoddsB= Fodds + FpvalB= Fpv + Fstring= string + } +} + +cat(Fstring)
