-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPDL1_for_paper.Rmd
116 lines (83 loc) · 2.5 KB
/
PDL1_for_paper.Rmd
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
---
title: "J15221 Evanthia TNBC - Correlation PD-L1 with response"
author: "Ludmila Danilova & Joseph Tandurella"
date: "`r Sys.Date()`"
output:
html_document:
toc: yes
toc_float: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE,
warning = FALSE)
rm(list = ls())
library(dplyr)
library(ggplot2)
library(ggpubr)
library(ggrepel)
library(data.table)
library("DT")
library(pheatmap)
library(gridExtra)
library(scales)
source("functions.r")
```
Create figures for the clinical paper
All data is coming from tables for the paper
```{r fig.width = 10}
# set colors
recistCol = c("Non-responder" = "red","Responder" = "blue")
cbrCol = c("CR,PR,SD" = "blue","PD" = "red")
subtypeCol = c("HR+" = "red", "TNBC" = "blue")
timeCol = c("Baseline" = "black", "Time 1" = 'grey45', "Time 2" = 'grey75')
# set root folder
rootDir = "./"
# Load data patient data
dta_pts = read.csv(paste0(rootDir,"input_tables/table_24patient_info.csv"), row.names = 1)
dta_pts$ID = rownames(dta_pts)
# remove patients with no response
dta_pts = dta_pts %>% filter(Best_Resp != "Unknown")
#==========================
# file with TILs and PDL1 data
dat = read.csv(paste0(rootDir,"input_tables/table_per_sample_values.csv"))
#===========================
# add patient info
dat = cbind(dat, dta_pts[dat$patientID,])
# save data to submit with the paper
write.csv(dat, file = "Source_data_EDF4_EDF5.csv", row.names = F)
df_Baseline <- dat %>% filter(timePoint == 'Baseline')
```
## PD-L1 split by type
### Cancer cells
```{r fig.width = 10}
#================
# PD-L1
##RECIST (Responders vs. Nonresponders)
ggplot(CreateAllFacet(df_Baseline, "Subtype"), aes(x=RECIST, y=PDL1_tumor)) +
geom_boxplot() +
labs(title="% of PD-L1+ cancer cells. Baseline Samples") +
stat_compare_means() +
geom_point(aes(color=Subtype)) +
scale_y_log10()+
scale_color_manual(values = subtypeCol) +
geom_hline(yintercept=1, linetype="dashed", color = "grey") +
facet_wrap("facet")+
theme_bw()
```
### Immune cells
```{r fig.width = 10}
##RECIST (Responders vs. Nonresponders)
ggplot(CreateAllFacet(df_Baseline, "Subtype"), aes(x=RECIST, y=PDL1_immune)) +
geom_boxplot() +
labs(title="% of PD-L1+ immune cells. Baseline Samples") +
stat_compare_means() +
geom_point(aes(color=Subtype)) +
scale_y_log10()+
scale_color_manual(values = subtypeCol) +
geom_hline(yintercept=1, linetype="dashed", color = "grey") +
facet_wrap("facet")+
theme_bw()
```
```{r}
sessionInfo()
```