@transform(mergeFalsePositiveRates, suffix(".tsv"), ".pdf")
def plotFalsePositiveRates(infile, outfile):
    R('''library(ggplot2)''')
    R('''dat <- read.csv("%s", header = T, stringsAsFactors = F, sep = "\t")''' %
      infile)
    for i in [0, 1]:
        # specificity
        outf = P.snip(outfile, ".pdf") + ".%i.specificity.pdf" % i
        R('''plot1 <- ggplot(dat[dat$cutoff == %i,], aes(x=reorder(level, fp_rate), y = fp_rate, fill = track, stat = "identity"))''' %
          i)
        R('''plot2 <- plot1 + geom_bar(position = "dodge", stat="identity")''')
        R('''plot2 + scale_fill_manual(values = c("cadetblue", "slategray", "lightblue"))''')
        R('''ggsave("%s")''' % outf)

        # sensitivity
        outf = P.snip(outfile, ".pdf") + ".%i.sensitivity.pdf" % i
        R('''plot1 <- ggplot(dat[dat$cutoff == %i,], aes(x=reorder(level, fp_rate), y = tp_rate, fill = track, stat = "identity"))''' %
          i)
        R('''plot2 <- plot1 + geom_bar(position = "dodge", stat="identity")''')
        R('''plot2 + scale_fill_manual(values = c("cadetblue", "slategray", "lightblue"))''')
        R('''ggsave("%s")''' % outf)

    P.touch(outfile)

###################################################
###################################################
###################################################
barplot the false positive rates across
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_metagenomebenchmark.py/plotFalsePositiveRates