-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFigure_3.R
176 lines (143 loc) · 5.83 KB
/
Figure_3.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
### Recall
### upload library
library(plotly)
### Raynaud’s disease
dat1 <- data.frame(
tool = factor(c("KinderMiner","KinderMiner","SKiM","SKiM")),
cut_off_date = factor(c("1985","2019","1985","2019"),
levels=c("1985","2019")),
Recall = c(0.3333, 0.5, 0.8333, 1.00)
)
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p1 <- ggplot(data=dat1, aes(x= cut_off_date, 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)
p1 <- p1 + labs(title = "RD (n=18)")
### Migraine
dat2 <- data.frame(
tool = factor(c("KinderMiner","KinderMiner","SKiM","SKiM")),
cut_off_date = factor(c("1987","2019","1987","2019"),
levels=c("1987","2019")),
Recall = c(0.2022, 0.6629, 0.7528, 0.9775)
)
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p2 <- ggplot(data=dat2, aes(x= cut_off_date, 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)
p2 <- p2 + labs(title = "Migraine (n=89)")
### Alzheimer’s disease
dat3 <- data.frame(
tool = factor(c("KinderMiner","KinderMiner","SKiM","SKiM")),
cut_off_date = factor(c("1995","2019","1995","2019"),
levels=c("1995","2019")),
Recall = c(0.2787, 0.6230, 0.7049, 0.9180)
)
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p3 <- ggplot(data=dat3, aes(x= cut_off_date, 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)
p3 <- p3 + labs(title = "AD (n=61)")
### Schizophrenia
dat4 <- data.frame(
tool = factor(c("KinderMiner","KinderMiner","SKiM","SKiM")),
cut_off_date = factor(c("1997","2019","1997","2019"),
levels=c("1997","2019")),
Recall = c(0.4783, 0.75, 0.7935, 0.9239)
)
# Bar graph, time on x-axis, color fill grouped by sex -- use position_dodge()
p4 <- ggplot(data=dat4, aes(x= cut_off_date, 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)
p4 <- p4 + labs(title = "Schizophrenia (n=92)")
### To combine the bar chats into single figure
library(ggpubr)
theme_set(theme_pubr())
figure <- ggarrange(p1, p2, p3, p4, ncol = 4, nrow = 1,
common.legend = TRUE,
legend = "bottom")
figureA <- ggarrange(figure, labels = c("A"))
### Precision @20 – Based on expert curated disease-drug associations,
### A-C and A-B-C annotation
### upload library
library(plotly)
### Raynaud’s disease
dat <- data.frame(
Type_of_evaluation = factor(c("E1","E2","E3"), levels=c("E1","E2","E3")),
Precision_at_20 = c(0.05, 0.4737, 0.5882)
)
p11 <- ggplot(data=dat,
aes(x=Type_of_evaluation, y=Precision_at_20, fill=Type_of_evaluation)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("aquamarine2", " aquamarine3", " aquamarine4"),
name="Type of evaluation",
breaks=c("E1","E2","E3"),
labels=c("E1: Evaluation using DDA",
"E2: Evaluation using E1 and A-C literature evidence",
"E3: Evaluation using E1, E2 and A-B-C literature evidence")) +
ylim(0.00,1.00)
p11 <- p11 + labs(title = "RD")
### Migraine
dat <- data.frame(
Type_of_evaluation = factor(c("E1","E2","E3"), levels=c("E1","E2","E3")),
Precision@20 = c(0.05, 0.7, 0.9)
)
p12 <- ggplot(data=dat,
aes(x=Type_of_evaluation, y=Precision@20, fill=Type_of_evaluation)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("aquamarine2", " aquamarine3", " aquamarine4"),
name="Type of evaluation",
breaks=c("E1","E2","E3"),
labels=c("E1: Evaluation using DDA",
"E2: Evaluation using E1 and A-C literature evidence",
"E3: Evaluation using E1, E2 and A-B-C literature evidence")) +
ylim(0.00,1.00)
p12 <- p12 + labs(title = "Migraine")
### Alzheimer’s disease
dat <- data.frame(
Type_of_evaluation = factor(c("E1","E2","E3"), levels=c("E1","E2","E3")),
Precision@20 = c(0, 0.3684, 0.7895)
)
p13 <- ggplot(data=dat,
aes(x=Type_of_evaluation, y=Precision@20, fill=Type_of_evaluation)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("aquamarine2", " aquamarine3", " aquamarine4"),
name="Type of evaluation",
breaks=c("E1","E2","E3"),
labels=c("E1: Evaluation using DDA",
"E2: Evaluation using E1 and A-C literature evidence",
"E3: Evaluation using E1, E2 and A-B-C literature evidence")) +
ylim(0.00,1.00)
p13 <- p13 + labs(title = "AD")
### Schizophrenia
dat <- data.frame(
Type_of_evaluation = factor(c("E1","E2","E3"), levels=c("E1","E2","E3")),
Precision@20 = c(0.1, 0.75, 0.85)
)
p14 <- ggplot(data=dat,
aes(x=Type_of_evaluation, y=Precision@20, fill=Type_of_evaluation)) +
geom_bar(stat="identity", position=position_dodge(), colour="black") +
scale_fill_manual(values=c("aquamarine2", " aquamarine3", " aquamarine4"),
name="Type of evaluation",
breaks=c("E1","E2","E3"),
labels=c("E1: Evaluation using DDA",
"E2: Evaluation using E1 and A-C literature evidence",
"E3: Evaluation using E1, E2 and A-B-C literature evidence")) +
ylim(0.00,1.00)
p14 <- p14 + labs(title = "Schizophrenia")
### To combine the bar chats into single figure
### upload library
library(ggpubr)
theme_set(theme_pubr())
figure2 <- ggarrange(p11, p12, p13, p14, ncol = 4, nrow = 1,
common.legend = TRUE, legend = "bottom")
figureB <- ggarrange(figure2, labels = c("B"))
### To combine Fig 3A and 3B
### upload library
library(ggpubr)
theme_set(theme_pubr())
fig_3 <- ggarrange(figureA, figureB, nrow = 2)
fig_3