Mercurial > repos > bioitcore > splicetrap
comparison bin/calc_pval.R @ 1:adc0f7765d85 draft
planemo upload
| author | bioitcore |
|---|---|
| date | Thu, 07 Sep 2017 15:06:58 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:d4ca551ca300 | 1:adc0f7765d85 |
|---|---|
| 1 args = commandArgs(); | |
| 2 input_file=args[4]; | |
| 3 av=as.numeric(args[5]); | |
| 4 sd=as.numeric(args[6]); | |
| 5 nu=as.numeric(args[7]); | |
| 6 | |
| 7 | |
| 8 data=read.table(input_file); | |
| 9 | |
| 10 col=4; | |
| 11 x=data[,col]; | |
| 12 pup=pnorm(x, mean=av, sd=sd, lower.tail = FALSE); | |
| 13 adpup=p.adjust(pup,method="fdr"); | |
| 14 pdn=pnorm(x, mean=av, sd=sd, lower.tail = TRUE); | |
| 15 adpdn=p.adjust(pdn,method="fdr"); | |
| 16 | |
| 17 p=pup; | |
| 18 | |
| 19 size = length(x); | |
| 20 | |
| 21 for (i in 1:size) | |
| 22 { | |
| 23 if(x[i]<0) | |
| 24 { | |
| 25 p[i]=pdn[i]; | |
| 26 } | |
| 27 } | |
| 28 write(p, file=paste(input_file,"p",sep="."),ncolumns=1); | |
| 29 |
