library(tidyverse)
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag(): dplyr, stats
data = read.table("master_output.txt", header=T)
data %>% ggplot(aes(x=sn,y=ppv, col=as.factor(rna_cov))) + geom_line() +
ggtitle("Precision-Recall plot")

data = data %>% mutate(fdr=1-ppv)
data %>% ggplot(aes(x=fdr,y=sn, col=as.factor(rna_cov))) +
geom_line() +
geom_point() +
ggtitle("fdr vs. sn")

data %>% ggplot(aes(x=fp,y=tp, col=as.factor(rna_cov))) +
geom_line() +
geom_point() +
ggtitle("tp ~ fp")

## add false positive rate
data = data %>% mutate(tn = 3.2e9-(tp+fn+fp)) # size of human genome = 3.2e9
data = data %>% mutate(fpr = fp / (fp+tn))
# plot actual ROC
data %>% ggplot(aes(x=fpr, y=sn, col=as.factor(rna_cov))) +
geom_line() +
geom_point() +
ggtitle("ROC")
