forked from Katsevich-Lab/sceptre-manuscript
-
Notifications
You must be signed in to change notification settings - Fork 1
/
FigureS4.R
25 lines (24 loc) · 1.29 KB
/
FigureS4.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Reproduce Figure S4 from Katsevich and Roeder (2020).
args <- commandArgs(trailingOnly = TRUE)
code_dir <- if (is.na(args[1])) "/Users/timbarry/Box/SCEPTRE/SCEPTRE/" else args[1]
require(katsevich2020)
source(paste0(code_dir, "/sceptre_paper/plotting/load_data_for_plotting.R"))
figS4_dir <- paste0(manuscript_figure_dir, "/FigureS4")
# plot the fraction paired in each quintile
p = paired_fractions %>%
gather(method, paired_fraction, rejected_old, rejected_new) %>%
mutate(method = factor(method, levels = c("rejected_new", "rejected_old"), labels = c("SCEPTRE", "Original"))) %>%
ggplot(aes(x = factor(quintile), y = paired_fraction, fill = method)) +
xlab("ChIP-seq quintiles of candidate enhancers") + ylab("Proportion enhancers paired with gene") +
geom_col(position = "dodge") + scale_fill_manual(values = c(plot_colors[["sceptre"]], plot_colors[["gasperini_nb"]])) +
scale_y_continuous(expand = c(0,0)) +
facet_wrap(TF ~ ., nrow = 2) + theme_bw() +
theme(legend.title = element_blank(),
legend.position = c(0.09, 0.9),
strip.background = element_blank(),
panel.grid = element_blank(),
panel.border = element_blank(),
axis.line = element_line()
)
plot(p)
ggsave(plot = p, filename = sprintf("%s/FigureS4.pdf", figS4_dir), width = 7, height = 4)