library(ggplot2) library(scales) library(gridExtra) library(grid) ################## ### BAR COLORS ### ################## gg_color_hue <- function(n) { hues = seq(15, 375, length = n + 1) hcl(h = hues, l = 65, c = 100)[1:n] } cols = gg_color_hue(7) hapog = cols[1] hypo = cols[2] nextpolish = cols[3] ntedit = cols[4] pilon = cols[5] polca = cols[6] racon = cols[7] ####################### ### DATA FORMATTING ### ####################### dat = read.csv('PolishingAfterOneRoundOfHapoG') colnames(dat)[1] = "Tool" dat$Tool = factor(dat$Tool, levels=c("Uncorrected", "Hapo-G+Hapo-G", "HyPo+Hapo-G", "NextPolish+Hapo-G", "ntEdit+Hapo-G", "Pilon+Hapo-G", "POLCA+Hapo-G", "Racon+Hapo-G")) ##################### ### MAPPED PAIRS ### ##################### ppair_top = ggplot(data=dat, aes(x=Tool, y=perfectPairs)) + geom_col(position=position_dodge2(width = 0.9, preserve = "single"), color="black", fill=c(hypo, nextpolish, ntedit, pilon, polca, racon)) + theme_bw() + theme(axis.text = element_text(size = 16), axis.title = element_text(size = 16),legend.text = element_text(size = 20),plot.title = element_text(size = 20)) + theme(legend.position = "none")+ xlab("") + ylab("") + scale_y_continuous(breaks=c(0, 45000000, 46000000, 47000000, 48000000,49000000,50000000), labels=c("0", "45", "46", "47", "48", "49", "50")) + coord_cartesian(ylim=c(45000000, 49500000)) ppair_bottom = ggplot(data=dat, aes(x=Tool, y=perfectPairs)) + geom_col(position=position_dodge2(width = 0.9, preserve = "single"), color="black", fill=c(hypo, nextpolish, ntedit, pilon, polca, racon)) + theme_bw() + theme(axis.text = element_text(size = 16), axis.title = element_text(size = 16),legend.text = element_text(size = 20),plot.title = element_text(size = 20)) + theme(legend.position = "none")+ xlab("") + ylab("") + scale_y_continuous(breaks=c(0, 10000000, 20000000, 30000000, 40000000, 50000000), labels=c("0", "10", "20", "30", "40", "50")) fig <- grid.arrange(ppair_top, ppair_bottom, heights=c(2, 3), ncol=1, nrow=2, left=textGrob("Million of perfectly mapped pairs", rot=90, vjust=1, gp = gpar(fontsize = 24))) ggsave(file="Figure_S2.png", plot=fig, width=16, height=9)