-
Notifications
You must be signed in to change notification settings - Fork 0
/
Figure_4.R
368 lines (324 loc) · 14.2 KB
/
Figure_4.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
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
### Figure 4A: Cut-off date is one year prior to Swanson's discovery
# Set the working directory
setwd("PATH_OF_WORKING_DIRECTORY")
### To draw boxplot using ggplot2
library(ggplot2)
library(ggpubr)
### Raynaud's disease
### To read known and new predicted drugs
data_r1 <- read.table("Swanson_cutoff/raynauds_syndrome_boxPlotData_drugAndPredScore.txt",
header=TRUE, sep="\t", quote="")
label_r1 <- read.table("Swanson_cutoff/raynauds_syndrome_boxPlotData_label.txt",
header=TRUE, quote="")
data_label_r1 <- cbind(data_r1,label_r1)
### To draw boxplot using ggplot2
Drugs_r1 <- as.factor(data_label_r1$label)
Prediction_score_r1 <- as.numeric(data_label_r1$fet_p_value_and_ratio)
### fill boxes with colors
r1 <- ggplot(data_label_r1, aes(x=Drugs_r1, y=Prediction_score_r1,
fill=Drugs_r1)) +
geom_boxplot() +
ylim(0,330) +
labs(title="RD @1985", x="", y = "Prediction score") +
scale_x_discrete(breaks=c("1","2"), labels=c("DDAs","New drugs")) +
theme_classic() +
theme(
plot.title = element_text(size=20, face="bold"),
axis.text.x = element_text(color = "grey20", size = 12,
hjust = .5, vjust = .5,
face = "plain"),
axis.text.y = element_text(color = "grey20", size = 12,
angle = 0, hjust = 1, vjust = 0,
face = "plain"),
axis.title.x = element_text(color = "grey20", size = 12,
angle = 0, hjust = .5, vjust = 0,
face = "plain"),
axis.title.y = element_text(color = "grey20", size = 12,
angle = 90, hjust = .5, vjust = .5,
face = "plain"),
legend.position="none"
)
### Prediction score of known drug – Fish oil: 7.526786746680776
### change box fill color manually and draw line for known drug
r11 <- r1 + scale_fill_manual(values=c("seagreen3", "yellow3")) +
geom_hline(yintercept=c(7.526786746680776), linetype="dashed",
color = c("blue"), size= 1.0)
### Migraine
### To read known and new predicted drugs
data_m1 <- read.table("Swanson_cutoff/migraine_boxPlotData_drugAndPredScore.txt",
header=TRUE, sep="\t", quote="")
label_m1 <- read.table("Swanson_cutoff/migraine_boxPlotData_label.txt",
header=TRUE, quote="")
data_label_m1 <- cbind(data_m1,label_m1)
### To draw boxplot using ggplot2
Drugs_m1 <- as.factor(data_label_m1$label)
Prediction_score_m1 <- as.numeric(data_label_m1$fet_p_value_and_ratio)
### fill boxes with colors
m1 <- ggplot(data_label_m1, aes(x=Drugs_m1, y=Prediction_score_m1,
fill=Drugs_m1)) +
geom_boxplot() +
ylim(0,330) +
labs(title="Migraine @1987", x="", y = "Prediction score") +
scale_x_discrete(breaks=c("1","2"), labels=c("DDAs","New drugs")) +
theme_classic() +
theme(
plot.title = element_text(size=20, face="bold"),
axis.text.x = element_text(color = "grey20", size = 12,
hjust = .5, vjust = .5,
face = "plain"),
axis.text.y = element_text(color = "grey20", size = 12,
angle = 0, hjust = 1, vjust = 0,
face = "plain"),
axis.title.x = element_text(color = "grey20", size = 12,
angle = 0, hjust = .5, vjust = 0,
face = "plain"),
axis.title.y = element_text(color = "grey20", size = 12,
angle = 90, hjust = .5, vjust = .5,
face = "plain"),
legend.position="none"
)
### Prediction score of known drug – Magnesium: 34.17133211345856
### change box fill color manually and draw line for known drug
m11 <- m1 + scale_fill_manual(values=c("seagreen3", "yellow3")) +
geom_hline(yintercept=c(34.17133211345856), linetype="dashed",
color = c("blue"), size= 1.0)
### Alzheimer's disease
### To read known and new predicted drugs
data_a1 <- read.table("Swanson_cutoff/alzheimers_disease_boxPlotData_drugAndPredScore.txt",
header=TRUE, sep="\t", quote="")
label_a1 <- read.table("Swanson_cutoff/alzheimers_disease_boxPlotData_label.txt",
header=TRUE, quote="")
data_label_a1 <- cbind(data_a1,label_a1)
### To draw boxplot using ggplot2
Drugs_a1 <- as.factor(data_label_a1$label)
Prediction_score_a1 <- as.numeric(data_label_a1$fet_p_value_and_ratio)
### fill boxes with colors
a1 <- ggplot(data_label_a1, aes(x=Drugs_a1, y=Prediction_score_a1,
fill=Drugs_a1)) +
geom_boxplot() +
ylim(0,330) +
labs(title="AD @1995", x="", y = "Prediction score") +
scale_x_discrete(breaks=c("1","2"), labels=c("DDAs","New drugs")) +
theme_classic() +
theme(
plot.title = element_text(size=20, face="bold"),
axis.text.x = element_text(color = "grey20", size = 12,
hjust = .5, vjust = .5,
face = "plain"),
axis.text.y = element_text(color = "grey20", size = 12,
angle = 0, hjust = 1, vjust = 0,
face = "plain"),
axis.title.x = element_text(color = "grey20", size = 12,
angle = 0, hjust = .5, vjust = 0,
face = "plain"),
axis.title.y = element_text(color = "grey20", size = 12,
angle = 90, hjust = .5, vjust = .5,
face = "plain"),
legend.position="none"
)
### Prediction score of known drug – Indomethacin (CDM00000570): 321.8637302593377
### Prediction score of known drug – estrogen (CDM00000436): 204.46628669040342
### change box color manually and draw line for known drug
a11 <- a1 + scale_fill_manual(values=c("seagreen3", "yellow3")) +
geom_hline(yintercept=c(321.8637302593377, 204.46628669040342),
linetype="dashed",
color = c("blue", "dodgerblue"), size= 1.0)
### Schizophrenia
### To read known and new predicted drugs
data_s1 <- read.table("Swanson_cutoff/schizophrenia_boxPlotData_drugAndPredScore.txt",
header=TRUE, sep="\t", quote="")
label_s1 <- read.table("Swanson_cutoff/schizophrenia_boxPlotData_label.txt",
header=TRUE, quote="")
data_label_s1 <- cbind(data_s1,label_s1)
### To draw boxplot using ggplot2
Drugs_s1 <- as.factor(data_label_s1$label)
Prediction_score_s1 <- as.numeric(data_label_s1$fet_p_value_and_ratio)
### fill boxes with colors
s1 <- ggplot(data_label_s1, aes(x=Drugs_s1, y=Prediction_score_s1,
fill=Drugs_s1)) +
geom_boxplot() +
ylim(0,330) +
labs(title="Schizophrenia @1997", x="", y = "Prediction score") +
scale_x_discrete(breaks=c("1","2"), labels=c("DDAs","New drugs")) +
theme_classic() +
theme(
plot.title = element_text(size=20, face="bold"),
axis.text.x = element_text(color = "grey20", size = 12,
hjust = .5, vjust = .5,
face = "plain"),
axis.text.y = element_text(color = "grey20", size = 12,
angle = 0, hjust = 1, vjust = 0,
face = "plain"),
axis.title.x = element_text(color = "grey20", size = 12,
angle = 0, hjust = .5, vjust = 0,
face = "plain"),
axis.title.y = element_text(color = "grey20", size = 12,
angle = 90, hjust = .5,
vjust = .5, face = "plain"),
legend.position="none"
)
### change box color manually and draw line for known drug
s11 <- s1 + scale_fill_manual(values=c("seagreen3", "yellow3"))
### Figure 4B: Cut-off date is March 2019
### Raynaud's disease
### To read known and new predicted drugs
data_r2 <- read.table("march2019_Swanson_diseases/raynauds_syndrome_boxPlotData_drugAndPredScore.txt",
header=TRUE, sep="\t", quote="")
label_r2 <- read.table("march2019_Swanson_diseases/raynauds_syndrome_boxPlotData_label.txt",
header=TRUE, quote="")
data_label_r2 <- cbind(data_r2,label_r2)
### To draw boxplot using ggplot2
Drugs_r2 <- as.factor(data_label_r2$label)
Prediction_score_r2 <- as.numeric(data_label_r2$fet_p_value_and_ratio)
### fill boxes with colors
r2 <- ggplot(data_label_r2, aes(x=Drugs_r2, y=Prediction_score_r2,
fill=Drugs_r2)) +
geom_boxplot() +
ylim(0,330) +
labs(title="RD @2019", x="", y = "Prediction score") +
scale_x_discrete(breaks=c("1","2"), labels=c("DDAs","New drugs")) +
theme_classic() +
theme(
plot.title = element_text(size=20, face="bold"),
axis.text.x = element_text(color = "grey20", size = 12,
hjust = .5, vjust = .5,
face = "plain"),
axis.text.y = element_text(color = "grey20", size = 12,
angle = 0, hjust = 1,
vjust = 0, face = "plain"),
axis.title.x = element_text(color = "grey20", size = 12,
angle = 0, hjust = .5,
vjust = 0, face = "plain"),
axis.title.y = element_text(color = "grey20", size = 12,
angle = 90, hjust = .5,
vjust = .5, face = "plain"),
legend.position="none"
)
### Prediction score of known drug – Fish oil: 64.69839709150772
### change box fill color manually and draw line for known drug
r22 <- r2 + scale_fill_manual(values=c("seagreen3", "yellow3")) +
geom_hline(yintercept=c(64.69839709150772), linetype="dashed",
color = c("blue"), size= 1.0)
### Migraine
### To read known and new predicted drugs
data_m2 <- read.table("march2019_Swanson_diseases/migraine_boxPlotData_drugAndPredScore.txt",
header=TRUE, sep="\t", quote="")
label_m2 <- read.table("march2019_Swanson_diseases/migraine_boxPlotData_label.txt",
header=TRUE, quote="")
data_label_m2 <- cbind(data_m2,label_m2)
### To draw boxplot using ggplot2
Drugs_m2 <- as.factor(data_label_m2$label)
Prediction_score_m2 <- as.numeric(data_label_m2$fet_p_value_and_ratio)
### fill boxes with colors
m2 <- ggplot(data_label_m2, aes(x=Drugs_m2, y=Prediction_score_m2,
fill=Drugs_m2)) +
geom_boxplot() +
ylim(0,330) +
labs(title="Migraine @2019", x="", y = "Prediction score") +
scale_x_discrete(breaks=c("1","2"), labels=c("DDAs","New drugs")) +
theme_classic() +
theme(
plot.title = element_text(size=20, face="bold"),
axis.text.x = element_text(color = "grey20", size = 12,
hjust = .5, vjust = .5,
face = "plain"),
axis.text.y = element_text(color = "grey20", size = 12,
angle = 0, hjust = 1,
vjust = 0, face = "plain"),
axis.title.x = element_text(color = "grey20", size = 12,
angle = 0, hjust = .5,
vjust = 0, face = "plain"),
axis.title.y = element_text(color = "grey20", size = 12,
angle = 90, hjust = .5,
vjust = .5, face = "plain"),
legend.position="none"
)
### Prediction score of known drug – Magnesium: 321.28177806710437
### change box fill color manually and draw line for known drug
m22 <- m2 + scale_fill_manual(values=c("seagreen3", "yellow3")) +
geom_hline(yintercept=c(321.28177806710437), linetype="dashed",
color = c("blue"), size= 1.0)
### Alzheimer's disease
### To read known and new predicted drugs
data_a2 <- read.table("march2019_Swanson_diseases/alzheimers_disease_boxPlotData_drugAndPredScore.txt",
header=TRUE, sep="\t", quote="")
label_a2 <- read.table("march2019_Swanson_diseases/alzheimers_disease_boxPlotData_label.txt",
header=TRUE, quote="")
data_label_a2 <- cbind(data_a2,label_a2)
### To draw boxplot using ggplot2
Drugs_a2 <- as.factor(data_label_a2$label)
Prediction_score_a2 <- as.numeric(data_label_a2$fet_p_value_and_ratio)
### fill boxes with colors
a2 <- ggplot(data_label_a2, aes(x=Drugs_a2, y=Prediction_score_a2,
fill=Drugs_a2)) +
geom_boxplot() +
ylim(0,330) +
labs(title="AD @2019", x="", y = "Prediction score") +
scale_x_discrete(breaks=c("1","2"), labels=c("DDAs","New drugs")) +
theme_classic() +
theme(
plot.title = element_text(size=20, face="bold"),
axis.text.x = element_text(color = "grey20", size = 12,
hjust = .5, vjust = .5,
face = "plain"),
axis.text.y = element_text(color = "grey20", size = 12,
angle = 0, hjust = 1,
vjust = 0, face = "plain"),
axis.title.x = element_text(color = "grey20", size = 12,
angle = 0, hjust = .5,
vjust = 0, face = "plain"),
axis.title.y = element_text(color = "grey20", size = 12,
angle = 90, hjust = .5,
vjust = .5, face = "plain"),
legend.position="none"
)
### Prediction score of known drug – Indomethacin (CDM00000570): 26.180786662368238
### Prediction score of known drug – estrogen (CDM00000436): 176.64298041099383
### change box color manually and draw line for known drug
a22 <- a2 + scale_fill_manual(values=c("seagreen3", "yellow3")) +
geom_hline(yintercept=c(26.180786662368238, 176.64298041099383),
linetype="dashed", color = c("blue", "dodgerblue"),
size= 1.0)
### Schizophrenia
### To read known and new predicted drugs
data_s2 <- read.table("march2019_Swanson_diseases/schizophrenia_boxPlotData_drugAndPredScore.txt",
header=TRUE, sep="\t", quote="")
label_s2 <- read.table("march2019_Swanson_diseases/schizophrenia_boxPlotData_label.txt",
header=TRUE, quote="")
data_label_s2 <- cbind(data_s2,label_s2)
### To draw boxplot using ggplot2
Drugs_s2 <- as.factor(data_label_s2$label)
Prediction_score_s2 <- as.numeric(data_label_s2$fet_p_value_and_ratio)
### fill boxes with colors
s2 <- ggplot(data_label_s2, aes(x=Drugs_s2, y=Prediction_score_s2,
fill=Drugs_s2)) +
geom_boxplot() +
ylim(0,330) +
labs(title="Schizophrenia @2019", x="", y = "Prediction score") +
scale_x_discrete(breaks=c("1","2"), labels=c("DDAs","New drugs")) +
theme_classic() +
theme(
plot.title = element_text(size=20, face="bold"),
axis.text.x = element_text(color = "grey20", size = 12,
hjust = .5, vjust = .5,
face = "plain"),
axis.text.y = element_text(color = "grey20", size = 12,
angle = 0, hjust = 1,
vjust = 0, face = "plain"),
axis.title.x = element_text(color = "grey20", size = 12,
angle = 0, hjust = .5,
vjust = 0, face = "plain"),
axis.title.y = element_text(color = "grey20", size = 12,
angle = 90, hjust = .5,
vjust = .5, face = "plain"),
legend.position="none"
)
### change box color manually and draw line for known drug
s22 <- s2 + scale_fill_manual(values=c("seagreen3", "yellow3"))
### combine all the plots (Figure 4A, Figure 4B)
sd <- ggarrange(r11, m11, a11, s11, ncol = 4, nrow = 1)
m2019 <- ggarrange(r22, m22, a22, s22, ncol = 4, nrow = 1)
both <- ggarrange(sd, m2019,
labels = c("A", "B"),
ncol = 1, nrow = 2)
plot(both)