-
Notifications
You must be signed in to change notification settings - Fork 1
/
global.R
executable file
·140 lines (117 loc) · 5.01 KB
/
global.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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
## R packages
library(shiny)
library(shinydashboard)
library(shinycssloaders)
library(data.table)
library(ggplot2)
library(ggbeeswarm)
library(ggpubr)
library(GSVA)
library(stringi)
library(stringr)
## Load data ----
## FOCUS
focus_express <- fread(file.path('.', 'data', 'focus_gene_expression.txt'))
focus_clino <- fread(file.path('.','data', 'focus_clinical_data.txt'),
stringsAsFactors = TRUE)
## GSE39582
gse39582_express <- fread(file.path('.', 'data', 'gse39582_gene_expression.txt'))
gse39582_clino <- fread(file.path('.', 'data', 'gse39582_clinical_data.txt'),
stringsAsFactors = TRUE)
## Gene sets
gene_sets_list <- readRDS(file.path('.','data', 'hallmark_selected_c2_genesets_msigdbr_v7_4_1.rds'))
#### Relevel the PDS, CMS and iCMS calls ####
#### FOCUS #####
# Make PDS a factor variable with Mixed as last level
focus_clino$PDS_call <- factor(focus_clino$PDS_call,
levels = c(
"PDS1",
"PDS2",
"PDS3",
"Mixed"
))
# Make CMS a factor variable with unknown (UNK) as last level
focus_clino$CMS_RF_0_4 <- factor(focus_clino$CMS_RF_0_4,
levels = c(
"CMS1",
"CMS2",
"CMS3",
"CMS4",
"UNK"
))
# Make CMS a factor variable with unknown (UNK) as last level
focus_clino$CMS_RF_0_5 <- factor(focus_clino$CMS_RF_0_5,
levels = c(
"CMS1",
"CMS2",
"CMS3",
"CMS4",
"UNK"
))
# Make iCMS a factor variable with unknown (UNK) as last level
focus_clino$iCMS_final_prediction <-
factor(focus_clino$iCMS_final_prediction,
levels = c(
"iCMS2",
"iCMS3",
"UNK"
))
#### GSE39582 #####
# Make PDS a factor variable with Mixed as last level
gse39582_clino$PDS_call <- factor(gse39582_clino$PDS_call,
levels = c(
"PDS1",
"PDS2",
"PDS3",
"Mixed"
))
# Make CMS a factor variable with unknown (UNK) as last level
gse39582_clino$CMS <- factor(gse39582_clino$CMS,
levels = c(
"CMS1",
"CMS2",
"CMS3",
"CMS4",
"UNK"
))
# Make iCMS a factor variable with unknown (UNK) as last level
gse39582_clino$iCMS_final_prediction <-
factor(gse39582_clino$iCMS_final_prediction,
levels = c(
"iCMS2",
"iCMS3",
"UNK"
))
## Plot settings ----
# Define colours to use in plots for PDS subtypes
pds_cols <- c('PDS1' = '#920000',
'PDS2' = '#332288',
'PDS3' = '#D55E00',
'Mixed' = 'grey50')
# Define colours to use in plots for CMS subtypes
cms_cols <- c("CMS1" = "#FFA54D",
"CMS2" = "#0070B0",
"CMS3" = "#CF75A8",
"CMS4" = "#009C75",
"UNK" = "grey50")
# Define colours to use in plots for iCMS subtypes
icms_cols <- c("iCMS2" = "#6A3D9A",
"iCMS3" = "#FF8000",
"UNK" = "grey50")
### basic theme - boxplot
box_theme.1 <- theme(axis.title.x = element_blank(),
axis.text.x = element_text(size = 18, colour = "black"),
axis.title.y = element_text(size = 20),
axis.text.y = element_text(size = 18, colour = "black"),
axis.ticks.y = element_line(linewidth = 0.5, colour = "black"),
axis.ticks.length = unit(0.2, "cm"),
axis.line.y = element_line(linewidth = 0.5, colour = "black"),
axis.ticks.x = element_line(linewidth = 0.5, colour = "black"),
axis.line.x.bottom = element_line(linewidth = 0.5, colour = "black"),
panel.background = element_rect(fill = 'white'),
plot.margin = unit(c(4,2,0,2),'mm'),
plot.title = element_text(face = 'bold', size = 18,
margin = margin(15,0,0,0),
vjust = 4, hjust = 0.5, lineheight = 1),
legend.position = "none"
)