-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
512 lines (512 loc) · 28.9 KB
/
.Rhistory
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
###########################################
## Get the feature data for annotation
FeatData_Cerebral1 <- fData(CerebralDataset1)
############################
## Annotation
## Expr_Cerebral1
head(rownames(Expr_Cerebral1))
rownames(Expr_Cerebral1) <- FeatData_Cerebral1$`Gene symbol`
summary(is.na(rownames(Expr_Cerebral1)))
#sel <- which(apply(Expr_Cerebral1, 1, function(x) all(is.finite(x)) ))
#Expr_Cerebral1 <- Expr_Cerebral1[sel, ]
Expr_Cerebral1 <- Expr_Cerebral1[!is.na(rownames(Expr_Cerebral1)),]
#sel <- which(apply(Expr_Cerebral1, 1, function(x) all(is.finite(x)) ))
#Expr_Cerebral1 <- Expr_Cerebral1[sel, ]
Expr_Cerebral1 <- Expr_Cerebral1[!is.na(rownames(Expr_Cerebral1)), ]
dim(Expr_Cerebral1)
range(Expr_Cerebral1)
rownames(Expr_Cerebral4) <- FeatData_Cerebral4$`Gene symbol`
summary(is.na(rownames(Expr_Cerebral4)))
sel <- which(apply(Expr_Cerebral4, 1, function(x) all(is.finite(x)) ))
Expr_Cerebral4 <- Expr_Cerebral4[sel, ]
Expr_Cerebral4 <- Expr_Cerebral4[!is.na(rownames(Expr_Cerebral4)),]
dim(Expr_Cerebral4)
range(Expr_Cerebral4)
Expr_Cerebral4 <- t(scale(t(Expr_Cerebral4), center = TRUE, scale = TRUE))
# Pheno1
table(Pheno_Cerebral1$status)
# Pheno1
table(Pheno_Cerebral1$`group:ch1`)
View(Pheno_Cerebral1)
Pheno_Cerebral1$DiseaseStatus <- as.factor(Pheno_Cerebral1$`group:ch1`)
levels(Pheno_Cerebral1$DiseaseStatus) <- c("control", "case", "case")
table(Pheno_Cerebral1$DiseaseStatus)
ClassTBMVsNormal <- Pheno_Cerebral1$DiseaseStatus
####################################
## Load the model
load("./Objs/RF_Comp.rda")
###################################
# Pheno2
table(Pheno_Cerebral2$`disease state:ch1`)
Pheno_Cerebral2$DiseaseStatus <- as.factor(Pheno_Cerebral2$`disease state:ch1`)
levels(Pheno_Cerebral2$DiseaseStatus) <- c("control", "case", "case")
table(Pheno_Cerebral2$DiseaseStatus)
ClassMeningitisVsNormal <- Pheno_Cerebral2$DiseaseStatus
###################################
# Pheno4
table(Pheno_Cerebral4$`sample group:ch1`)
Pheno_Cerebral4$DiseaseStatus <- as.factor(Pheno_Cerebral4$`sample group:ch1`)
levels(Pheno_Cerebral4$DiseaseStatus) <- c("case", "control")
Pheno_Cerebral4$DiseaseStatus <- factor(Pheno_Cerebral4$DiseaseStatus, levels = c('control', 'case'))
table(Pheno_Cerebral4$DiseaseStatus)
ClassMeningitisVsNormal <- Pheno_Cerebral4$DiseaseStatus
ClassMeningitisVsNormal <- Pheno_Cerebral2$DiseaseStatus
ClassMeningitisVsNormal4 <- Pheno_Cerebral4$DiseaseStatus
####################################
## Load the model
load("./Objs/RF_Comp.rda")
TestingData_Cerebral1 <- t(Expr_Cerebral1)
rm(list = ls())
MeningitisDataset1 <- getGEO("GSE83892", GSEMatrix = T, AnnotGPL = T)
MeningitisDataset1 <- MeningitisDataset1$GSE83892_series_matrix.txt.gz
MeningitisDataset2 <- getGEO("GSE80496", GSEMatrix = T, AnnotGPL = T)
MeningitisDataset2 <- MeningitisDataset2$GSE80496_series_matrix.txt.gz
MeningitisDataset3 <- getGEO("GSE72829", GSEMatrix = T, AnnotGPL = T)
Sys.setenv("VROOM_CONNECTION_SIZE" = 231072)
MeningitisDataset3 <- getGEO("GSE72829", GSEMatrix = T, AnnotGPL = T)
Sys.setenv("VROOM_CONNECTION_SIZE" = 531072)
MeningitisDataset3 <- getGEO("GSE72829", GSEMatrix = T, AnnotGPL = T)
MeningitisDataset3_1 <- MeningitisDataset3$`GSE72829-GPL10558_series_matrix.txt.gz`
MeningitisDataset3_2 <- MeningitisDataset3$`GSE72829-GPL6883_series_matrix.txt.gz`
MeningitisDataset3_3 <- MeningitisDataset3$`GSE72829-GPL6947_series_matrix.txt.gz`
MeningitisDataset4 <- getGEO("GSE40586", GSEMatrix = T, AnnotGPL = T)
MeningitisDataset4 <- MeningitisDataset4$GSE40586_series_matrix.txt.gz
save(MeningitisDataset1, MeningitisDataset2, MeningitisDataset3_1, MeningitisDataset3_2, MeningitisDataset3_3, MeningitisDataset4, file = "./Data/MeningitisDatasets.rda")
############################################
## Get the expression matrices
Expr_Meningitis1 <- exprs(MeningitisDataset1)
Expr_Meningitis2 <- exprs(MeningitisDataset2)
Expr_Meningitis3_1 <- exprs(MeningitisDataset3_1)
Expr_Meningitis3_2 <- exprs(MeningitisDataset3_2)
Expr_Meningitis3_3 <- exprs(MeningitisDataset3_3)
Expr_Meningitis4 <- exprs(MeningitisDataset4)
############################################
## Get the phenotype
Pheno_Meningitis1 <- pData(MeningitisDataset1)
Pheno_Meningitis2 <- pData(MeningitisDataset2)
Pheno_Meningitis4 <- pData(MeningitisDataset4)
Pheno_Meningitis3_1 <- pData(MeningitisDataset3_1)
Pheno_Meningitis3_2 <- pData(MeningitisDataset3_2)
Pheno_Meningitis3_3 <- pData(MeningitisDataset3_3)
###########################################
## Get the feature data for annotation
FeatData_Meningitis1 <- fData(MeningitisDataset1)
FeatData_Meningitis2 <- fData(MeningitisDataset2)
FeatData_Meningitis4 <- fData(MeningitisDataset4)
FeatData_Meningitis3_1 <- fData(MeningitisDataset3_1)
FeatData_Meningitis3_2 <- fData(MeningitisDataset3_2)
FeatData_Meningitis3_3 <- fData(MeningitisDataset3_3)
head(rownames(Expr_Meningitis1))
rownames(Expr_Meningitis1) <- FeatData_Meningitis1$`Gene symbol`
summary(is.na(rownames(Expr_Meningitis1)))
#sel <- which(apply(Expr_Meningitis1, 1, function(x) all(is.finite(x)) ))
#Expr_Meningitis1 <- Expr_Meningitis1[sel, ]
Expr_Meningitis1 <- Expr_Meningitis1[!is.na(rownames(Expr_Meningitis1)), ]
dim(Expr_Meningitis1)
range(Expr_Meningitis1)
Expr_Meningitis1 <- t(scale(t(Expr_Meningitis1), center = TRUE, scale = TRUE))
head(rownames(Expr_Meningitis2))
rownames(Expr_Meningitis2) <- FeatData_Meningitis2$`Gene symbol`
summary(is.na(rownames(Expr_Meningitis2)))
sel <- which(apply(Expr_Meningitis2, 1, function(x) all(is.finite(x)) ))
Expr_Meningitis2 <- Expr_Meningitis2[sel, ]
Expr_Meningitis2 <- Expr_Meningitis2[!is.na(rownames(Expr_Meningitis2)),]
dim(Expr_Meningitis2)
range(Expr_Meningitis2)
Expr_Meningitis2 <- t(scale(t(Expr_Meningitis2), center = TRUE, scale = TRUE))
##############################################
## Expr_Meningitis3_1
head(rownames(Expr_Meningitis3_1))
rownames(Expr_Meningitis3_1) <- FeatData_Meningitis3_1$`Gene symbol`
##############################################
## Expr_Meningitis3_1
head(rownames(Expr_Meningitis3_1))
summary(is.na(rownames(Expr_Meningitis3_1)))
sel <- which(apply(Expr_Meningitis3_1, 1, function(x) all(is.finite(x)) ))
Expr_Meningitis3_1 <- Expr_Meningitis3_1[sel, ]
Expr_Meningitis3_1 <- Expr_Meningitis3_1[!is.na(rownames(Expr_Meningitis3_1)),]
dim(Expr_Meningitis3_1)
range(Expr_Meningitis3_1)
Expr_Meningitis3_1 <- log2(Expr_Meningitis3_1+55)
range(Expr_Meningitis3_1)
Expr_Meningitis3_1 <- t(scale(t(Expr_Meningitis3_1), center = TRUE, scale = TRUE))
## Expr_Meningitis3_2
head(rownames(Expr_Meningitis3_2))
rownames(Expr_Meningitis3_2) <- FeatData_Meningitis3_2$`Gene symbol`
summary(is.na(rownames(Expr_Meningitis3_2)))
sel <- which(apply(Expr_Meningitis3_2, 1, function(x) all(is.finite(x)) ))
Expr_Meningitis3_2 <- Expr_Meningitis3_2[sel, ]
Expr_Meningitis3_2 <- Expr_Meningitis3_2[!is.na(rownames(Expr_Meningitis3_2)),]
dim(Expr_Meningitis3_2)
range(Expr_Meningitis3_2)
Expr_Meningitis3_2 <- t(scale(t(Expr_Meningitis3_2), center = TRUE, scale = TRUE))
rownames(Expr_Meningitis3_3) <- FeatData_Meningitis3_3$`Gene symbol`
summary(is.na(rownames(Expr_Meningitis3_3)))
sel <- which(apply(Expr_Meningitis3_3, 1, function(x) all(is.finite(x)) ))
Expr_Meningitis3_3 <- Expr_Meningitis3_3[sel, ]
Expr_Meningitis3_3 <- Expr_Meningitis3_3[!is.na(rownames(Expr_Meningitis3_3)),]
dim(Expr_Meningitis3_3)
range(Expr_Meningitis3_3)
Expr_Meningitis3_3 <- t(scale(t(Expr_Meningitis3_3), center = TRUE, scale = TRUE))
head(rownames(Expr_Meningitis4))
rownames(Expr_Meningitis4) <- FeatData_Meningitis4$`Gene symbol`
summary(is.na(rownames(Expr_Meningitis4)))
sel <- which(apply(Expr_Meningitis4, 1, function(x) all(is.finite(x)) ))
Expr_Meningitis4 <- Expr_Meningitis4[sel, ]
Expr_Meningitis4 <- Expr_Meningitis4[!is.na(rownames(Expr_Meningitis4)),]
dim(Expr_Meningitis4)
range(Expr_Meningitis4)
Expr_Meningitis4 <- t(scale(t(Expr_Meningitis4), center = TRUE, scale = TRUE))
table(Pheno_Meningitis1$`group:ch1`)
Pheno_Meningitis1$DiseaseStatus <- as.factor(Pheno_Meningitis1$`group:ch1`)
levels(Pheno_Meningitis1$DiseaseStatus) <- c("control", "case", "case")
table(Pheno_Meningitis1$DiseaseStatus)
#expr1 <- expr1[, colnames(expr1) %in% rownames(Pheno_Dengue1)]
#all(rownames(Pheno_Dengue1) == colnames(expr1))
ClassTBMVsNormal <- Pheno_Meningitis1$DiseaseStatus
table(Pheno_Meningitis2$`disease state:ch1`)
Pheno_Meningitis2$DiseaseStatus <- as.factor(Pheno_Meningitis2$`disease state:ch1`)
levels(Pheno_Meningitis2$DiseaseStatus) <- c("control", "case", "case")
table(Pheno_Meningitis2$DiseaseStatus)
ClassMeningitisVsNormal <- Pheno_Meningitis2$DiseaseStatus
###################################
# Pheno3_1
table(Pheno_Meningitis3_1$`category:ch1`)
###################################
# Pheno3_1
table(Pheno_Meningitis3_1$`dataset:ch1`)
###################################
# Pheno3_1
table(Pheno_Meningitis3_1$`tissue:ch1`)
###################################
# Pheno4
table(Pheno_Meningitis4$`sample group:ch1`)
Pheno_Meningitis4$DiseaseStatus <- as.factor(Pheno_Meningitis4$`sample group:ch1`)
levels(Pheno_Meningitis4$DiseaseStatus) <- c("case", "control")
Pheno_Meningitis4$DiseaseStatus <- factor(Pheno_Meningitis4$DiseaseStatus, levels = c('control', 'case'))
table(Pheno_Meningitis4$DiseaseStatus)
ClassMeningitisVsNormal4 <- Pheno_Meningitis4$DiseaseStatus
####################################
## Load the severe malaria signature
load("./Objs/RF_Comp.rda")
## Load the cerebral malaria signature
load("./Objs/RF_Cerebral.rda")
TestingData_Cerebral1 <- t(Expr_Cerebral1)
TestingData_Cerebral1 <- t(Expr_Meningitis1)
TestingData_Meningitis1 <- t(Expr_Meningitis1)
PredVotes_Meningitis1_severe <- predict(RF_Comp, newdata = TestingData_Meningitis1, type = "vote")
sel <- intersect(rownames(Expr_Meningitis1), rownames(RF_Comp$importance))
sel_severe <- intersect(rownames(Expr_Meningitis1), rownames(RF_Comp$importance))
sel_cerebral <- intersect(rownames(Expr_Meningitis1), rownames(RF_Cerebral$importance))
sel_severe
sel_cerebral
sel_severe
PredVotes_Meningitis1_severe <- predict(RF_Comp, newdata = TestingData_Meningitis1, type = "vote")
rownames(RF_Comp$importance)
sel_severe <- intersect(rownames(RF_Comp$importance) %in% rownames(Expr_Meningitis1))
sel_severe <- rownames(RF_Comp$importance) %in% rownames(Expr_Meningitis1))
sel_severe <- rownames(RF_Comp$importance) %in% rownames(Expr_Meningitis1)
sel_severe
PredVotes_Meningitis1_severe <- predict(RF_Comp, newdata = TestingData_Meningitis1, type = "vote")
PredVotes_Meningitis1_cerebral <- predict(RF_Cerebral, newdata = TestingData_Meningitis1, type = "vote")
#################
## Predict in the 2md cerebral dataset meningitis vs normal) using the two malaria signature
TestingData_Meningitis2 <- t(Expr_Meningitis2)
PredVotes_Meningitis2_severe <- predict(RF_Comp, newdata = TestingData_Meningitis2, type = "vote")
#################
## Predict in the 2nd cerebral dataset meningitis vs normal) using the two malaria signature
sel_severe <- intersect(rownames(RF_Comp$importance), rownames(Expr_Meningitis2))
PredVotes_Meningitis2_cerebral <- predict(RF_Cerebral, newdata = TestingData_Meningitis2, type = "vote")
sel_cerebral <- intersect(rownames(RF_Cerebral$importance), rownames(Expr_Meningitis2))
RF_Comp$importance
# Subset
RF_Comp$importance <- RF_Comp$importance[sel_severe, ]
RF_Comp$importanceSD
RF_Comp$importanceSD
RF_Comp$importanceSD <- RF_Comp$importanceSD[sel_severe, ]
RF_Comp$forest$ncat <- RF_Comp$forest$ncat[sel_severe]
RF_Comp$forest$ncat
# Subset the cerebral signature
RF_Cerebral$importance <- RF_Cerebral$importance[sel_cerebral, ]
RF_Cerebral$importanceSD <- RF_Cerebral$importanceSD[sel_cerebral, ]
RF_Cerebral$importanceSD <- RF_Cerebral$importanceSD[sel_cerebral, ]
PredVotes_Meningitis2_severe <- predict(RF_Comp, newdata = TestingData_Meningitis2, type = "vote")
PredVotes_Meningitis2_cerebral <- predict(RF_Cerebral, newdata = TestingData_Meningitis2, type = "vote")
ROC_meningitis1_severe <- roc(ClassTBMVsNormal, PredVotes_Meningitis2_severe[,2], plot = F, print.auc = TRUE, levels = c("control", "case"), direction = "<", col = "blue", lwd = 2, grid = TRUE, auc = TRUE, ci = TRUE)
ClassTBMVsNormal
PredVotes_Meningitis2_severe
ROC_meningitis2_severe <- roc(ClassMeningitisVsNormal, PredVotes_Meningitis2_severe[,2], plot = F, print.auc = TRUE, levels = c("control", "case"), direction = "<", col = "blue", lwd = 2, grid = TRUE, auc = TRUE, ci = TRUE)
ROC_meningitis2_severe <- roc(ClassMeningitisVsNormal2, PredVotes_Meningitis2_severe[,2], plot = F, print.auc = TRUE, levels = c("control", "case"), direction = "<", col = "blue", lwd = 2, grid = TRUE, auc = TRUE, ci = TRUE)
ROC_meningitis2_severe <- roc(ClassMeningitisVsNormal, PredVotes_Meningitis2_severe[,2], plot = F, print.auc = TRUE, levels = c("control", "case"), direction = "<", col = "blue", lwd = 2, grid = TRUE, auc = TRUE, ci = TRUE)
ROC_meningitis2_severe
ROC_meningitis2_cerebral <- roc(ClassMeningitisVsNormal, PredVotes_Meningitis2_cerebral[,2], plot = F, print.auc = TRUE, levels = c("control", "case"), direction = "<", col = "blue", lwd = 2, grid = TRUE, auc = TRUE, ci = TRUE)
ROC_meningitis2_cerebral
ROC_meningitis2_severe <- roc(ClassMeningitisVsNormal, PredVotes_Meningitis2_severe[,2], plot = F, print.auc = TRUE, levels = c("control", "case"), direction = "<", col = "blue", lwd = 2, grid = TRUE, auc = TRUE, ci = TRUE)
ROC_meningitis2_severe
PredVotes_Meningitis2_cerebral
# For ROC and PRC curves
sscurves_Meningitis2_severe <- evalmod(scores = PredVotes_Meningitis2_severe[,2], labels = ClassMeningitisVsNormal)
sscurves_Meningitis2_severe
ROC_Meningitis2_severe <- autoplot(sscurves_Meningitis2_severe, curvetype = c("ROC")) + labs(title = "ROC curve of the severe malaria signature in GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.53"), size = 3)
####################################
#################
## Predict in the 4th cerebral dataset meningitis vs normal) using the two malaria signature
sel_severe <- intersect(rownames(RF_Comp$importance), rownames(Expr_Meningitis4))
rownames(Expr_Meningitis4
####################################
#################
## Load the severe malaria signature
load("./Objs/RF_Comp.rda")
## Load the cerebral malaria signature
load("./Objs/RF_Cerebral.rda")
## Predict in the 4th cerebral dataset meningitis vs normal) using the two malaria signature
sel_severe <- intersect(rownames(RF_Comp$importance), rownames(Expr_Meningitis4))
sel_cerebral <- intersect(rownames(RF_Cerebral$importance), rownames(Expr_Meningitis4))
# transpose the expression matrix
TestingData_Meningitis4 <- t(Expr_Meningitis4)
PredVotes_Meningitis4_severe <- predict(RF_Comp, newdata = TestingData_Meningitis4, type = "vote")
PredVotes_Meningitis4_cerebral <- predict(RF_Cerebral, newdata = TestingData_Meningitis4, type = "vote")
ROC_meningitis4_severe <- roc(ClassMeningitisVsNormal4, PredVotes_Meningitis4_severe[,2], plot = F, print.auc = TRUE, levels = c("control", "case"), direction = "<", col = "blue", lwd = 2, grid = TRUE, auc = TRUE, ci = TRUE)
ROC_meningitis4_severe
ROC_meningitis4_cerebral <- roc(ClassMeningitisVsNormal4, PredVotes_Meningitis4_cerebral[,2], plot = F, print.auc = TRUE, levels = c("control", "case"), direction = "<", col = "blue", lwd = 2, grid = TRUE, auc = TRUE, ci = TRUE)
ROC_meningitis4_cerebral
levels(ClassMeningitisVsNormal4)
# cerebral signauture:
sscurves_Meningitis2_cerebral <- evalmod(scores = PredVotes_Meningitis2_cerebral[,2], labels = ClassMeningitisVsNormal)
sscurves_Meningitis2_cerebral
ROC_meningitis2_cerebral <- autoplot(sscurves_Meningitis2_cerebral, curvetype = c("ROC")) + labs(title = "ROC curve of the cerebral malaria signature in GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.53"), size = 3)
sscurves_Meningitis4_severe
# For ROC and PRC curves
sscurves_Meningitis4_severe <- evalmod(scores = PredVotes_Meningitis2_severe[,2], labels = ClassMeningitisVsNormal)
sscurves_Meningitis4_severe
ROC_meningitis4_cerebral <- roc(ClassMeningitisVsNormal4, PredVotes_Meningitis4_cerebral[,2], plot = F, print.auc = TRUE, levels = c("control", "case"), direction = "<", col = "blue", lwd = 2, grid = TRUE, auc = TRUE, ci = TRUE)
ROC_meningitis4_cerebral
# cerebral signature:
sscurves_Meningitis4_cerebral <- evalmod(scores = PredVotes_Meningitis2_cerebral[,2], labels = ClassMeningitisVsNormal)
# For ROC and PRC curves
# severe signature:
sscurves_Meningitis4_severe <- evalmod(scores = PredVotes_Meningitis2_severe[,2], labels = ClassMeningitisVsNormal4)
# For ROC and PRC curves
# severe signature:
sscurves_Meningitis4_severe <- evalmod(scores = PredVotes_Meningitis4_severe[,2], labels = ClassMeningitisVsNormal4)
sscurves_Meningitis4_severe
ROC_Meningitis4_severe <- autoplot(sscurves_Meningitis2_severe, curvetype = c("ROC")) + labs(title = "ROC curve of the severe malaria signature in GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.53"), size = 3)
sscurves_Meningitis2_cerebral <- evalmod(scores = PredVotes_Meningitis2_cerebral[,2], labels = ClassMeningitisVsNormal)
sscurves_Meningitis2_cerebral
ROC_meningitis2_cerebral <- autoplot(sscurves_Meningitis2_cerebral, curvetype = c("ROC")) + labs(title = "ROC curve of the cerebral malaria signature in GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.53"), size = 3)
sscurves_Meningitis2_severe <- evalmod(scores = PredVotes_Meningitis2_severe[,2], labels = ClassMeningitisVsNormal)
sscurves_Meningitis2_severe
ROC_Meningitis2_severe <- autoplot(sscurves_Meningitis2_severe, curvetype = c("ROC")) + labs(title = "ROC curve of the severe malaria signature in GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.53"), size = 3)
sscurves_Meningitis4_severe
ROC_Meningitis4_severe <- autoplot(sscurves_Meningitis4_severe, curvetype = c("ROC")) + labs(title = "ROC curve of the severe malaria signature in GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.53"), size = 3)
ROC_Meningitis4_severe <- autoplot(sscurves_Meningitis4_severe, curvetype = c("ROC")) + labs(title = "ROC curve of the severe malaria signature in GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.75"), size = 3)
# cerebral signature:
sscurves_Meningitis4_cerebral <- evalmod(scores = PredVotes_Meningitis4_cerebral[,2], labels = ClassMeningitisVsNormal4)
sscurves_Meningitis4_cerebral
ROC_Meningitis4_severe <- autoplot(sscurves_Meningitis4_severe, curvetype = c("ROC")) + labs(title = "ROC curve of the severe malaria signature in GSE40586 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.75"), size = 3)
ROC_Meningitis4_severe <- autoplot(sscurves_Meningitis4_severe, curvetype = c("ROC")) + labs(title = "ROC curve of the severe malaria signature in GSE40586 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.75"), size = 3)
# cerebral signature:
sscurves_Meningitis4_cerebral <- evalmod(scores = PredVotes_Meningitis4_cerebral[,2], labels = ClassMeningitisVsNormal4)
sscurves_Meningitis4_cerebral
ROC_Meningitis4_cerebral <- autoplot(sscurves_Meningitis4_severe, curvetype = c("ROC")) + labs(title = "ROC curve of the cerebral malaria signature in GSE40586 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.30"), size = 3)
pwd
getwd()
((ROC_meningitis2_severe / ROC_meningitis4_severe & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
library(patchwork)
((ROC_meningitis2_severe / ROC_meningitis4_severe & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
library(patchwork)
ROC_meningitis2_severe
ROC_meningitis4_severe
ROC_Meningitis4_cerebral <- autoplot(sscurves_Meningitis4_severe, curvetype = c("ROC")) + labs(title = "ROC curve of the cerebral malaria signature in GSE40586 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.30"), size = 3)
ROC_Meningitis4_cerebral
((ROC_Meningitis2_cerebral / ROC_Meningitis4_cerebral & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
ROC_Meningitis2_cerebral <- autoplot(sscurves_Meningitis2_cerebral, curvetype = c("ROC")) + labs(title = "ROC curve of the cerebral malaria signature in GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.53"), size = 3)
ROC_Meningitis2_cerebral
sscurves_Meningitis2_cerebral
ROC_Meningitis2_cerebral <- autoplot(sscurves_Meningitis2_cerebral, curvetype = c("ROC")) + labs(title = "ROC curve of the cerebral malaria signature in GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.07"), size = 3)
((ROC_Meningitis2_cerebral / ROC_Meningitis4_cerebral & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
((ROC_Meningitis2_cerebral | ROC_Meningitis4_cerebral & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
ROC_Meningitis2_cerebral <- autoplot(sscurves_Meningitis2_cerebral, curvetype = c("ROC")) + labs(title = "GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.07"), size = 3)
ROC_Meningitis4_cerebral <- autoplot(sscurves_Meningitis4_severe, curvetype = c("ROC")) + labs(title = "GSE40586 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.30"), size = 3)
((ROC_Meningitis2_cerebral | ROC_Meningitis4_cerebral & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
ROC_Meningitis4_cerebral <- autoplot(sscurves_Meningitis4_severe, curvetype = c("ROC")) + labs(title = "GSE40586 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.30"), size = 3)
sscurves_Meningitis4_cerebral
# For ROC and PRC curves
# Severe signauture:
sscurves_Meningitis2_severe <- evalmod(scores = PredVotes_Meningitis2_severe[,2], labels = ClassMeningitisVsNormal)
sscurves_Meningitis2_severe
# cerebral signauture:
sscurves_Meningitis2_cerebral <- evalmod(scores = PredVotes_Meningitis2_cerebral[,2], labels = ClassMeningitisVsNormal)
sscurves_Meningitis2_cerebral
# For ROC and PRC curves
# severe signature:
sscurves_Meningitis4_severe <- evalmod(scores = PredVotes_Meningitis4_severe[,2], labels = ClassMeningitisVsNormal4)
sscurves_Meningitis4_severe
# cerebral signature:
sscurves_Meningitis4_cerebral <- evalmod(scores = PredVotes_Meningitis4_cerebral[,2], labels = ClassMeningitisVsNormal4)
sscurves_Meningitis4_cerebral
((ROC_Meningitis2_severe | ROC_Meningitis4_severe & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
##############################################
tiff(filename = "./Figs/SevereMalariaSigPerformance_Meningitis.tiff", width = 2500, height = 2000, res = 350)
((ROC_Meningitis2_severe | ROC_Meningitis4_severe & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
dev.off()
((ROC_Meningitis2_cerebral | ROC_Meningitis4_cerebral & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the cerebral malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
sscurves_Meningitis4_cerebral
sscurves_Meningitis4_cerebral
sscurves_Meningitis4_severe
ROC_Meningitis4_cerebral
sscurves_Meningitis4_cerebral
sscurves_Meningitis4_cerebral
ROC_Meningitis4_cerebral
ROC_Meningitis4_cerebral
sscurves_Meningitis4_severe
((ROC_Meningitis2_severe | ROC_Meningitis4_severe & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
sscurves_Meningitis4_severe
ROC_Meningitis4_cerebral <- autoplot(sscurves_Meningitis4_cerebral, curvetype = c("ROC")) + labs(title = "GSE40586 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.30"), size = 3)
((ROC_Meningitis2_cerebral | ROC_Meningitis4_cerebral & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the cerebral malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
sscurves_Meningitis4_cerebral
sscurves_Meningitis2_cerebral
tiff(filename = "./Figs/CerebralMalariaSigPerformance_Meningitis.tiff", width = 2500, height = 2000, res = 350)
((ROC_Meningitis2_cerebral | ROC_Meningitis4_cerebral & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the cerebral malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
dev.off()
tiff(filename = "./Figs/SevereMalariaSigPerformance_Meningitis.tiff", width = 2500, height = 2000, res = 350)
((ROC_Meningitis2_severe | ROC_Meningitis4_severe & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
dev.off()
((ROC_Meningitis2_severe | ROC_Meningitis4_severe & theme(plot.tag = element_text(size = 8)))
) +
#plot_layout(widths = c(0.4, 1)) +
plot_annotation(
title = 'The performance of the severe malaria signatures in meningitis datasets',
tag_levels = c('A', '1'),
theme = theme(plot.title = element_text(size = 12, face = "bold"))
)
###################################################
## Test on non-cerebral samples
ROC_Menigitis2_cerebral
###################################################
## Test on non-cerebral samples
ROC_Meningitis2_cerebral
###################################################
## Test on non-cerebral samples
ROC_Meningitis2_cerebral <- roc(PredVotes_Meningitis2_cerebral, ClassMeningitisVsNormal)
###################################################
## Test on non-cerebral samples
ROC_Meningitis2_cerebral <- roc(ClassMeningitisVsNormal, PredVotes_Meningitis2_cerebral[,2])
ROC_Meningitis2_cerebral
###################################################
## Test on non-cerebral samples
ROC_Meningitis2_cerebral <- roc(ClassMeningitisVsNormal, PredVotes_Meningitis2_cerebral[,2], direction = "<")
ROC_Meningitis2_cerebral
###################################################
## Test on non-cerebral samples
ROC_Meningitis2_cerebral <- roc(ClassMeningitisVsNormal, PredVotes_Meningitis2_cerebral[,2], levels = c('control', 'case'), direction = "<")
ROC_Meningitis2_cerebral
ROC_Meningitis4_cerebral <- roc(ClassMeningitisVsNormal4, PredVotes_Meningitis4_cerebral[,2], levels = c('control', 'case'), direction = "<")
ROC_Meningitis4_cerebral
library(caret)
library(caret)
require(caret)
library(ModelMetrics)
ROC_meningitis2_cerebral
ROC_Meningitis2_cerebral$auc
ROC_Meningitis2_cerebral
ROC_meningitis2_cerebral
sscurves_Meningitis2_cerebral
sscurves_Meningitis2_severe
sscurves_Meningitis2_severe
ROC_Meningitis2_severe
ROC_Meningitis2_cerebral
ROC_Meningitis2_cerebral
ROC_Meningitis2_cerebral <- autoplot(sscurves_Meningitis2_cerebral, curvetype = c("ROC")) + labs(title = "GSE80496 (Meningococal disease vs healthy controls)") + annotate("text", x = .65, y = .25, label = paste("AUC = 0.07"), size = 3)
ROC_Meningitis2_cerebral