-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_figure1.R
64 lines (57 loc) · 1.72 KB
/
make_figure1.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
63
64
library("ggplot2")
library("patchwork")
library("RColorBrewer")
source("utils.R")
## Colorblind-friendly palette
cols <- brewer.pal(8, "Set2")
#### ---- Processing of the datasets ----####
datasets <- c(
"specht2019v3", "dou2019_mouse", "zhu2019EL",
"liang2020_hela", "schoof2021", "leduc2022",
"derks2022", "brunner2022"
)
processedData <- lapply(datasets, prepareData)
names(processedData) <- datasets
featureTableList <- lapply(processedData, featureTables, byAssay = FALSE)
idMatrixList <- lapply(featureTableList, featureTablesToIdMatrices)
#### ---- Missingness in features ----####
pepMisDf <- lapply(names(idMatrixList), function(n) {
x <- idMatrixList[[n]]$peptide
mis <- rowMeans(x == 0)
mis <- mis[order(mis)]
data.frame(
missingness = mis,
index = seq_along(mis),
propFeatures = seq_along(mis) / length(mis),
dataset = n
)
})
pepMisDf <- do.call(rbind, pepMisDf)
examplePoint <- pepMisDf[58700, , drop = FALSE]
(pl <- ggplot(pepMisDf) +
aes(
y = propFeatures * 100,
x = missingness * 100,
colour = dataset
) +
geom_line(linewidth = 1) +
geom_point(
data = examplePoint, colour = "red",
shape = 21, size = 4
) +
geom_vline(
xintercept = examplePoint$missingness * 100,
linetype = "dashed", colour = "grey70"
) +
geom_hline(
yintercept = examplePoint$propFeatures * 100,
linetype = "dashed", colour = "grey70"
) +
scale_color_manual(values = cols) +
ylab("Cumulative percentage of peptides") +
xlab("Percentage missing values") +
theme_minimal())
if (!dir.exists("figs")) {
dir.create("figs")
}
ggsave("figs/figure1.pdf", plot = pl, width = 5, height = 4)