-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exclusion_flowcharts_markdown.rmd
190 lines (138 loc) · 7.14 KB
/
Exclusion_flowcharts_markdown.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
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
---
title: "Exclusion flowcharts"
output: github_document
always_allow_html: true
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
library(knitr)
knitr::opts_chunk$set(echo = TRUE) #defines default echo (display code)
knitr::opts_chunk$set(eval = TRUE) #defines default eval (display result of code)
knitr::opts_chunk$set(comment = "") # no space/character before results (e.g. in tables)
knitr::opts_chunk$set(tidy = T) # let r reformat your code to look tidy in the output
knitr::opts_chunk$set(collapse = F) # should code and results be shown in the same chunk (=T) or be split in several chunks in the document (=F)
```
The aim of this script is to make exclusion flowcharts for different clinical scenarios and outcomes. The number of patients in each group is copied from a secure server for sensitive data ("04_flowchart_eligibility.R", not available here). Start by loading the library.
```{r libraries}
library(PRISMAstatement)
library(manipulateWidget)
```
Next, make an exclusion flowchart for the **base clinical model with overall survival** as outcome:
```{r base clinical OS}
flow_exclusions(
incl_counts = c(1589, 1564, 1447),
total_label = "Total Screened",
incl_labels = c("Early disease or locoregionally advanced disease", "Outcome available"),
excl_labels = c("Distant metastasis / missing TNM stage", "Missing outcome"),
percent_of_total = TRUE
)
```
Similarly for the **base clinical model with disease-free survival** as outcome:
```{r base clinical dfs}
flow_exclusions(
incl_counts = c(1589, 1564, 1251),
total_label = "Total Screened",
incl_labels = c("Early disease or locoregionally advanced disease", "Outcome available"),
excl_labels = c("Distant metastasis / missing TNM stage", "Missing outcome"),
percent_of_total = TRUE
)
```
Next the flowchart for **GS1, GS2 and GS3 and overall survival**. These use the same subset of data, but GS3 has different variable encoding.
```{r GS1 GS2 GS3 OS}
flow_exclusions(
incl_counts = c(1589, 1230, 1206, 1097),
total_label = "Total Screened",
incl_labels = c("Gene expression available", "Early disease or locoregionally advanced disease", "Outcome available"),
excl_labels = c("Missing gene expression", "Distant metastasis / missing TNM stage", "Missing outcome"),
percent_of_total = TRUE
)
```
The flowchart for **GS1, GS2 and GS3 and disease-free survival** is very similar. Note that SCANDARE is also excluded at the outcome stage due to DFS information being very low quality (same for other flowcharts). These also use the same subset of data, but GS3 has different variable encoding.
```{r GS1 GS2 GS3 DFS}
flow_exclusions(
incl_counts = c(1589, 1230, 1206, 907),
total_label = "Total Screened",
incl_labels = c("Gene expression available", "Early disease or locoregionally advanced disease", "Outcome available"),
excl_labels = c("Missing gene expression", "Distant metastasis / missing TNM stage", "Missing outcome"),
percent_of_total = TRUE
)
```
Next the flowchart for **GS4 & GS5 and overall survival**. These use the same subset of data, but have different variable encoding for chemo agents. These are also only for Locoregionally advanced disease and require information about treatment (specifically chemotherapy agents if they had chemotherapy).
```{r GS4 GS5 OS}
flow_exclusions(
incl_counts = c(1589, 1230, 1012, 802, 750),
total_label = "Total Screened",
incl_labels = c("Gene expression available", "Locoregionally advanced disease", "Treatment information available", "Outcome available"),
excl_labels = c("Missing gene expression", "Early disease or distant metastasis", "Missing treatment information", "Missing outcome"),
percent_of_total = TRUE
)
```
Lastly, the flowchart for **GS4 & GS5 and disease-free survival**. These use the same subset of data, but have different variable encoding for chemo agents. Very similar to OS above.
```{r GS4 GS5 DFS}
flow_exclusions(
incl_counts = c(1589, 1230, 1012, 802, 700),
total_label = "Total Screened",
incl_labels = c("Gene expression available", "Locoregionally advanced disease", "Treatment information available", "Outcome available"),
excl_labels = c("Missing gene expression", "Early disease or distant metastasis", "Missing treatment information", "Missing outcome"),
percent_of_total = TRUE
)
```
Finally, combine two flow charts into one figure: **clinical base model OS & GS4&GS5 OS data**.
```{r clinical GS4 GS5 OS}
#clinical base:
clinical_flow <- flow_exclusions(
incl_counts = c(1589, 1564, 1447),
total_label = "Total Screened",
incl_labels = c("Early disease or \nlocoregionally advanced disease", "Outcome available"),
excl_labels = c("Distant metastasis \n or missing TNM stage", "Missing outcome"),
percent_of_total = TRUE
)
# GS4&GS5 OS:
GS4GS5_flow <- flow_exclusions(
incl_counts = c(1589, 1230, 1012, 802, 750),
total_label = "Total Screened",
incl_labels = c("Gene expression available", "Locoregionally advanced disease", "Treatment information available", "Outcome available"),
excl_labels = c("Missing gene expression", "Early disease \nor distant metastasis", "Missing treatment \ninformation", "Missing outcome"),
percent_of_total = TRUE
)
combineWidgets(clinical_flow, GS4GS5_flow, ncol=2, nrow=1)
# OBS: this failed on RMarkdown, but works fine in R itself... Can export the figure directly from R.
```
## June2024
Add two more flowcharts, starting from OS GS1. First **OS only RT**:
```{r OS only RT}
flow_exclusions(
incl_counts = c(1589, 1230, 1206, 1097, 752),
total_label = "Total Screened",
incl_labels = c("Gene expression available", "Early disease or locoregionally advanced disease", "Outcome available", "Received radiotherapy"),
excl_labels = c("Missing gene expression", "Distant metastasis / missing TNM stage", "Missing outcome", "Did not recieve radiotherapy or \nmissing information about radiotherapy"),
percent_of_total = TRUE
)
```
Second **OS only CT**:
```{r OS only CT}
flow_exclusions(
incl_counts = c(1589, 1230, 1206, 1097, 936, 445),
total_label = "Total Screened",
incl_labels = c("Gene expression available", "Early disease or locoregionally advanced disease", "Outcome available",
"Locoregionally advanced disease", "Received systemic treatment"),
excl_labels = c("Missing gene expression", "Distant metastasis / missing TNM stage", "Missing outcome", "Early disease",
"Did not recieve systemic treatment or \nmissing information about systemic treatment"),
percent_of_total = TRUE
)
```
Lastly, save as jpeg file with 300 dpi resolution:
```{r GS1 GS2 GS3 OS pdf, eval = F}
library(DiagrammeRsvg)
library(rsvg)
flow <- flow_exclusions(
incl_counts = c(1589, 1230, 1206, 1097),
total_label = "Total Screened",
incl_labels = c("Gene expression available", "Early disease or \nlocoregionally advanced disease", "Outcome available"),
excl_labels = c("Missing gene expression", "Distant metastasis \n / missing TNM stage", "Missing outcome"),
percent_of_total = TRUE,
font_size = 8
)
PRISMAstatement:::prisma_pdf(flow, "test_pdf.pdf")
```