-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fig3-CNAs.r
62 lines (55 loc) · 2.3 KB
/
Fig3-CNAs.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
library(dplyr)
library(ggplot2)
library(patchwork)
theme_set(cowplot::theme_cowplot())
io = import('io')
config = io$read_yaml("../config.yaml")
lookup = c(
fpr_seg = "within CNA",
fpr_total = "fraction of total"
)
dset = io$load("../set_enrichment/merge.RData") %>%
filter(expr == "naive", seg_id == "all") %>%
mutate(fpr_seg = pmax(0, fpr_seg)) %>%
select(regions, method, cohort, edges, fpr_seg, fpr_total) %>%
tidyr::gather("kind", "value", fpr_seg, fpr_total) %>%
filter(! (kind == "fpr_seg" & method == "TFbinding"),
method != "zscore.wrap") %>%
mutate(kind = factor(lookup[kind], levels=lookup),
mstr = factor(unlist(config$method_str[method]), levels=names(config$mcol)),
has_tf = method %in% config$has_tf)
focal = filter(dset, regions == "focal")
aneup = filter(dset, regions == "aneup")
levels(aneup$kind)[1] = "within Chromosome"
p1 = ggplot(focal, aes(x=edges, y=value*100, color=mstr)) +
geom_line(aes(size=has_tf, group=method), alpha=0.7) +
geom_point(size=0.5) +
facet_grid(kind ~ cohort, scales="free_y") +
scale_x_log10() +
scale_size_manual(values=c(0.6, 1)) +
scale_color_manual(values=unlist(config$mcol)) +
theme(panel.grid.major.y = element_line(color="grey", linetype="dashed"),
axis.text.x = element_text(angle=45, hjust=1)) +
guides(color = guide_legend(title="Method"),
size = guide_legend(title="TF annotations")) +
labs(x = "# of edges considered",
y = "% of edges expected FPs",
tag = "a",
title = "Focal CNAs (as defined by RACS in GDSC)")
p2 = ggplot(aneup, aes(x=edges, y=value*100, color=mstr)) +
geom_line(aes(size=has_tf, group=method)) +
geom_point(size=0.5) +
facet_grid(kind ~ cohort, scales="free_y") +
scale_x_log10() +
scale_size_manual(values=c(0.6,1)) +
scale_color_manual(values=unlist(config$mcol)) +
theme(panel.grid.major.y = element_line(color="grey", linetype="dashed"),
axis.text.x = element_text(angle=45, hjust=1)) +
guides(color=FALSE, size=FALSE) +
labs(x = "# of edges considered",
y = "% of edges expected FPs",
tag = "b",
title = "Aneuploidies (chromosome copy number changes)")
pdf("Fig3-CNAs.pdf", 14, 12)
p1 / p2 & theme(plot.tag = element_text(size=18))
dev.off()