Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ENH: Control comparison plots (work in progress)
- Need to create p-value column using control references instead of
  cells.
- Need to display on plot in "fold change" e.g. relative to LacZ.
  • Loading branch information
pan14001 committed Feb 7, 2017
1 parent e5d2dac commit aed1175
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions plots.R
Expand Up @@ -3,13 +3,12 @@
suppressPackageStartupMessages({
library(ggplot2)
library(dplyr)
library(readr)
})

wells_all <- read.csv("rnai-p_values.csv") %>%
wells_all <- read_csv("rnai-p_values.csv") %>%
mutate(significant = p_value < 0.05)
binwidth <- 0.025
## Bring RNAi to the front of the level list.
wells_all$type <- relevel(wells_all$type, "RNAi")

theme_set(theme_bw())

Expand All @@ -20,7 +19,7 @@ plot_save <- function(prefix, dir = "plots",
units = "in"))
}

ggplot(filter(wells_all, type == "RNAi"),
ggplot(filter(wells_all, is.na(control)),
aes(coloc, fill = significant)) +
geom_histogram(binwidth = binwidth) +
scale_fill_manual(values = c("grey", "blue")) +
Expand All @@ -30,15 +29,33 @@ plot_save("rnai-hist-signif")

ggplot(filter(wells_all,
!is.na(control),
plate == "160415_015529-V"),
aes(coloc, fill = significant)) +
plate == "504"),
aes(coloc, fill = symbol)) +
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%)")) +
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() +
Expand Down

0 comments on commit aed1175

Please sign in to comment.