Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
rnai-screen-tf/plots.R
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
72 lines (62 sloc)
2.52 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## See the distribution of % Overlap vs. wells | |
suppressPackageStartupMessages({ | |
library(ggplot2) | |
library(dplyr) | |
library(readr) | |
}) | |
wells_all <- read_csv("rnai-p_values.csv") %>% | |
mutate(significant = p_value < 0.05) | |
binwidth <- 0.025 | |
theme_set(theme_bw()) | |
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")) | |
} | |
ggplot(filter(wells_all, is.na(control)), | |
aes(coloc, fill = significant)) + | |
geom_histogram(binwidth = binwidth) + | |
scale_fill_manual(values = c("grey", "blue")) + | |
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 == "504"), | |
aes(coloc, fill = symbol)) + | |
geom_histogram(binwidth = binwidth) + | |
facet_wrap(~ control) + | |
ggtitle(paste("Histogram of control wells in plate 504")) + | |
xlab("% colocalization") | |
ggplot(filter(wells_all, !is.na(control)) %>% | |
group_by(well) %>% mutate(ymin = min(coloc), ymax = max(coloc), | |
plate = factor(plate)), | |
aes(well, coloc, color = plate)) + | |
geom_errorbar(aes(ymin = ymin, ymax = ymax), color = "gray") + | |
geom_jitter(aes(shape = plate)) + | |
scale_color_brewer(palette = "Set1") + | |
ggtitle(paste("Scatter plot of control well colocalization across plates")) + | |
xlab("well") + ylab("% colocalization") | |
ggplot(filter(wells_all, !is.na(control)) %>% | |
group_by(well) %>% mutate(ymin = min(p_value), ymax = max(p_value), | |
plate = factor(plate)), | |
aes(well, p_value, color = plate)) + | |
geom_errorbar(aes(ymin = ymin, ymax = ymax, color = control)) + | |
geom_jitter(aes(shape = plate, size = n)) + | |
scale_color_brewer(palette = "Set1") + | |
ggtitle(paste("Scatter plot of control well p-values across plates")) + | |
xlab("well") + ylab("p-value") | |
ggplot(wells_all, aes(coloc, color = type)) + | |
geom_freqpoly(binwidth = binwidth) + | |
scale_y_log10() + | |
facet_wrap(~ type) + | |
ggtitle("Histogram of all well types") + | |
xlab("% colocalization") | |
plot_save("all-hist") | |
ggplot(wells_all, aes(coloc, color = type)) + | |
geom_density() + | |
facet_wrap(~ type) + | |
ggtitle("Density plot of wells to show distribution") + | |
xlab("% colocalization") | |
plot_save("all-density") |