-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSupplementary-Figure_2.R
312 lines (265 loc) · 13.8 KB
/
Supplementary-Figure_2.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
### Comparison between recall achieved by SKiM and KinderMiner on experts
### curated disease-drug associations at cut-off date March 2019.
### load library
library(plotly)
library(ggpubr)
### Type 2 diabetes
dat1 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.7253, 0.8242))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p1 <- ggplot(data=dat1, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p1 <- p1 + labs(title = "T2D (n=91)") + theme(legend.position = "none")
### Type 1 diabetes
dat2 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.75, 1.0000))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p2 <- ggplot(data=dat2, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p2 <- p2 + labs(title = "T1D (n=21)") + theme(legend.position = "none")
### Atrial fibrillation
dat3 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.7714, 0.9286))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p3 <- ggplot(data=dat3, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p3 <- p3 + labs(title = "Atrial fibrillation (n=70)") +
theme(legend.position = "none")
### Bipolar disorder
dat4 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.1807, 0.9759))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p4 <- ggplot(data=dat4, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p4 <- p4 + labs(title = "Bipolar disorder (n=83)") +
theme(legend.position = "none")
### Hypercholesterolemia
dat5 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.6176, 0.9559))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p5 <- ggplot(data=dat5, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p5 <- p5 + labs(title = "Hypercholesterolemia (n=68)") +
theme(legend.position = "none")
### Coronary heart disease
dat6 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.0, 0.9130))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p6 <- ggplot(data=dat6, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p6 <- p6 + labs(title = "CHD (n=50)") + theme(legend.position = "none")
### Graves’ disease
dat7 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.8889, 1.00))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p7 <- ggplot(data=dat7, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p7 <- p7 + labs(title = "Grave’s disease (n=9)") +
theme(legend.position = "none")
### Myocardial infarction
dat8 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.6287, 0.8503))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p8 <- ggplot(data=dat8, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p8 <- p8 + labs(title = "Myocardial infarction (n=167)") +
theme(legend.position = "none")
### Parkinson’s disease
dat9 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.7260, 0.9589))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p9 <- ggplot(data=dat9, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p9 <- p9 + labs(title = "Parkinson’s disease (n=71)") +
theme(legend.position = "none")
### Psoriasis
dat10 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.7158, 0.9158))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p10 <- ggplot(data=dat10, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p10 <- p10 + labs(title = "Psoriasis (n=95)") +
theme(legend.position = "none")
### Congestive heart failure
dat11 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.63, 0.65))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p11 <- ggplot(data=dat11, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p11 <- p11 + labs(title = "CHF (n=100)") + theme(legend.position = "none")
### COPD
dat12 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.6721, 0.9672))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p12 <- ggplot(data=dat12, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p12 <- p12 + labs(title = "COPD (n=61)") + theme(legend.position = "none")
### Emphysema
dat13 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.3704, 1.0))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p13 <- ggplot(data=dat13, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p13 <- p13 + labs(title = "Emphysema (n=27)") + theme(legend.position = "none")
### Asthma
dat14 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.6634, 0.8911))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p14 <- ggplot(data=dat14, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p14 <- p14 + labs(title = "Asthma (n=101)") + theme(legend.position = "none")
### Stroke
dat15 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.7125, 0.9375))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p15 <- ggplot(data=dat15, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p15 <- p15 + labs(title = "Stroke (n=80)") + theme(legend.position = "none")
### Influenza
dat16 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.5556, 0.8889))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p16 <- ggplot(data=dat16, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p16 <- p16 + labs(title = "Influenza (n=18)") + theme(legend.position = "none")
### Pneumonia
dat17 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.7158, 0.8737))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p17 <- ggplot(data=dat17, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p17 <- p17 + labs(title = "Pneumonia (n=95)") + theme(legend.position = "none")
### Chronic kidney disease
dat18 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.4770, 0.6552))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p18 <- ggplot(data=dat18, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p18 <- p18 + labs(title = "CKD (n=174)") + theme(legend.position = "none")
### Kidney failure
dat19 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.5566, 0.6981))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p19 <- ggplot(data=dat19, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p19 <- p19 + labs(title = "Kidney failure (n=106)") +
theme(legend.position = "none")
### Suicide
dat20 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.0000, 1.0000))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p20 <- ggplot(data=dat20, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p20 <- p20 + labs(title = "Suicide (n=2)") + theme(legend.position = "none")
### Lower respiratory infections
dat21 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.0000, 0.9677))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p21 <- ggplot(data=dat21, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p21 <- p21 + labs(title = "LRI (n=31)") + theme(legend.position = "none")
### Tuberculosis
dat22 <- data.frame(tool = factor(c("KinderMiner","SKiM")),
Recall = c(0.7097, 0.9355))
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p22 <- ggplot(data=dat22, aes(x=tool, y=Recall, fill=tool)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("cyan3", "darkcyan")) +
ylim(0.0,1.0) +
theme(plot.title = element_text(size=10, face="bold"),
axis.text.x=element_blank(), axis.ticks.x=element_blank())
p22 <- p22 + labs(title = "Tuberculosis (n=31)") +
theme(legend.position = "none")
### To combine the bar chats into single figure
theme_set(theme_pubr())
figure <- ggarrange(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11,
p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22,
ncol = 8, nrow = 3, common.legend = TRUE, legend = "bottom")
figure <- ggarrange(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11,
p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22,
ncol = 5, nrow = 5, common.legend = TRUE, legend = "bottom")
figure