summaryrefslogtreecommitdiff
path: root/scripts/experimental_description.R
blob: e685844f2e4740162bab4ac8e65c834ddb36d011 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
library(tidyverse)
library(ggpubr)

data <- read_csv("../csv/data_per_assay_per_year_per_outcome.csv")

studies_data <- read_csv("../csv/donors_list.csv") %>%
    group_by(study_id) %>%
    summarise(
              count = n()
              )

tbl <- data %>%
    mutate(
        assay_type = factor(assay, labels = (
            c(
                "MSD",
                "Multiplex cytokine",
                "Cell Cytometry",
                "Multiplex cytokine",
                "Phospho cytometry",
                "Cell Cytometry",
                "Phospho cytometry",
                "Complete blood count",
                "MSD",
                "Cell Cytometry",
                "MSD",
                "Multiplex cytokine",
                "Multiplex cytokine",
                "Cell Cytometry"
            )
        ))
    )

id_plt <- tbl %>%
    group_by(year, assay, outcome) %>%
    summarise(
        measurements = n(),
        study = study
    ) %>%
    ggplot(aes(year, measurements / 1000, color = factor(assay))) +
    geom_line() +
    geom_point() +
    ylim(-1, 10) +
    facet_grid(rows = vars(factor(outcome, labels = c("low", "high")))) +
    labs(y = "number of features (thousands)") +
    scale_color_discrete(name="Assay type") +
    theme_pubclean()

type_plt <- tbl %>%
    group_by(year, assay_type, outcome) %>%
    summarise(
        measurements = n(),
        study = study
    ) %>%
    ggplot(aes(year, measurements / 1000, color = factor(assay_type))) +
    geom_line(show.legend=F) +
    geom_point(show.legend=F) +
    ylim(-1, 10) +
    facet_grid(rows = vars(factor(outcome, labels = c("low", "high")))) +
    labs(y = "number of features (thousands)") +
    scale_color_discrete(name="Assay type") +
    theme_pubclean()

study_plt <- tbl %>%
    group_by(year, assay_type) %>%
    summarise(
        measurements = n(),
        study = study
    ) %>%
    ggplot(aes(year, measurements / 1000, color = factor(assay_type))) +
    geom_line() +
    geom_point() +
    ylim(-1, 10) +
    facet_grid(rows = vars(factor(study, labels = c(
        paste("SLVP015\nn=(", as.numeric(studies_data[studies_data$study_id == 15,][2]), ")"),
        paste("SLVP017\nn=(", as.numeric(studies_data[studies_data$study_id == 17,][2]), ")"),
        paste("SLVP018\nn=(", as.numeric(studies_data[studies_data$study_id == 18,][2]), ")"),
        paste("SLVP021\nn=(", as.numeric(studies_data[studies_data$study_id == 21,][2]), ")"),
        paste("SLVP024\nn=(", as.numeric(studies_data[studies_data$study_id == 24,][2]), ")"),
        paste("SLVP028\nn=(", as.numeric(studies_data[studies_data$study_id == 28,][2]), ")"),
        paste("SLVP029\nn=(", as.numeric(studies_data[studies_data$study_id == 29,][2]), ")"),
        paste("SLVP030\nn=(", as.numeric(studies_data[studies_data$study_id == 30,][2]), ")")
    )))) +
    labs(y = "number of features (thousands)", legend="Assay type") +
    scale_color_discrete(name="Assay type") +
    theme_pubclean()


top_half <- ggarrange(
                      id_plt,
                      type_plt,
                      ncol=2,
                      labels = c("A","B")
          )

whole <- ggarrange(
                   top_half,
                   study_plt,
                   nrow=2,
                   labels=c("", "C"),
                   heights = c(1,2)
)
whole

ggsave("../images/exp_data_numbers.pdf", whole, width = 21, height = 29.7, dpi=300, units = "cm")