From e5d2dac19958dab4d0a785037a659ff806ad54c1 Mon Sep 17 00:00:00 2001 From: Pariksheet Nanda Date: Tue, 7 Feb 2017 12:16:10 -0500 Subject: [PATCH] ENH: Add histogram plot for significant genes - Add prefix to plot output --- plots.R | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/plots.R b/plots.R index 2635491..bcda9ba 100644 --- a/plots.R +++ b/plots.R @@ -13,8 +13,9 @@ wells_all$type <- relevel(wells_all$type, "RNAi") theme_set(theme_bw()) -plot_save <- function(prefix, extensions = c("png", "pdf", "svg")) { - invisible(sapply(paste(prefix, extensions, sep = "."), +plot_save <- function(prefix, dir = "plots", + extensions = c("png", "pdf", "svg")) { + invisible(sapply(file.path(dir, paste(prefix, extensions, sep = ".")), ggplot2::ggsave, width = 8, height = 5, units = "in")) } @@ -23,10 +24,21 @@ ggplot(filter(wells_all, type == "RNAi"), aes(coloc, fill = significant)) + geom_histogram(binwidth = binwidth) + scale_fill_manual(values = c("grey", "blue")) + - ggtitle("Histogram of wells with significant overlap (p-value < 5%)") + + ggtitle("Histogram of RNAi wells with significant overlap (p-value < 5%)") + xlab("% colocalization") plot_save("rnai-hist-signif") +ggplot(filter(wells_all, + !is.na(control), + plate == "160415_015529-V"), + aes(coloc, fill = significant)) + + geom_histogram(binwidth = binwidth) + + facet_wrap(~ control) + + scale_fill_manual(values = c("grey", "blue")) + + ggtitle(paste("Histogram of control wells with", + "significant overlap (p-value < 5%)")) + + xlab("% colocalization") + ggplot(wells_all, aes(coloc, color = type)) + geom_freqpoly(binwidth = binwidth) + scale_y_log10() +