forked from MolecularPathologyLab/DDIR-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DDIR_Figures_Script.R
2889 lines (2250 loc) · 114 KB
/
DDIR_Figures_Script.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
###############################################################################################
############################## Research Script for ######################################
#### In-depth clinical and biological exploration of DNA Damage Immune Response (DDIR) as ####
############### a biomarker for oxaliplatin use in colorectal cancer ####################
###########################----------------------------------##################################
########################### Authour: Sudhir Malla ##################################
########################### Email: smalla01@qub.ac.uk ##################################
########## Molecular Pathology Research Group (Dunne Lab | dunne-lab.com) ##########
###################### Lab Email : dunnelabqub@gmail.com ###########################
###############################################################################################
# #
# Figure 2 : Lines 77 to 387 #
# Figure 3 : Lines 389 to 706 #
# Figure 4 : Lines 708 to 1090 #
# Figure 5 : Lines 1092 to 1213 #
# #
#---------------------------------------------------------------------------------------------#
# #
# Supplementary Figure 3 : Lines 1222 to 1489 #
# Supplementary Figure 4 : Lines 1491 to 1758 #
# Supplementary Figure 5 : Lines 1760 to 2164 #
# Supplementary Figure 6 : Lines 2166 to 2656 #
# Supplementary Figure 7 : Lines 2658 to 2753 #
# Supplementary Figure 8 : Lines 2755 to 2849 #
# #
###############################################################################################
## Load libraries
library(ggplot2)
library(beeswarm)
library(CePa) # was used to read .gct file
library(tidyverse) # data manipulation
library(plyr)
library(cowplot)
library(grid)
library(ggpubr)
## Put the Reproducible_script directory here - indicate where you want to save
setwd()
###############################################################################################
## Save default par before manipulating plots
default.par <- par()
options(scipen = 999) ## no scientific decimal system
## Cohorts used ---
cohort.1 <- "FOCUS"
cohort.2 <- "FOxTROT"
cohort.3 <- "TRANSBIG"
## data folder - Create a data folder and move data files here required for this script
data.folder <- file.path(getwd(), "data")
#if(!dir.exists(data.folder)) dir.create(data.folder, showWarnings = F, recursive = T)
focus.file.path <- file.path(data.folder,
"FOCUS_DDIR_n361_maxMean_MCP_ESTIMATE_ssGSEA_clino_expression_data.txt")
foxtrot.file.path <- file.path(data.folder,
"FOxTROT_DDIR_n97_maxMean_MCP_ESTIMATE_ssGSEA_clino_expression_data.txt")
transbig.file.path <- file.path(data.folder,
"TRANSBIG_DDIR_n198_maxMean_MCP_ESTIMATE_ssGSEA_clino_expression_data.txt")
## Import ---
focus.data <- read.delim(focus.file.path, header = T, stringsAsFactors = F)
foxtrot.data <- read.delim(foxtrot.file.path, header = T, stringsAsFactors = F)
transbig.data <- read.delim(transbig.file.path, header = T, stringsAsFactors = F)
## Change the data.1 with the data from three cohort as needed
#data.1 <- focus.data
#data.1 <- foxtrot.data
#data.1 <- transbig.data
###############################################################################################
###################################### Figure 2 ##########################################
###############################################################################################
###################################### Figure 2A ##########################################
### Figure 2A) CMS vs DDIR scores - boxplot - FOCUS --->>>
data.1 <- focus.data
data.1[["CMS"]] <- plyr::revalue(data.1[["CMS"]], c("Unclassified"= "UNK"))
## Statistics:
## Tukey's HSD test
## form a model (one-way ANOVA)
model.1 <- lm(DDIR_scores ~ CMS, data = data.1)
summary(model.1)
ANOVA.1 <- aov(model.1, data = data.1)
summary(ANOVA.1)
## posthoc tukey
posthoc.1 <- TukeyHSD(ANOVA.1, 'CMS', conf.level = 0.95)
Tukey.result.1 <- posthoc.1$CMS
## Setting p-value
options(scipen = 999)
pvalue.1 <- ifelse(Tukey.result.1[1,4] > 0.0001,
paste0("P = ", round(Tukey.result.1[1,4], 4)),
paste0("P < 0.0001"))
pvalue.2 <- ifelse(Tukey.result.1[2,4] > 0.0001,
paste0("P = ", round(Tukey.result.1[2,4], 4)),
paste0("P < 0.0001"))
pvalue.3 <- ifelse(Tukey.result.1[3,4] > 0.0001,
paste0("P = ", round(Tukey.result.1[3,4], 4)),
paste0("P < 0.0001"))
pvalue.4 <- ifelse(Tukey.result.1[4,4] > 0.0001,
paste0("P = ", round(Tukey.result.1[4,4], 4)),
paste0("P < 0.0001"))
kruskal.1 <- kruskal.test(data.1[["DDIR_scores"]] ~ as.factor(data.1[["CMS"]]),
data = data.1)
pvalue.5 <- ifelse(kruskal.1$p.value > 0.0001,
paste0("Kruskal-Wallis, p = ", round(kruskal.1$p.value, 4)),
paste0("Kruskal-Wallis, p < 0.0001"))
### ---
#tiff("Figure_2A.tiff", height = 16, width = 18, units = 'cm', res = 800)
## Plot:
par(mar = c(2.1,4.1,4,2.1))
boxplot(data.1[["DDIR_scores"]] ~ data.1[["CMS"]], data = data.1,
ylim = c(-0.30, 1), cex.axis = 1.2, outline = FALSE,
ylab = "", xlab = "")
beeswarm(data.1[["DDIR_scores"]] ~ data.1[["CMS"]], data = data.1,
add = TRUE, pch = 19, cex = 1.6, spacing = 1.2,
method = "swarm", corral="wrap",
col = c("#E18C28", "#0B5F9C", "#C46294", "#129063", "#A4A4A4"))
## Add titles
title(main = paste0("DDIR score by CMS subtypes\n",cohort.1," trial cohort"),
line = 1, cex.main = 1.8)
title(ylab = paste0("DDIR Scores"), line = 2.6, cex.lab = 1.6)
## Add DDIR threshold (CRC = 0.1094)
abline(h=0.1094, col = "red", lty = 2, lwd = 3)
## Add stats
segments(1,0.6,2,0.6, lwd = 2)
text(1.5, 0.63, pvalue.1, cex = 1.2)
segments(1,0.7,3,0.7, lwd = 2)
text(2, 0.73, pvalue.2, cex = 1.2)
segments(1,0.8,4,0.8, lwd = 2)
text(2.5, 0.83, pvalue.3, cex = 1.2)
segments(1,0.9,5,0.9, lwd = 2)
text(3, 0.93, pvalue.4, cex = 1.2)
mtext(pvalue.5, side = 3, line = -1.4, adj = 0.98, cex = 1.2)
## dev off
dev.off()
###############################################################################################
###################################### Figure 2B ##########################################
### Figure 2B) CMS vs DDIR scores - boxplot - FOxTROT --->>>
data.1 <- foxtrot.data
data.1[["CMS"]] <- plyr::revalue(data.1[["CMS"]], c("Unclassified"= "UNK"))
## Statistics:
## Tukey's HSD test
## form a model (one-way ANOVA)
model.1 <- lm(DDIR_scores ~ CMS, data = data.1)
summary(model.1)
ANOVA.1 <- aov(model.1, data = data.1)
summary(ANOVA.1)
# posthoc tukey
posthoc.1 <- TukeyHSD(ANOVA.1, 'CMS', conf.level = 0.95)
Tukey.result.1 <- posthoc.1$CMS
## Setting p-value
options(scipen = 999)
pvalue.1 <- ifelse(Tukey.result.1[1,4] > 0.0001,
paste0("P = ", round(Tukey.result.1[1,4], 4)),
paste0("P < 0.0001"))
pvalue.2 <- ifelse(Tukey.result.1[2,4] > 0.0001,
paste0("P = ", round(Tukey.result.1[2,4], 4)),
paste0("P < 0.0001"))
pvalue.3 <- ifelse(Tukey.result.1[3,4] > 0.0001,
paste0("P = ", round(Tukey.result.1[3,4], 4)),
paste0("P < 0.0001"))
pvalue.4 <- ifelse(Tukey.result.1[4,4] > 0.0001,
paste0("P = ", round(Tukey.result.1[4,4], 4)),
paste0("P < 0.0001"))
kruskal.1 <- kruskal.test(data.1[["DDIR_scores"]] ~ as.factor(data.1[["CMS"]]),
data = data.1)
pvalue.5 <- ifelse(kruskal.1$p.value > 0.0001,
paste0("Kruskal-Wallis, p = ", round(kruskal.1$p.value, 4)),
paste0("Kruskal-Wallis, p < 0.0001"))
### ---
#tiff("Figure_2B.tiff", height = 16, width = 18, units = 'cm', res = 800)
## Plot:
par(mar = c(2.1,4.1,4,2.1))
boxplot(data.1[["DDIR_scores"]] ~ data.1[["CMS"]], data = data.1,
ylim = c(-0.30, 1), cex.axis = 1.2, outline = FALSE,
ylab = "", xlab = "")
beeswarm(data.1[["DDIR_scores"]] ~ data.1[["CMS"]], data = data.1,
add = TRUE, pch = 19, cex = 1.6, spacing = 1.2,
method = "swarm", corral="wrap",
col = c("#E18C28", "#0B5F9C", "#C46294", "#129063", "#A4A4A4"))
## Add titles
title(main = paste0("DDIR score by CMS subtypes\n",cohort.2," trial cohort"),
line = 1, cex.main = 1.8)
title(ylab = paste0("DDIR Scores"), line = 2.6, cex.lab = 1.6)
## Add DDIR threshold (CRC = 0.1094)
abline(h=0.1094, col = "red", lty = 2, lwd = 3)
## Add stats
segments(1,0.66,2,0.66, lwd = 2)
text(1.5, 0.69, pvalue.1, cex = 1.2)
segments(1,0.74,3,0.74, lwd = 2)
text(2, 0.77, pvalue.2, cex = 1.2)
segments(1,0.82,4,0.82, lwd = 2)
text(2.5, 0.85, pvalue.3, cex = 1.2)
segments(1,0.90,5,0.90, lwd = 2)
text(3, 0.93, pvalue.4, cex = 1.2)
mtext(pvalue.5, side = 3, line = -1.4, adj = 0.98, cex = 1.2)
## dev off
dev.off()
###############################################################################################
################################## Figure 2C and 2E #######################################
### Figure 2C) MSI status vs DDIR subtypes Bargraph - FOCUS --->>>
### Figure 2E) MSI status vs DDIR subtypes Bargraph - FOxTROT --->>>
## Select ONE:
data.1 <- focus.data # For Fig 2C
#data.1 <- foxtrot.data # For Fig 2E
## Form table for MSI status in DDIR POS vs DDIR NEG
table.1 <- table(data.1[["MSI"]], data.1[["DDIR"]]) # for fishers test, removing NA
table.2 <- table(data.1[["MSI"]], data.1[["DDIR"]], useNA="ifany") #for proportion and graph
## Proportion table for graph
prop.1 <- prop.table(table.2, 2)
rownames(prop.1)[3] <- "NA" # rename the third row name
## Turn proportion table into long format
prop.long.1 <- as.data.frame(prop.1)
## Statistics:
## Fisher's Exact test (MSI) ## everthing left at default
fisher.1 <- fisher.test(table.1)
pvalue.1 <- ifelse(fisher.1$p.value > 0.0001,
paste0("Fisher's Exact test, p = ",round(fisher.1$p.value, 4)),
"Fisher's Exact, p < 0.0001")
### ---
#tiff("Figure_2C.tiff", height = 16, width = 18, units = 'cm', res = 800)
#tiff("Figure_2E.tiff", height = 16, width = 18, units = 'cm', res = 800)
## Plot:
ggplot(prop.long.1) +
geom_bar(aes(x = Var2, y = Freq, fill = Var1),data = prop.long.1,
stat = "identity", width = 0.7,
position = position_stack(reverse = TRUE))+
## Add colour and legend
scale_fill_manual(values = c("darkorange", "blue4", "darkgrey"),
guide=guide_legend(reverse=TRUE, title = paste0('MSI'))) +
## Add limit to y-axis
scale_y_continuous(limits = c(0,1), expand = c(0,0))+
## Add titles
xlab(" ") +
ylab("Sample Proportions") +
labs(title = paste0("MSI status in DDIR\n",
## Select cohort.1 for FOCUS, cohort.2 for FOxTROT
cohort.1,
#cohort.2,
" trial cohort")) +
## Theme for main title
theme(plot.title = element_text(face = 'bold', size = 22,
margin = margin(15,0,0,0),
vjust = 4.3, hjust = 0.5, lineheight = 1)) +
## Add p-value
labs(caption = pvalue.1)+
theme(plot.caption = element_text(size = 20,
margin = margin(15,0,0,0), hjust = 0.5)) +
## Plot background theme
theme(axis.title.x = element_blank(),
axis.text.x = element_text(size = 20, colour = "black"),
axis.title.y = element_text(size = 20, vjust = 3),
axis.text.y = element_text(size = 18, colour = "black", angle = 90, hjust = 0.5),
axis.ticks.y = element_line(size = 0.5, colour = "black"),
axis.ticks.length = unit(0.2, "cm"),
axis.line.y = element_line(size = 0.5, colour = "black"),
axis.ticks.x = element_blank(),
panel.background = element_rect(fill = 'white'),
##legend
legend.background = element_blank(),
legend.text = element_text(size = 18),
legend.title = element_text(size = 18, face = 'bold'),
legend.title.align = 0,
legend.position = c(0.95,0.78),
legend.key.height = unit(1.0, 'cm'),
legend.key.width = unit(1.0, 'cm'),
legend.margin = margin(-25,0,0,35),
plot.margin = unit(c(5,50,5,5),'mm'))
## dev off
dev.off()
###############################################################################################
################################## Figure 2D and 2F #######################################
### Figure 2D) MSI status vs DDIR score boxplot - FOCUS --->>>
### Figure 2F) MSI status vs DDIR score boxplot - FOxTROT --->>>
## Select ONE:
data.1 <- focus.data # For Fig 2D
#data.1 <- foxtrot.data # For Fig 2F
## Determine DDIR (y-axis) range
## Range if y-axis is DDIR score
## NOTE: to keep consistent between FOCUS and FOxTROT, lowest minimun value,
## and highest maximum value (+/-0.1) of DDIR scores between the two cohort
## will be used as y-axis.
# min value from FOCUS and max value from FOxTROT DDIR scores (-/+0.1) will be used.
y.min.1 <- -0.36
y.max.1 <- 0.72
## Statistics:
t.test.1 <- t.test(DDIR_scores ~ MSI, data = data.1)
pvalue.1 <- ifelse(t.test.1$p.value > 0.0001,
paste0("t-test, p = ",round(t.test.1$p.value, 4)),
"t-test, p < 0.0001")
wilcox.1 <- wilcox.test(DDIR_scores ~ MSI, data = data.1)
pvalue.2 <- ifelse(wilcox.1$p.value > 0.0001,
paste0("Wilcoxon test, p = ",round(wilcox.1$p.value, 4)),
"Wilcoxon test, p < 0.0001")
### ---
#tiff("Figure_2D.tiff", height = 16, width = 18, units = 'cm', res = 800)
#tiff("Figure_2F.tiff", height = 16, width = 18, units = 'cm', res = 800)
## Plot:
par(mar=c(5.1,4.5,4.1,2.1)+0.5)
boxplot(DDIR_scores ~ MSI, data = data.1,
outline = FALSE, ylim = c(y.min.1, y.max.1),
cex.axis = 1.6,cex.lab = 1.6)
beeswarm(DDIR_scores ~ MSI, data = data.1,
method = "swarm", corral = "wrap", pch = 19,
col = c("darkorange", "blue4"),cex = 1.5, spacing = 1.2,
add = TRUE)
## Add titles
title(ylab = paste0("DDIR Scores"), line = 2.8, cex.lab = 1.6)
title(main = paste0("MSI status vs DDIR scores\n",
## Select cohort.1 for FOCUS, cohort.2 for FOxTROT
cohort.1,
#cohort.2,
" trial cohort"), cex.main = 1.8)
## Add DDIR threshold (CRC = 0.1094)
abline(h=0.1094, col = "red", lty = 2, lwd = 3)
## Add stats
mtext(pvalue.1, side = 1, line = 2.8, cex = 1.6)
mtext(pvalue.2, side = 1, line = 4.2, cex = 1.6)
## dev off
dev.off()
###############################################################################################
###################################### Figure 3 ##########################################
###############################################################################################
## Import GSEA findings ---
## GSEA file paths
focus.gsea.filepath.1 <- file.path(data.folder,
"FOCUS_gsea_report_for_DDRD_POS_1555345550304.xls")
focus.gsea.filepath.2 <- file.path(data.folder,
"FOCUS_gsea_report_for_DDRD_NEG_1555345550304.xls")
foxtrot.gsea.filepath.1 <- file.path(data.folder,
"FOxTROT_gsea_report_for_DDRD_POS_1560787000819.xls")
foxtrot.gsea.filepath.2 <- file.path(data.folder,
"FOxTROT_gsea_report_for_DDRD_NEG_1560787000819.xls")
transbig.gsea.filepath.1 <- file.path(data.folder,
"TRANSBIG_gsea_report_for_DDRD_POS_1579086912188.xls")
transbig.gsea.filepath.2 <- file.path(data.folder,
"TRANSBIG_gsea_report_for_DDRD_NEG_1579086912188.xls")
## import
focus.gsea.pos <- read.delim(focus.gsea.filepath.1, header = T, stringsAsFactors = F)
focus.gsea.neg <- read.delim(focus.gsea.filepath.2, header = T, stringsAsFactors = F)
foxtrot.gsea.pos <- read.delim(foxtrot.gsea.filepath.1, header = T, stringsAsFactors = F)
foxtrot.gsea.neg <- read.delim(foxtrot.gsea.filepath.2, header = T, stringsAsFactors = F)
transbig.gsea.pos <- read.delim(transbig.gsea.filepath.1, header = T, stringsAsFactors = F)
transbig.gsea.neg <- read.delim(transbig.gsea.filepath.2, header = T, stringsAsFactors = F)
###############################################################################################
###############################################################################################
## Plot with combined GSEA results for three cohorts with geneset
## significant in at least one cohort.
## FOCUS
focus.posneg <- rbind(focus.gsea.pos, focus.gsea.neg)
head(focus.posneg)
## NOTE: "HALLMARK_REACTIVE_OXIGEN_SPECIES_PATHWAY" has been misspelled in the GSEA result.
## Amend it so it does not impact result downstream
focus.posneg$NAME <- focus.posneg$NAME %>%
revalue(c("HALLMARK_REACTIVE_OXIGEN_SPECIES_PATHWAY" =
"HALLMARK_REACTIVE_OXYGEN_SPECIES_PATHWAY"))
names(focus.posneg) # to select column with NAME, NES, FDR, size
FOCUS <- subset(focus.posneg, select = c(1,4,6,8))
head(FOCUS)
FOCUS <- FOCUS %>% mutate(Cohort = "FOCUS") # add column named 'Cohort'
FOCUS.fdrsig <- FOCUS[FOCUS$FDR.q.val < 0.25 ,] # only FDR sig genesets
## FOxTROT
foxtrot.posneg <- rbind(foxtrot.gsea.pos, foxtrot.gsea.neg)
head(foxtrot.posneg)
## NOTE: "HALLMARK_REACTIVE_OXIGEN_SPECIES_PATHWAY" has been misspelled in the GSEA result.
## Amend it so it does not impact result downstream
foxtrot.posneg$NAME <- foxtrot.posneg$NAME %>%
revalue(c("HALLMARK_REACTIVE_OXIGEN_SPECIES_PATHWAY" =
"HALLMARK_REACTIVE_OXYGEN_SPECIES_PATHWAY"))
names(foxtrot.posneg)
FOxTROT <- subset(foxtrot.posneg, select = c(1,4,6,8))
head(FOxTROT)
FOxTROT <- FOxTROT %>% mutate(Cohort = "FOxTROT")
FOxTROT.fdrsig <- FOxTROT[FOxTROT$FDR.q.val < 0.25 ,]
## TRANSBIG
transbig.posneg <- rbind(transbig.gsea.pos, transbig.gsea.neg)
head(transbig.posneg)
## NOTE: "HALLMARK_REACTIVE_OXIGEN_SPECIES_PATHWAY" has been misspelled in the GSEA result.
## Amend it so it does not impact result downstream
transbig.posneg$NAME <- transbig.posneg$NAME %>%
revalue(c("HALLMARK_REACTIVE_OXIGEN_SPECIES_PATHWAY" =
"HALLMARK_REACTIVE_OXYGEN_SPECIES_PATHWAY"))
names(transbig.posneg)
TRANSBIG <- subset(transbig.posneg, select = c(1,4,6,8))
head(TRANSBIG)
TRANSBIG <- TRANSBIG %>% mutate(Cohort = "TRANSBIG")
TRANSBIG.fdrsig <- TRANSBIG[TRANSBIG$FDR.q.val < 0.25 ,]
## Find out common and different pathway between cohorts
## common and different (FOCUS, FOxTROT, and TRANSBIG)
FcFxTr <- intersect(intersect(FOCUS.fdrsig$NAME, FOxTROT.fdrsig$NAME),
TRANSBIG.fdrsig$NAME) # common in all three
FcFx <- intersect(FOCUS.fdrsig$NAME, FOxTROT.fdrsig$NAME) # common in Fc and Fx
## NOTE: FcFx do not have anything in common than FcFxTr
FcTr <- intersect(FOCUS.fdrsig$NAME, TRANSBIG.fdrsig$NAME) # common in Fc and Tr
FcTr <- FcTr[!FcTr %in% FcFxTr] # common in Fc and Tr excluding FcFxTr
FxTr <- intersect(FOxTROT.fdrsig$NAME, TRANSBIG.fdrsig$NAME) # common in Fx and Tr
FxTr <- FxTr[!FxTr %in% FcFxTr] # common in Fx and Tr excluding FcFxTr
## FOCUS only
Fconly <- FOCUS.fdrsig$NAME
Fconly <- Fconly[!Fconly %in% FcFxTr]
Fconly <- Fconly[!Fconly %in% FcTr]
## FOxTROT only
FxOnly <- FOxTROT.fdrsig$NAME
FxOnly <- FxOnly[!FxOnly %in% FcFxTr]
FxOnly <- FxOnly[!FxOnly %in% FxTr]
## TRANSBIG only
TrOnly <- TRANSBIG.fdrsig$NAME
TrOnly <- TrOnly[!TrOnly %in% FcFxTr]
TrOnly <- TrOnly[!TrOnly %in% FcTr]
TrOnly <- TrOnly[!TrOnly %in% FxTr]
## rbind three cohort
all3cohorts <- rbind(FOCUS, FOxTROT, TRANSBIG)
dim(all3cohorts)
head(all3cohorts)
## add new variable column
all3cohort2 <- all3cohorts %>% mutate(Common = as.character(ifelse(all3cohorts$NAME %in% FcFxTr, "FcFxTr",
ifelse(all3cohorts$NAME %in% FcTr, "FcTr",
ifelse(all3cohorts$NAME %in% FxTr, "FxTr",
ifelse(all3cohorts$NAME %in% Fconly, "Fconly",
ifelse(all3cohorts$NAME %in% FxOnly, "FxOnly",
ifelse(all3cohorts$NAME %in% TrOnly, "TrOnly", NA))))))))
## select fdrsig hallmarks from all cohorts
FDRsig.name <- as.character(all3cohort2[as.numeric(as.character(all3cohort2$FDR.q.val)) < 0.25 ,]$NAME)
FDRsig.name <- FDRsig.name[!duplicated(FDRsig.name)] #remove duplicates
## select these fdr.sig hallmark from all cohorts
all3fdr <- all3cohort2[all3cohort2$NAME %in% FDRsig.name ,]
## remove strings
all3fdr$NAME <- gsub("HALLMARK ", "", gsub("_", " ", all3fdr$NAME))
head(all3fdr)
### ---
### Combined dot plot ---
###################################### Figure 3A ##########################################
### Figure 3A) Dot plot with common gene sets in all three cohort and only in BC cohort --->>>
par(mar=c(5.1,3.1,4.1,2.1))
## All common
p1a <- all3fdr[all3fdr$Common == "FcFxTr" ,] %>%
ggplot(aes(x = Cohort,y = reorder(NAME, NES), color = NES, size = 5,
shape = ifelse(FDR.q.val < 0.25, 19, 144))) + # leave blank if ns
scale_shape_identity()+
geom_point(stat = "identity")+
guides(size = FALSE, color = FALSE, shape = FALSE)+
xlab("")+
ylab("")+
theme_minimal()+
theme(axis.text.x=element_blank())+
theme(legend.position = "none")+
scale_color_gradient2(low = "blue", high = "red", midpoint = 0,
limits = c(-2.5,2.5)) + labs(shape = "FDR.q.val")+
theme(axis.title.y=element_blank(),
axis.text.y = element_text(size = 12, angle = 0, face = "bold"),
axis.text.x = element_text(size = 14, angle = 0, face = "bold",
margin = margin(t = 10, r = 0, b = 0, l = 0)),
legend.position="right",
legend.key = element_rect(fill = "white")) +
theme(legend.position="none", plot.margin = unit(c(0,0.5,0,6), "lines"))+
ggtitle("GSEA - Hallmarks") +
theme(plot.title = element_text(size = 16, face = 'bold', hjust = 0.5, vjust = 0,
margin = ggplot2::margin(0,0,0.5,0,'cm'))) +
scale_x_discrete(position = "top")
## adding side line and text
p1b <- p1a +
annotation_custom(grob = linesGrob(gp = gpar(col='red', lwd = 3)),
ymin = 0.8, ymax = 5.2, xmin = -2, xmax = -2)
txt.g1a <- text_grob(label = "ALL", color = 'red', face = 'bold',
rot = 90, size = 20, hjust = 0.5)
p1c <- p1b +
annotation_custom(txt.g1a, ymin = 0.8, ymax = 5.2, xmin = -2.2, xmax = -2.2)
## Code to override clipping
gt.p1b <- ggplotGrob(p1c)
gt.p1b$layout[grepl("panel", gt.p1b$layout$name), ]$clip <- "off"
## Draw the plot
grid.newpage()
grid.draw(gt.p1b)
### ---
## TRANSBIG only
p4a <- all3fdr[all3fdr$Common == "TrOnly" ,] %>%
ggplot(aes(x = Cohort, y = reorder(NAME, NES), color = NES, size = 5,
shape = ifelse(FDR.q.val < 0.25, 19, 144))) +
scale_shape_identity()+
geom_text(aes(label = ifelse(FDR.q.val < 0.25, ' ', 'ns')), colour = "black")+
geom_point(stat = "identity")+
guides(size = FALSE, color = guide_colourbar(title = 'NES'), shape = FALSE)+
xlab("")+
ylab("")+
theme_minimal()+
theme(axis.text.x=element_blank())+
scale_color_gradient2(low = "blue", high = "red", midpoint = 0,
limits = c(-2.5,2.5)) + labs(shape = "FDR.q.val")+
theme(axis.title.y=element_blank(),
axis.text.y = element_text(size = 12, angle = 0, face = "bold")) +
theme(legend.position="none",
legend.text = element_text(size = 12),
legend.key = element_rect(fill = "white"),
plot.margin = unit(c(0,0.5,0,6), "lines"))
## adding side line and text
p4b <- p4a +
annotation_custom(grob = linesGrob(gp = gpar(col='pink2', lwd = 3)),
ymin = 0.8, ymax = 8.2, xmin = -2, xmax = -2)
txt.g2a <- text_grob(label = "TRANSBIG", color = 'pink2', face = 'bold',
rot = 90, size = 20, hjust = 0.1)
p4c <- p4b +
annotation_custom(txt.g2a, ymin = 0.8, ymax = 6.2, xmin = -2.2, xmax = -2.2)
## Code to override clipping
gt.p4b <- ggplotGrob(p4c)
gt.p4b$layout[grepl("panel", gt.p4b$layout$name), ]$clip <- "off"
## Draw the plot
grid.newpage()
grid.draw(gt.p4b)
### ---
## Combine the separate plots into one
## plot separate legend
legend_p4a <- get_legend(p4a + theme(legend.position="right",
legend.text = element_text(size = 10),
legend.key = element_rect(fill = "white"),
plot.margin = unit(c(0,0.5,0,6), "lines")))
plot1a <- plot_grid(gt.p1b,gt.p4b, align = "v", nrow = 2,
rel_heights = c(0.4, 0.5))
plot2a <- plot_grid(plot1a, legend_p4a, ncol = 2,
rel_widths = c(1, 0.1))
### ---
#tiff("Figure_3A.tiff", height = 16, width = 23, units = 'cm', res = 800)
plot2a
dev.off()
###############################################################################################
################################# Figure 3B, 3C and 3D #####################################
### Figure 3B) CXCL10 expression vs DDIR score - TRANSBIG --->>>
### Figure 3C) CXCL10 expression vs DDIR score - FOCUS --->>>
### Figure 3D) CXCL10 expression vs DDIR score - FOxTROT --->>>
data.1 <- transbig.data
#data.1 <- focus.data
#data.1 <- foxtrot.data
variable.1 <- "CXCL10"
## Determine DDIR (y-axis) range
## Range if y-axis is DDIR score
## NOTE: to keep consistent between FOCUS and FOxTROT, lowest minimun value,
## and highest maximum value (+/-0.1) of DDIR scores between the two cohort
## will be used as y-axis.
## min value from FOCUS and max value from FOxTROT DDIR scores (-/+0.1) will be used.
y.min.1 <- -0.36
y.max.1 <- 0.72
## Statistics:
pearson.1 <- cor.test(data.1[["DDIR_scores"]], data.1[[variable.1]], data = data.1,
alternative = "two.sided", method = "pearson")
pvalue.1 <- ifelse(pearson.1$p.value > 0.0001,
paste0("P (two-tailed) = ",round(pearson.1$p.value, 4)),
"P (two-tailed) < 0.0001")
### ---
#tiff("Figure_3B.tiff", height = 16, width = 18, units = 'cm', res = 800)
#tiff("Figure_3C.tiff", height = 16, width = 18, units = 'cm', res = 800)
#tiff("Figure_3D.tiff", height = 16, width = 18, units = 'cm', res = 800)
## Plot:
par(mar=c(5.1,4.1,4.1,2.1))
plot(data.1[["DDIR_scores"]] ~ data.1[[variable.1]], data = data.1,
ylab = "", xlab = "",
## Select ylim for FOCUS and FOxTROT only
#ylim = c(y.min.1, y.max.1),
cex = 1.6, cex.axis = 1.6, pch = 19)
## Add titles
title(xlab = paste0(variable.1, ' expression (maxMean)'), line = 2.8, cex.lab = 1.6)
title(ylab = paste0("DDIR Scores"), line = 2.8, cex.lab = 1.6)
title(main = paste0(variable.1, " expression vs DDIR scores\n",
## Select as needed for each cohort
cohort.3,
#cohort.1,
#cohort.2,
" trial cohort"), line = 1, cex.main = 1.8)
## Add stats
mtext(paste0("Pearson r = ", round(pearson.1$estimate, digits = 4)),
side = 3, adj = 0.02, line = -1.4, cex = 1.4)
mtext(paste0(pvalue.1), side = 3, adj = 0.02, line = -2.6, cex = 1.4)
## Add DDIR threshold (BC = 0.37; CRC = 0.1094)
abline(h=0.37, col = "red", lty = 2, lwd = 3) # TRANSBIG
#abline(h=0.1094, col = "red", lty = 2, lwd = 3) # FOCUS and FOxTROT
## Add line of best fit
abline(lm(data.1[["DDIR_scores"]] ~ data.1[[variable.1]]), lwd = 2, col = "blue")
## dev off
dev.off()
###############################################################################################
###################################### Figure 4 ##########################################
###############################################################################################
###############################################################################################
################################# Figure 4A, 4B and 4C #####################################
### Figure 4A) MCP scores vs DDIR scores - TRANSBIG --->>>
### Figure 4B) MCP scores vs DDIR scores - FOCUS --->>>
### Figure 4C) MCP scores vs DDIR scores - FOxTROT --->>>
data.1 <- transbig.data
#data.1 <- focus.data
#data.1 <- foxtrot.data
variable.1 <- "T.cells"
variable.2 <- "B.lineage"
variable.3 <- "Monocytic.lineage"
## Statistics:
pearson.1 <- cor.test(data.1[["DDIR_scores"]], data.1[[variable.1]], data = data.1,
alternative = "two.sided", method = "pearson")
pearson.2 <- cor.test(data.1[["DDIR_scores"]], data.1[[variable.2]], data = data.1,
alternative = "two.sided", method = "pearson")
pearson.3 <- cor.test(data.1[["DDIR_scores"]], data.1[[variable.3]], data = data.1,
alternative = "two.sided", method = "pearson")
## pvalue
pvalue.1 <- ifelse(pearson.1$p.value > 0.0001,
paste0("p = ",round(pearson.1$p.value, 4)),
"p < 0.0001")
pvalue.2 <- ifelse(pearson.2$p.value > 0.0001,
paste0("p = ",round(pearson.2$p.value, 4)),
"p < 0.0001")
pvalue.3 <- ifelse(pearson.3$p.value > 0.0001,
paste0("p = ",round(pearson.3$p.value, 4)),
"p < 0.0001")
### ---
## Determine MCP (x-axis) range
empty.list.1 <- list()
for(i in c(variable.1, variable.2, variable.3)){
a <- data.frame(MCP = paste0(i), min = min(data.1[[i]]), max = max(data.1[[i]]))
empty.list.1[[i]] <- a
}
x.min.max.1 <- do.call(rbind, empty.list.1)
x.min.1 <- min(x.min.max.1[["min"]])-0.1
x.max.1 <- max(x.min.max.1[["max"]])+0.1
## Determine DDIR (y-axis) range
## Range if y-axis is DDIR score
## NOTE: to keep consistent between FOCUS and FOxTROT, lowest minimun value,
## and highest maximum value (+/-0.1) of DDIR scores between the two cohort
## will be used as y-axis.
# min value from FOCUS and max value from FOxTROT DDIR scores (-/+0.1) will be used.
y.min.1 <- -0.36
y.max.1 <- 0.72
#tiff("Figure_4A.tiff", height = 16, width = 18, units = 'cm', res = 800)
#tiff("Figure_4B.tiff", height = 16, width = 18, units = 'cm', res = 800)
#tiff("Figure_4C.tiff", height = 16, width = 18, units = 'cm', res = 800)
## Plot:
par(mar=c(7.1,4.1,3.5,2.1))
plot(data.1[["DDIR_scores"]] ~ data.1[[variable.1]],
xlim=c(x.min.1,x.max.1),
## Select ylim for FOCUS and FOxTROT only
#ylim = c(y.min.1, y.max.1),
col="red", pch = 19,ylab = "", xlab = "", cex.axis = 1.6, cex = 1.6)
points(data.1[["DDIR_scores"]] ~ data.1[[variable.2]],col="orange", pch = 19, cex = 1.6)
points(data.1[["DDIR_scores"]] ~ data.1[[variable.3]],col="blue", pch = 19, cex = 1.6)
## Add titles
title(xlab = paste0("MCP Scores"), line = 2.4, cex.lab = 1.6)
title(ylab = paste0("DDIR Scores"), line = 2.8, cex.lab = 1.6)
title(main = paste0("MCP scores vs DDIR scores\n",
## Select as needed for each cohort
cohort.3,
#cohort.1,
#cohort.2,
" trial cohort"),
line = 0.6, cex.main = 1.8)
## Add legend for four immune cells
legend("bottom", legend = c(paste0('T cells, Pearson r = ',round(pearson.1$estimate, 4),
' , ', pvalue.1),
paste0('B Lineage, Pearson r = ',round(pearson.2$estimate, 4),
' , ', pvalue.2),
paste0('M Lineage, Pearson r = ',round(pearson.3$estimate, 4),
' , ', pvalue.3)),
col = c("red", "orange", "blue"), pch = 19, bty = "n",
xpd = TRUE, inset = -0.363, ncol=1, cex = 1.2, x.intersp = 1, y.intersp = 1,
xjust = 0.5, yjust = 0)
## Add DDIR threshold (BC = 0.37; CRC = 0.1094)
abline(h=0.37, col = "red", lty = 2, lwd = 3) # TRANSBIG
#abline(h=0.1094, col = "red", lty = 2, lwd = 3) # FOCUS and FOxTROT
## as abline length cannot be controlled, clip the sides of the plot to cut lines off
clip(4.4, 11.8, -0.03,0.9) # TRANSBIG
#clip(3, 6, -0.35,0.64) # FOCUS
#clip(2.9, 7.4, -0.35,0.72) # FOxTROT
abline(lm(data.1[["DDIR_scores"]] ~ data.1[[variable.1]]), col = "red", lwd = 2)
abline(lm(data.1[["DDIR_scores"]] ~ data.1[[variable.2]]), col = "orange", lwd = 2)
abline(lm(data.1[["DDIR_scores"]] ~ data.1[[variable.3]]), col = "blue", lwd = 2)
## dev off
dev.off()
###############################################################################################
###################################### Figure 4D ##########################################
### Figure 4D) Cytotoxic Lymphocytes MCP score vs DDIR - barplot/scatterplot - TRANSBIG --->>>
data.1 <- transbig.data
variable.1 <- "Cytotoxic.lymphocytes"
## Statistics:
t.test.1 <- t.test(data.1[[variable.1]] ~ DDIR, data = data.1)
wilcox.1 <- wilcox.test(data.1[[variable.1]] ~ DDIR, data = data.1)
pearson.1 <- cor.test(data.1[["DDIR_scores"]], data.1[[variable.1]], data = data.1,
alternative = "two.sided", method = "pearson")
pvalue.1 <- ifelse(t.test.1$p.value > 0.0001, paste0("t-test, p = ",round(t.test.1$p.value, 4)),
"t-test, p < 0.0001")
pvalue.2 <- ifelse(wilcox.1$p.value > 0.0001, paste0("Wilcoxon test, p = ",round(wilcox.1$p.value, 4)),
"Wilcoxon test, p < 0.0001")
pvalue.3 <- ifelse(pearson.1$p.value > 0.0001,
paste0("P (two-tailed) = ",round(pearson.1$p.value, 4)),
"P (two-tailed) < 0.0001")
### ---
#tiff("Figure_4D.tiff", height = 16, width = 18, units = 'cm', res = 800)
## Plot:
par(mar=c(3.1,3.1,3.1,4.5)+1.5)
## Plot 1 (Scatterplot):
par(fig=c(0,1,0,0.85))
plot(data.1[[variable.1]], data.1[["DDIR_scores"]],
pch = 19, ylab = "", xlab = "", cex = 1.6, cex.axis = 1.6,
ylim = c(min(data.1[["DDIR_scores"]])-0.1, max(data.1[["DDIR_scores"]])+0.1))
## Add titles
title(ylab = paste0("DDIR Scores"), line =2.8, cex.lab = 1.6)
title(xlab = paste0("Cytotoxic Lymphocytes MCP scores"), line = 2.8, cex.lab = 1.6)
## Add stats 1 (pearson)
mtext(paste0("Pearson r = ", round(pearson.1$estimate, digits = 4)),
side = 3, adj = 0.02, line = -1.4, cex = 1.4)
mtext(paste0(pvalue.3), side = 3,adj = 0.02, line = -2.6, cex = 1.4)
## Add DDIR threshold (BC = 0.37)
abline(h=0.37, col = "red", lty = 2, lwd = 3)
## Add line of best fit
abline(lm(data.1[["DDIR_scores"]] ~ data.1[[variable.1]]), lwd = 2)
## Plot 2 (boxplot):
par(fig=c(0,1,0.65,1), new=TRUE) # adding another graph to the same plot
boxplot(data.1[[variable.1]] ~ data.1[["DDIR"]], horizontal=TRUE, axes=FALSE,
col = c("blue", "red"))
## Add legend 2 (DDIR)
legend("topright", legend = c("POS", "NEG"), title = list("DDIR"),
col = c("red", "blue"),pch = 15, title.adj = 0.78, y.intersp = 0.9,
bty = "n", cex = 1.4, xpd = TRUE,inset = c(-0.22, -1.2), adj = c(0.1,0.5))
## Add titles
title(main = paste0("Cytotoxic Lymphocytes MCP scores\n",cohort.3," trial cohort"),
line = 1.4, cex.main = 1.8)
## Add stats 2 (t.test)
mtext(pvalue.1, side = 1, line = 0.5, cex = 1.4, adj = 0.02)
mtext(pvalue.2, side = 1, line = 1.7, cex = 1.4, adj = 0.02)
## dev off
dev.off()
###############################################################################################
################################### Figure 4E and 4F ######################################
### Figure 4E) Cytotoxic Lymphocytes MCP score vs DDIR - barplot/scatterplot - FOCUS --->>>
### Figure 4F) Cytotoxic Lymphocytes MCP score vs DDIR - barplot/scatterplot - FOxTROT --->>>
data.1 <- focus.data
#data.1 <- foxtrot.data
variable.1 <- "Cytotoxic.lymphocytes"
data.1[["CMS"]] <- plyr::revalue(data.1[["CMS"]], c("Unclassified"= "UNK"))
## Statistics:
t.test.1 <- t.test(data.1[[variable.1]] ~ DDIR, data = data.1)
wilcox.1 <- wilcox.test(data.1[[variable.1]] ~ DDIR, data = data.1)
pearson.1 <- cor.test(data.1[["DDIR_scores"]], data.1[[variable.1]], data = data.1,
alternative = "two.sided", method = "pearson")
pvalue.1 <- ifelse(t.test.1$p.value > 0.0001, paste0("t-test, p = ",round(t.test.1$p.value, 4)),
"t-test, p < 0.0001")
pvalue.2 <- ifelse(wilcox.1$p.value > 0.0001, paste0("Wilcoxon test, p = ",round(wilcox.1$p.value, 4)),
"Wilcoxon test, p < 0.0001")
pvalue.3 <- ifelse(pearson.1$p.value > 0.0001,
paste0("P (two-tailed) = ",round(pearson.1$p.value, 4)),
"P (two-tailed) < 0.0001")
## Set up CMS colour
col.1 <- c("#E18C28","#0B5F9C","#C46294","#129063","#A4A4A4")
names(col.1) <- c("CMS1", "CMS2", "CMS3", "CMS4", "UNK")
col.1 <- col.1[data.1[, 'CMS']]
### ---
#tiff("Figure_4E.tiff", height = 16, width = 18, units = 'cm', res = 800)
#tiff("Figure_4F.tiff", height = 16, width = 18, units = 'cm', res = 800)
## Plot:
par(mar=c(3.1,3.1,3.1,4.5)+1.5)
## Plot 1 (Scatterplot):
par(fig=c(0,1,0,0.85))
plot(data.1[[variable.1]], data.1[["DDIR_scores"]],
pch = 19, col = col.1, ylab = "", xlab = "", cex = 1.6, cex.axis = 1.45,
ylim = c(-0.3, 0.65))
## Add legend 1 (CMS)
legend('topright', legend = c("CMS1", "CMS2", "CMS3", "CMS4", "UNK"), title = list("CMS"),
col = c("#E18C28","#0B5F9C","#C46294","#129063","#A4A4A4"),pch = 19, title.adj = 0.55,
bty = "n", cex = 1.4, xpd = TRUE, inset = c(-0.25, -0.03), adj = c(0.1, 0.5), y.intersp = 0.9)
## Add titles
title(ylab = paste0("DDIR Scores"), line =2.8, cex.lab = 1.6)
title(xlab = paste0("Cytotoxic Lymphocytes MCP scores"), line = 2.8, cex.lab = 1.6)
## Add stats 1 (pearson)
mtext(paste0("Pearson r = ", round(pearson.1$estimate, digits = 4)),
side = 3, adj = 0.02, line = -1.4, cex = 1.4)
mtext(paste0(pvalue.3), side = 3,adj = 0.02, line = -2.6, cex = 1.4)
## Add DDIR threshold (CRC = 0.1094)
abline(h=0.1094, col = "red", lty = 2, lwd = 3)
## Add line of best fit
abline(lm(data.1[["DDIR_scores"]] ~ data.1[[variable.1]]), lwd = 2)
## Plot 2 (boxplot):
par(fig=c(0,1,0.65,1), new=TRUE) # adding another graph to the same plot
boxplot(data.1[[variable.1]] ~ data.1[["DDIR"]], horizontal=TRUE, axes=FALSE,
col = c("blue", "red"))
## Add legend 2 (DDIR)
legend("topright", legend = c("POS", "NEG"), title = list("DDIR"),
col = c("red", "blue"),pch = 15, title.adj = 0.78, y.intersp = 0.9,
bty = "n", cex = 1.4, xpd = TRUE,inset = c(-0.22, -1.2), adj = c(0.1,0.5))
## Add titles
title(main = paste0("Cytotoxic Lymphocytes MCP scores\n",
## select cohort.1 for FOCUS, and cohort.2 for FOxTROT
cohort.1,
#cohort.2,
" trial cohort"),
line = 1.4, cex.main = 1.8)
## Add stats 2 (t.test)
mtext(pvalue.1, side = 1, line = 0.5, cex = 1.4, adj = 0.02)
mtext(pvalue.2, side = 1, line = 1.7, cex = 1.4, adj = 0.02)
## dev off
dev.off()
###############################################################################################
###################################### Figure 4G ##########################################
### Figure 4G) Immunohistochemistry images for CD8 in DDIR subtypes - FOCUS --->>>
## Figure 4G was taken from QuPath (version 0.1.2)
# --- Sample ID --- DDIR --- High/Low --- TMA --- Co-ordinates (x,y)
# --- SC00332A --- NEG --- High --- TMA7 --- (3,4)
# --- SC00265A --- NEG --- Low --- TMA5 --- (9,2)
# --- SC00443A --- POS --- High --- TMA10 --- (3,4)
# --- SC00228A --- POS --- Low --- TMA4 --- (8,2)