a b/figures/Figure5.Rmd
1
---
2
title: "Figure 5"
3
author: Tobias Roider
4
date: "Last compiled on `r format(Sys.time(), '%d %B, %Y, %X')`"
5
output: 
6
  rmdformats::readthedown: 
7
  
8
editor_options: 
9
  chunk_output_type: console
10
---
11
12
```{r options, include=FALSE, warning = FALSE}
13
14
library(knitr)
15
opts_chunk$set(echo=TRUE, tidy=FALSE, include=TRUE, message=FALSE,
16
               dpi = 100, cache = FALSE, warning = FALSE)
17
opts_knit$set(root.dir = "../")
18
options(bitmapType = "cairo")
19
20
```
21
22
# Read data, functions and packages
23
```{r read data}
24
25
source("R/ReadPackages.R")
26
source("R/Functions.R")
27
source("R/ReadData.R")
28
source("R/ThemesColors.R")
29
source("R/Helpers.R")
30
31
```
32
33
# Overview plot 
34
## Inset
35
```{r inset}
36
37
ori <- c(-8.25,-8.5)
38
l <- 3
39
off <- 1
40
colors_umap_cl_mod <- colors_umap_cl
41
for(i in names(colors_umap_cl)){
42
  if(!i %in% c("3", "5", "12", "16")){
43
    colors_umap_cl_mod[i] <- "grey"
44
  }
45
}
46
47
48
p1_inset <- 
49
  df_comb %>% sample_frac(0.075) %>% 
50
  mutate(Code=ifelse(IdentI %in% c(12,3,16,5), T, F)) %>% 
51
  filter(!(IdentI %in% c(12,3,16,5) & wnnUMAP_2>1.25)) %>% 
52
  ggplot(aes(x=wnnUMAP_1, y=wnnUMAP_2, fill=as.factor(IdentI), color=as.factor(IdentI), alpha=Code))+
53
  #geom_point(size=0.25, stroke=0, shape=21)+
54
  ggrastr::geom_point_rast(size=0.35, stroke=0, shape=21, raster.dpi = 300)+
55
  scale_color_manual(values = colors_umap_cl_mod, limits=factor(cluster_order),
56
                    labels=unlist(labels_cl))+
57
  scale_fill_manual(values = colors_umap_cl_mod, limits=factor(cluster_order),
58
                    labels=unlist(labels_cl))+
59
  scale_alpha_manual(values = c(0.1,0.75))+
60
  scale_x_continuous(limits = c(ori[1],10), expand = c(0,0))+
61
  scale_y_continuous(limits = c(ori[2],10), expand = c(0,0))+
62
  mytheme_1+
63
  coord_fixed(clip = "off")+
64
    theme(axis.ticks = element_blank(),
65
        panel.border = element_blank(),
66
        panel.background = element_rect(fill = NA),
67
        axis.title = element_blank(),
68
        axis.text = element_blank())
69
70
```
71
72
## Pseudotime
73
```{r pseudotime}
74
75
df_pseudotime <- FetchData(ttox, vars = c("wnnUMAP_1", "wnnUMAP_2", "Pseudotime", "IdentI", "PatientID")) %>%
76
  add_entity() %>% 
77
  mutate(CellType="Cytotoxic T cells") %>% 
78
  mutate(IdentI=as.character(IdentI)) %>% 
79
  drop_na() %>% 
80
  filter(wnnUMAP_2<(0.7*wnnUMAP_1-1)) %>% 
81
  mutate(name="Trajectory analysis / Pseudotime")
82
83
p1 <- ggplot()+
84
  ggrastr::geom_point_rast(data=df_pseudotime %>% filter(IdentI=="16"), aes(x=wnnUMAP_1, y=wnnUMAP_2), fill="grey75", 
85
                           size=0.35, shape=21, stroke=0, raster.dpi = 600)+
86
  ggrastr::geom_point_rast(data=df_pseudotime %>% filter(IdentI!="16"), aes(x=wnnUMAP_1, y=wnnUMAP_2, fill=Pseudotime), 
87
                           size=0.35, shape=21, stroke=0, raster.dpi = 600)+
88
  scale_fill_viridis(option = "viridis", direction = -1, breaks=c(0,15,30), name="Ps.time")+
89
  facet_wrap(~name)+
90
  scale_x_continuous(name="umapWNN-1", limits=c(-6, 11), expand = c(0,0))+
91
  scale_y_continuous(name="umapWNN-2", limits=c(-8, 3), expand = c(0,0))+
92
  mytheme_1+
93
  coord_cartesian(clip = "off")+
94
  theme(legend.box.margin = unit(c(0,-0.25,-0.35,-0.25), units = "cm"),
95
        panel.border = element_rect(size=0.25, color="black"),
96
        legend.title = element_text(size=7),
97
        legend.text = element_text(size=7),
98
        legend.position = c(0.88,0.25),
99
        panel.background = element_rect(fill=NA),
100
        strip.background = element_rect(color=NA),
101
        legend.key.height = unit(units="cm", 0.15),
102
        legend.key.width = unit(units="cm", 0.15),
103
        legend.box.background = element_rect(fill=NA, color=NA),
104
        legend.background = element_rect(fill=NA, color=NA)
105
        )+
106
  labs(tag="A")
107
108
p1 <- p1+inset_element(p1_inset, left = -0.05, right = 0.4, bottom = 0.5, top = 1.05,  on_top = F)
109
110
```
111
112
# Differentially expressed features
113
```{r differentially expressed features}
114
115
df_tmp516 <- 
116
  rbind(FindMarkers(ttox, ident.1 = 5, ident.2 = 16, test.use = "roc", assay = "integratedADT") %>% 
117
          rownames_to_column("Feature") %>% mutate(Assay="Protein"),
118
        FindMarkers(ttox, ident.1 = 5, ident.2 = 16, test.use = "roc", assay = "integratedRNA") %>% 
119
          rownames_to_column("Feature") %>% mutate(Assay="Gene")) 
120
121
labels <- c("CCL4", "NKG7", "CST7", "TCF7", ".CD279", ".CD69", ".CD366")
122
123
df_tmp516 <- df_tmp516 %>% 
124
  mutate(Label=ifelse(Feature %in% labels, Feature, NA)) %>% 
125
  mutate(Label=gsub(Label, pattern = ".", fixed = T, replacement = "")) %>% 
126
  mutate(Label=gsub(Label, pattern = "CD279", fixed = T, replacement = "PD1")) %>% 
127
  mutate(Label=gsub(Label, pattern = "CD366", fixed = T, replacement = "TIM3")) 
128
129
height.label <- 1.02
130
position.label_left <- 1.6
131
position.label_right <- 2.25
132
Idents(ttox) <- "IdentI"
133
134
df_tmp1 <- df_tmp516 %>% filter(avg_log2FC<0)
135
df_tmp2 <- df_tmp516 %>% filter(avg_log2FC>0)
136
137
p3 <- ggplot()+
138
  geom_point(data=df_tmp1, aes(x=avg_log2FC, y=power, color=Assay), alpha=ifelse(!is.na(df_tmp1$Label), 1, 0.25), stroke=0, size=1)+
139
  geom_point(data=df_tmp2, aes(x=avg_log2FC, y=power, color=Assay), alpha=ifelse(!is.na(df_tmp2$Label), 1, 0.25), stroke=0, size=1)+
140
  ggrepel::geom_text_repel(data=df_tmp1, aes(x=avg_log2FC, y=power, color=Assay, label=Label), show.legend = F, size=2.4, segment.size=0.25, xlim = c(-1.9, -2.5), ylim = c(0.75,0.85), seed = 1)+
141
  ggrepel::geom_text_repel(data=df_tmp2 %>% filter(Feature==".CD366"), aes(x=avg_log2FC, y=power, color=Assay, label=Label), show.legend = F, size=2.4, segment.size=0.25, seed = 2, xlim = c(0.5,0.6),)+
142
  ggrepel::geom_text_repel(data=df_tmp2 %>% filter(Feature!=".CD366"), aes(x=avg_log2FC, y=power, color=Assay, label=Label), show.legend = F, size=2.4, segment.size=0.25, ylim = c(0.62, 0.9), seed = 1)+
143
  geom_vline(xintercept = 0, linetype="dashed", size=0.25)+
144
  scale_color_manual(name=NULL, values = c("black", "#f1a340"))+
145
  scale_x_continuous(limits = c(-3.2, 3.2), expand = c(0,0), name=expression('log'[2]~'fold change'))+
146
  scale_y_continuous(limits = c(0, 0.9), name="2 x abs(AUC-0.5)")+
147
  annotation_custom(grob = textGrob(label = expression('EM'[2]~''), hjust = 0.5, gp = gpar(cex=0.6, fontface="bold", col=colors_umap_cl["5"])), 
148
                    xmin = -position.label_left, xmax = -position.label_left,
149
                    ymin = height.label, ymax = height.label)+
150
  annotation_custom(grob = textGrob(label = expression('EM'[3]~''), hjust = 0.5, gp = gpar(cex=0.6, fontface="bold", col=colors_umap_cl["16"])),
151
                    xmin = position.label_right, xmax = position.label_right,
152
                    ymin = height.label, ymax = height.label)+
153
  mytheme_1+
154
  coord_cartesian(clip = "off")+
155
  theme(legend.position = c(0.85, 0.14),
156
        legend.key.height = unit(units="cm", 0.3),
157
        legend.box.spacing = unit(units="cm", 0.01),
158
        panel.border = element_rect(size=0.25),
159
        legend.background = element_rect(fill = NA),
160
        legend.box.margin=margin(-20,-20,-20,-20),
161
        legend.key.width = unit(units="cm", 0.1))+
162
  labs(tag = "B")
163
164
```
165
166
# Exhaustion signature
167
## Stimulatory markers
168
```{r stimulatory}
169
170
marker <- c("CD45RO", "CD69", "CD38", "CD278", "CD244")
171
marker_full <- paste0("integratedadt_.", marker)
172
173
p4 <- FetchData(ttox, slot = "data", vars = c(marker_full, "integratedadt_.CD4", "integratedadt_.CD8a",
174
                                              colnames(ttox@meta.data))) %>%
175
  filter(!IdentI %in% c(16)) %>% 
176
  mutate(Pseudotime_round=round(Pseudotime, 1)) %>% 
177
  pivot_longer(cols = all_of(marker_full)) %>%
178
  select(-Entity) %>% 
179
  add_entity() %>% 
180
  group_by(Pseudotime_round, name) %>% 
181
  dplyr::summarise(Mean=mean(value), `.groups`="drop") %>% 
182
  group_by(name) %>% 
183
  mutate(name=gsub(name, pattern = "integratedadt_.", replacement = "")) %>% 
184
  mutate(name=factor(name, levels = marker, labels = c("CD45RO", "CD69", "CD38", "ICOS", "CD244"))) %>% 
185
  group_by(name) %>%  
186
  dplyr::mutate(Mean=(Mean-min(Mean))/(max(Mean)-min(Mean))) %>% 
187
  filter(Mean < 0.98) %>% 
188
  dplyr::mutate(Mean=(Mean-min(Mean))/(max(Mean)-min(Mean))) %>% 
189
  ggplot(aes(x=Pseudotime_round, y=Mean, color=Pseudotime_round, fill=Pseudotime_round))+
190
  scale_fill_viridis(direction = -1, option = "viridis")+
191
  scale_color_viridis(direction = -1, option = "viridis")+
192
  geom_point(size=0.5, shape=21, stroke=0)+
193
  facet_wrap(~name, strip.position="top", ncol = 1)+
194
  scale_y_continuous(name="Protein / RNA / TF level", breaks = c(0,0.5,1.0))+
195
  scale_x_continuous(name="Pseudotime", breaks = c(0, 10, 20, 30))+
196
  mytheme_1+
197
  theme(strip.text = element_text(angle = 0, size=7),
198
        panel.border = element_rect(size=0.5),
199
        plot.tag = element_text(margin = unit(c(0,0,-0.2,0), "cm")),
200
        plot.margin = unit(c(-0.2,0,-0.25,0.1), "cm"))
201
202
```
203
204
## Inhibitory markers
205
```{r inhibitory}
206
207
marker <- c("CD279", "CD366", "CD223", "TIGIT", "CD39")
208
marker_full <- paste0("integratedadt_.", marker)
209
210
p5 <- FetchData(ttox, slot = "data", vars = c(marker_full, "integratedadt_.CD4", "integratedadt_.CD8a",
211
                                              colnames(ttox@meta.data))) %>%
212
  filter(!IdentI %in% c(16)) %>%
213
  select(-integratedadt_.CD4, -integratedadt_.CD8a) %>% 
214
  mutate(Pseudotime_round=round(Pseudotime, 1)) %>% 
215
  pivot_longer(cols = all_of(marker_full)) %>% 
216
  group_by(Pseudotime_round, name) %>% 
217
  dplyr::summarise(Mean=mean(value), `.groups`="drop") %>% 
218
  group_by(name) %>% 
219
  mutate(name=gsub(name, pattern = "integratedadt_.", replacement = "")) %>% 
220
  mutate(name=factor(name, levels = marker, labels = c("PD1", "TIM3", "LAG3", "TIGIT", "CD39"))) %>% 
221
  group_by(name) %>%  
222
  dplyr::mutate(Mean=(Mean-min(Mean))/(max(Mean)-min(Mean))) %>% 
223
  filter(Mean < 0.98 & Mean>0.02) %>% 
224
  dplyr::mutate(Mean=(Mean-min(Mean))/(max(Mean)-min(Mean))) %>% 
225
  ggplot(aes(x=Pseudotime_round, y=Mean, color=Pseudotime_round, fill=Pseudotime_round))+
226
  scale_fill_viridis(direction = -1, option = "viridis")+
227
  scale_color_viridis(direction = -1, option = "viridis")+
228
  geom_point(size=0.5, shape=21, stroke=0)+
229
  facet_wrap(~name, strip.position="top", ncol = 1)+
230
  scale_y_continuous(name="Protein / RNA expression level", breaks = c(0,0.5,1.0))+
231
  scale_x_continuous(name="Pseudotime", breaks = c(0, 10, 20, 30))+
232
  mytheme_1+
233
  theme(strip.text = element_text(angle = 0, size=7),
234
        axis.title.y = element_blank(),
235
        panel.border = element_rect(size=0.5),
236
        axis.ticks.y = element_blank(),
237
        axis.text.y = element_blank(),
238
        plot.tag = element_text(margin = unit(c(0,0,-0.2,0), "cm")),
239
        plot.margin = unit(c(-0.2,0,-0.25,0.1), "cm"))
240
241
```
242
243
## Effector molecules
244
```{r granzymes}
245
246
marker <- c("GZMA", "GZMB", "GZMH", "GZMK", "PRF1")
247
marker_full <- paste0("integratedrna_", marker)
248
249
p6 <- FetchData(ttox, slot = "data", vars = c(marker_full, 
250
                                              colnames(ttox@meta.data))) %>%
251
  filter(!IdentI %in% c(16)) %>%
252
  mutate(Pseudotime_round=round(Pseudotime, 1)) %>% 
253
  pivot_longer(cols = all_of(marker_full)) %>% 
254
  group_by(Pseudotime_round, name) %>% 
255
  dplyr::summarise(Mean=mean(value), `.groups`="drop") %>% 
256
  group_by(name) %>% 
257
  mutate(name=gsub(name, pattern = "integratedrna_", replacement = "")) %>% 
258
  mutate(name=factor(name, levels = marker)) %>% 
259
  group_by(name) %>%  
260
  dplyr::mutate(Mean=(Mean-min(Mean))/(max(Mean)-min(Mean))) %>% 
261
  filter(Mean < 0.98) %>% 
262
  dplyr::mutate(Mean=(Mean-min(Mean))/(max(Mean)-min(Mean))) %>% 
263
  ggplot(aes(x=Pseudotime_round, y=Mean, color=Pseudotime_round, fill=Pseudotime_round))+
264
  scale_fill_viridis(direction = -1, option = "viridis")+
265
  scale_color_viridis(direction = -1, option = "viridis")+
266
  geom_point(size=0.5, shape=21, stroke=0)+
267
  geom_vline(xintercept=24, size=0.25, linetype="dashed")+
268
  facet_wrap(~name, strip.position="top", ncol = 1)+
269
  scale_y_continuous(name="RNA level", breaks = c(0,0.5,1.0))+
270
  scale_x_continuous(name="Pseudotime", breaks = c(0, 10, 20, 20, 30))+
271
  mytheme_1+
272
  theme(strip.text = element_text(angle = 0, size=7, face="italic"),
273
        axis.title.y = element_blank(),
274
        axis.ticks.y = element_blank(),
275
        axis.text.y = element_blank(),
276
        panel.border = element_rect(size=0.5),
277
        plot.tag = element_text(margin = unit(c(0,0,-0.2,0), "cm")),
278
        plot.margin = unit(c(-0.2,0,-0.25,0.1), "cm"))
279
280
```
281
282
## Transcription factors
283
```{r tfs}
284
285
marker <- c("PRDM1", "BATF", "IRF4", "EOMES", "TCF7")
286
marker_full <- paste0("tfactivity_", marker, "-E")
287
288
p7 <- FetchData(ttox, slot = "data", vars = c(marker_full, "integratedadt_.CD4", "integratedadt_.CD8a",
289
                                              colnames(ttox@meta.data))) %>%
290
  filter(!IdentI %in% c(16)) %>%
291
  select(-integratedadt_.CD4, -integratedadt_.CD8a) %>% 
292
  pivot_longer(cols = all_of(marker_full)) %>% 
293
  mutate(value=ifelse(is.na(value), 0, value)) %>% 
294
  mutate(Pseudotime_round=round(Pseudotime, 1)) %>% 
295
  group_by(Pseudotime_round, name) %>% 
296
  dplyr::summarise(Mean=mean(value), `.groups`="drop") %>% 
297
  group_by(name) %>% 
298
  mutate(name=gsub(name, pattern = "tfactivity_|-E", replacement = "")) %>% 
299
  mutate(name=factor(name, levels = marker)) %>% 
300
  group_by(name) %>% 
301
  dplyr::mutate(Mean=(Mean-min(Mean))/(max(Mean)-min(Mean))) %>% 
302
  filter(Mean < 0.98 & Mean>0.02) %>% 
303
 dplyr::mutate(Mean=(Mean-min(Mean))/(max(Mean)-min(Mean))) %>% 
304
  ggplot(aes(x=Pseudotime_round, y=Mean, color=Pseudotime_round, fill=Pseudotime_round))+
305
  geom_point(size=0.5, shape=21, stroke=0)+
306
  scale_fill_viridis(direction = -1, option = "viridis")+
307
  scale_color_viridis(direction = -1, option = "viridis")+
308
  facet_wrap(~name, strip.position="top", ncol = 1)+
309
  scale_x_continuous(name="Pseudotime", breaks = c(0, 10, 20, 20, 30))+
310
  mytheme_1+
311
  theme(strip.text = element_text(angle = 0, size=7),
312
        axis.title.y = element_blank(),
313
        axis.ticks.y = element_blank(),
314
        panel.border = element_rect(size=0.5),
315
        axis.text.y = element_blank(),
316
        plot.tag = element_text(margin = unit(c(0,0,-0.2,0), "cm")),
317
        plot.margin = unit(c(-0.2,0.1,0,0.1), "cm"))
318
319
```
320
321
# Density per pseudotime
322
```{r density}
323
324
df <- FetchData(ttox, vars = c("Entity", "Pseudotime",
325
                               "PatientID", "IdentI")) %>%
326
  left_join(., df_meta %>% select(PatientID, Entity) %>% distinct) %>% 
327
  filter(IdentI!="16") %>% 
328
  mutate(Entity=gsub(Entity, pattern = ", GCB|, non-GCB", replacement = "")) %>% 
329
  mutate(Entity=factor(Entity, levels = c("rLN", "DLBCL", "MCL", "FL", "MZL")))
330
331
term_exh <- df %>% 
332
  drop_na() %>% 
333
  mutate(Exhausted=Pseudotime>24) %>% 
334
  add_prop(vars = c("PatientID", "Entity", "Exhausted"), group.vars = 1) %>% 
335
  fill_zeros(names_from = "Exhausted", values_from = "Prop")  %>% 
336
  filter(Exhausted==T) %>% 
337
  group_by(Entity) %>% 
338
  summarise(MeanProp=100*round(median(Prop), 2))
339
340
p8 <- ggplot()+
341
  geom_vline(xintercept = 24, linetype="dashed", size=0.25)+
342
  geom_density(data = df, aes(x=Pseudotime, group=PatientID, color=Entity), alpha=0.25, show.legend = F, adjust=1.6, size=0.25)+
343
   scale_color_brewer(palette = "Paired", limits=c( "DLBCL", "MCL", "FL", "MZL", "rLN"))+
344
  geom_text(data = data.frame(Entity=c("rLN", "DLBCL", "MCL", "FL", "MZL")), aes(label=Entity, x=0, y=0.2), size=2.5, hjust=0, check_overlap = T)+
345
  geom_text(data=term_exh, aes(x=28.3, y=0.2, label=paste0(MeanProp, "%")), hjust=0.5, size=2.5)+
346
  facet_wrap(~Entity, ncol = 1)+
347
  scale_y_continuous(limits=c(-0.015,0.22), breaks = c(0, 0.1, 0.2), name="Density")+
348
  annotation_custom(rasterGrob(t(viridis(n=100, direction = -1, option = "viridis")), width=unit(1,"npc"), height=unit(1,"npc")), 
349
                    ymin = -0.05, ymax = -0.01, xmin = -2.5, xmax = 32.5)+
350
  xlab("Pseudotime")+
351
  mytheme_1+
352
  theme(legend.position = "none",
353
        legend.text = element_text(size=7),
354
        strip.background = element_blank(),
355
        strip.text = element_blank(),
356
        legend.title = element_blank(),
357
        axis.title.y = element_text(size = 7, vjust = 3),
358
        plot.margin = unit(c(0,0.1,0,0.2), "cm"),
359
        panel.border = element_rect(size=0.5),
360
        plot.tag = element_text(margin = unit(c(0,-0.25,0,0), "cm")),
361
        legend.box.spacing = unit(units = "cm", 0.01),
362
        legend.key.height = unit(units = "cm", 0.15),
363
        legend.key.width = unit(units = "cm", 0.25))+
364
  labs(tag = "D")
365
366
```
367
368
# Survival analysis
369
## PFS analysis (Chapuy)
370
```{r pfs chapuy}
371
372
df_surv <- 
373
    left_join(df_surv_chapuy, df_ttoxcompl_chapuy) %>% 
374
    mutate(Ratio=Exhausted/Absolute) %>% 
375
    select(PatientID, status_pfs, time_pfs, Ratio)
376
377
mxs.obj <- maxstat.test(Surv(time_pfs, status_pfs) ~ Ratio, data=df_surv,
378
                        smethod="LogRank", pmethod="exactGauss", 
379
                        minprop = 0.27, maxprop=0.75, abseps=0.01)
380
381
df_surv <- mutate(df_surv, Factor=ifelse(Ratio > mxs.obj$estimate, "High", "Low"))
382
fit <- survfit(Surv(time_pfs, status_pfs) ~ Factor, data = df_surv)
383
384
p10 <- ggsurvplot(fit, data = df_surv, 
385
           pval = TRUE, 
386
           pval.size = 2.5,
387
           censor.size=2,
388
           size=0.25,
389
           pval.coord = c(5.5, 0.95),
390
           xlab = "Progression-free survival (Years)",
391
           ylab = "Survival probability",
392
           palette = c(colors_umap_cl[["18"]], colors_umap_cl[["12"]]),
393
           legend.labs = c("Exhaustion High", "Exhaustion Low"),
394
           legend.title = "", 
395
           legend = c(0.3,0.2),
396
           fontsize = 2.5,
397
           title="Chapuy et al. 2018 (DLBCL)",
398
           ggtheme = mytheme_1+theme(plot.title = element_text(hjust = 0.5, size=7, face = "plain"),
399
                                     legend.text = element_text(size=7),
400
                                     panel.border = element_rect(size=0.5),
401
                                     legend.key.height = unit(units = "cm", 0.3),
402
                                     legend.margin = margin(c(0,0,0,0), unit = "cm"),
403
                                     legend.spacing.x = unit(units = "cm", 0.2),
404
                                     legend.title = element_blank()))
405
406
407
```
408
409
## PFS analysis (Schmitz)
410
```{r pfs schmitz}
411
412
df_surv <- 
413
  left_join(df_surv_schmitz, df_ttoxcompl_schmitz) %>% 
414
  mutate(Ratio=Exhausted/Absolute) %>% 
415
  select(PatientID, Subtype, Gender, Age, time_pfs, status_pfs, Ratio) %>% 
416
  filter(time_pfs!="NA") %>% 
417
  mutate(time_pfs=as.numeric(time_pfs))
418
419
mxs.obj <- maxstat.test(Surv(time_pfs, status_pfs) ~ Ratio, data=df_surv,
420
                        smethod="LogRank", pmethod="exactGauss", 
421
                        minprop = 0.27, maxprop=0.75, abseps=0.01)
422
423
df_surv <- mutate(df_surv, Factor=ifelse(Ratio > mxs.obj$estimate, "High", "Low"))
424
fit <- survfit(Surv(time_pfs, status_pfs) ~ Factor, data = df_surv)
425
426
p11 <- ggsurvplot(fit, data = df_surv, 
427
           pval = TRUE, 
428
           pval.size = 2.5,
429
           censor.size=2,
430
           size=0.25,
431
           pval.coord = c(8.5, 0.95),
432
           xlab = "Progression-free survival (Years)",
433
           ylab = "Survival probability",
434
           palette = c(colors_umap_cl[["18"]], colors_umap_cl[["12"]]),
435
           legend.labs = c("Exhaustion High", "Exhaustion Low"),
436
           legend.title = "", 
437
           legend = c(0.3,0.2),
438
           fontsize = 2.5,
439
           title="Schmitz et al. 2018 (DLBCL)",
440
           ggtheme = mytheme_1+theme(plot.title = element_text(hjust = 0.5, size=7, face = "plain"),
441
                                     legend.text = element_text(size=7),
442
                                     panel.border = element_rect(size=0.5),
443
                                     legend.key.height = unit(units = "cm", 0.3),
444
                                     legend.margin = margin(c(0,0,0,0), unit = "cm"),
445
                                     legend.spacing.x = unit(units = "cm", 0.2),
446
                                     legend.title = element_blank()))
447
448
449
```
450
451
## PFS Gallium
452
```{r gallium}
453
454
p12 <- readRDS("data/SurvPlot_Ttox_Gallium.rds")
455
p12$plot$plot_env$legend <- c(0.3, 0.2)
456
p12$plot$theme$legend.position <- c(0.35, 0.2)
457
p12$plot$theme$legend.text$size <- 7
458
459
```
460
461
# Assemble plot
462
```{r assemble, fig.height=7.5}
463
464
p_full_p1 <- 
465
  wrap_plots(wrap_plots(p1/plot_spacer()/p3+plot_layout(heights = c(1,0.1,1)))+
466
                       wrap_plots(p4+labs(tag = "C")+
467
                                    p5+
468
                                    p6+
469
                                    p7+
470
                                    plot_layout(ncol = 4))+
471
                       p8+plot_layout(widths = c(1.15,2.1,0.6)))
472
473
p_full_p2 <- wrap_plots(p10$plot+labs(tag = "E")+p11$plot+labs(tag = "F")+p12$plot+labs(tag = "G"))
474
475
p_full <- p_full_p1/p_full_p2+plot_layout(heights = c(13.5,5))
476
p_full
477
478
#ggsave(width = 18.6, height = 17.5, units = "cm", filename = "Figure5.pdf")
479
480
```
481
482
# Session info
483
```{r session}
484
485
sessionInfo()
486
487
```