-
Notifications
You must be signed in to change notification settings - Fork 0
/
Continent_AMR_Graphs.R
793 lines (648 loc) · 28.5 KB
/
Continent_AMR_Graphs.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
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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
#packages
library(dplyr)
library(tidyverse)
library(reshape2)
library(lessR)
library(plotly)
library(ggplot2)
library(ggpubr)
#Import database
setwd("C:/Users/jessica/OneDrive - University of Bath/Bioinformatics/Sam/Assessment 2/")
df <- read.csv(file = "Gram negative Oxidase positive AMR 2.csv")
df <- as.data.frame(df)
#################################################################################
# Continent by bacteria
# Burkholderia cepacia complex
Burkholderia_cepacia_mean <- df[c(1:1407),] # subset data with rows containing B cepacia
Burkholderia_cepacia_mean <- Burkholderia_cepacia_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Burkholderia_cepacia_mean <- Burkholderia_cepacia_mean[-1,] # Get rid of unspecified row
Burkholderia_cepacia_mean <- Burkholderia_cepacia_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Burkholderia_cepacia_graphic <- ggplot(Burkholderia_cepacia_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Burkholderia cepacia")
# Burkholderia_pseudomallei
Burkholderia_pseudomallei_mean <- df[c(1408:2250),]
Burkholderia_pseudomallei_mean <- Burkholderia_pseudomallei_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Burkholderia_pseudomallei_mean <- Burkholderia_pseudomallei_mean[-1,] # Get rid of unspecified row
Burkholderia_pseudomallei_mean <- Burkholderia_pseudomallei_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Burkholderia_pseudomallei_graphic <- ggplot(Burkholderia_pseudomallei_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Burkholderia pseudomallei")
# Bordetella
Bordetella_mean <- df[c(2251:4335),]
Bordetella_mean <- Bordetella_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Bordetella_mean <- Bordetella_mean[-1,] # Get rid of unspecified row
Bordetella_mean <- Bordetella_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Bordetella_graphic <- ggplot(Bordetella_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Bordetella")
# Borrelia
Borrelia_mean <- df[c(4336:4439),]
Borrelia_mean <- Borrelia_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Borrelia_mean <- Borrelia_mean[-1,] # Get rid of unspecified row
Borrelia_mean <- Borrelia_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Borrelia_graphic <- ggplot(Borrelia_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Borrelia")
# Brucella
Brucella_mean <- df[c(4440:4547),]
Brucella_mean <- Brucella_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Brucella_mean <- Brucella_mean[-1,] # Get rid of unspecified row
Brucella_mean <- Brucella_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Brucella_graphic <- ggplot(Brucella_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Brucella")
# Chlamydiales
Chlamydiales_mean <- df[c(4548:5250),]
Chlamydiales_mean <- Chlamydiales_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Chlamydiales_mean <- Chlamydiales_mean[-1,] # Get rid of unspecified row
Chlamydiales_mean <- Chlamydiales_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Chlamydiales_graphic <- ggplot(Chlamydiales_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Chlamydiales")
# Dichelobacter_nodosus
Dichelobacter_nodosus_mean <- df[c(5251:5423),]
Dichelobacter_nodosus_mean <- Dichelobacter_nodosus_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Dichelobacter_nodosus_mean <- Dichelobacter_nodosus_mean[-1,] # Get rid of unspecified row
Dichelobacter_nodosus_mean <- Dichelobacter_nodosus_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Dichelobacter_nodosus_graphic <- ggplot(Dichelobacter_nodosus_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Dichelobacter nodosus")
# Glaesserella
Glaesserella_mean <- df[c(5424:5712),]
Glaesserella_mean <- Glaesserella_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Glaesserella_mean <- Glaesserella_mean[-1,] # Get rid of unspecified row
Glaesserella_mean <- Glaesserella_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Glaesserella_graphic <- ggplot(Glaesserella_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Glaesserella parasuis")
# Haemophilus_influenzae
Haemophilus_influenzae_mean <- df[c(5713:8344),]
Haemophilus_influenzae_mean <- Haemophilus_influenzae_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Haemophilus_influenzae_mean <- Haemophilus_influenzae_mean[-1,] # Get rid of unspecified row
Haemophilus_influenzae_mean <- Haemophilus_influenzae_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Haemophilus_influenzae_graphic <- ggplot(Haemophilus_influenzae_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Haemophilus influenzae")
# Helicobacter_pylori
Helicobacter_pylori_mean <- df[c(8345:8987),]
Helicobacter_pylori_mean <- Helicobacter_pylori_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Helicobacter_pylori_mean <- Helicobacter_pylori_mean[-1,] # Get rid of unspecified row
Helicobacter_pylori_mean <- Helicobacter_pylori_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Helicobacter_pylori_graphic <- ggplot(Helicobacter_pylori_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Helicobacter pylori")
# Leptospira
Leptospira_mean <- df[c(8988:9749),]
Leptospira_mean <- Leptospira_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Leptospira_mean <- Leptospira_mean[-1,] # Get rid of unspecified row
Leptospira_mean <- Leptospira_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Leptospira_graphic <- ggplot(Leptospira_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Leptospira")
# Neisseria
Neisseria_mean <- df[c(9750:51085),]
Neisseria_mean <- Neisseria_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Neisseria_mean <- Neisseria_mean[-1,] # Get rid of unspecified row
Neisseria_mean <- Neisseria_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Neisseria_graphic <- ggplot(Neisseria_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Neisseria")
# Pseudomonas_aeruginosa
Pseudomonas_aeruginosa_mean <- df[c(51086:53774),]
Pseudomonas_aeruginosa_mean <- Pseudomonas_aeruginosa_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Pseudomonas_aeruginosa_mean <- Pseudomonas_aeruginosa_mean[-1,] # Get rid of unspecified row
Pseudomonas_aeruginosa_mean <- Pseudomonas_aeruginosa_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Pseudomonas_aeruginosa_graphic <- ggplot(Pseudomonas_aeruginosa_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Pseudomonas aeruginosa")
# Treponema
Treponema_mean <- df[c(53775:54376),]
Treponema_mean <- Treponema_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Treponema_mean <- Treponema_mean[-1,] # Get rid of unspecified row
Treponema_mean <- Treponema_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Treponema_graphic <- ggplot(Treponema_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Treponema pallidum")
# Vibrio_cholerae
Vibrio_cholerae_mean <- df[c(54377:56040),]
Vibrio_cholerae_mean <- Vibrio_cholerae_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Vibrio_cholerae_mean <- Vibrio_cholerae_mean[-1,] # Get rid of unspecified row
Vibrio_cholerae_mean <- Vibrio_cholerae_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Vibrio_cholerae_graphic <- ggplot(Vibrio_cholerae_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Vibrio cholerae")
# Vibrio_parahaemolyticus
Vibrio_parahaemolyticus_mean <- df[c(56041:57932),]
Vibrio_parahaemolyticus_mean <- Vibrio_parahaemolyticus_mean %>%
rowwise() %>%
mutate(total = sum(c_across(18:34))) %>% # add column total which sums up AMR
group_by(continent) %>%
summarise(mean=mean(total)) # find mean of AMR by continent
Vibrio_parahaemolyticus_mean <- Vibrio_parahaemolyticus_mean[-1,] # Get rid of unspecified row
Vibrio_parahaemolyticus_mean <- Vibrio_parahaemolyticus_mean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
Vibrio_parahaemolyticus_graphic <- ggplot(Vibrio_parahaemolyticus_mean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Vibrio parahaemolyticus")
#Joining the graphs
Continent_AMR_Species <- ggarrange(Bordetella_graphic, Borrelia_graphic, Brucella_graphic,
Burkholderia_cepacia_graphic, Burkholderia_pseudomallei_graphic,
Chlamydiales_graphic, Dichelobacter_nodosus_graphic,
Glaesserella_graphic, Haemophilus_influenzae_graphic,
Helicobacter_pylori_graphic, Leptospira_graphic,
Neisseria_graphic, Pseudomonas_aeruginosa_graphic,
Treponema_graphic, Vibrio_cholerae_graphic,
Vibrio_parahaemolyticus_graphic)
#Adding the title and the axis
annotate_figure(Continent_AMR_Species,
#top=text_grob("Gram-negative oxidase-positive bacteria AMR"),
bottom=text_grob("Continent"),
left = text_grob("Level of resistance / %",rot = 90, vjust = 1))
#################################################################################
# Continent by antimicrobial class
# Aminoglycosides
aminomean <- df %>%
group_by(continent)%>%
summarise(mean=mean(amino, exclude.NA=T)/1*100) # get mean and then percentage - 1 Abx class
aminomean <- aminomean[-1,] # Get rid of unspecified row
aminomean <- aminomean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
aminographic <- ggplot(aminomean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Aminoglycosides")
# Beta-lactams
betamean <- df %>%
group_by(continent)%>%
summarise(mean=mean(betalactamics, exclude.NA=T)/1*100)
betamean <- betamean[-1,] # Get rid of unspecified row
betamean <- betamean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
betagraphic <- ggplot(betamean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Beta-lactams")
# Colistin
colistinmean <- df %>%
group_by(continent)%>%
summarise(mean=mean(Colistin, exclude.NA=T)/1*100)
colistinmean <- colistinmean[-1,] # Get rid of unspecified row
colistinmean <- colistinmean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
colistingraphic <- ggplot(colistinmean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Colistin")
# Disinfectants
disinfectantmean <- df %>%
group_by(continent)%>%
summarise(mean=mean(disinfectant, exclude.NA=T)/1*100)
disinfectantmean <- disinfectantmean[-1,] # Get rid of unspecified row
disinfectantmean <- disinfectantmean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
disinfectantgraphic <- ggplot(disinfectantmean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Disinfectants")
# Fosfomycin
fosfomean <- df %>%
group_by(continent)%>%
summarise(mean=mean(fosfomycin, exclude.NA=T)/1*100)
fosfomean <- fosfomean[-1,] # Get rid of unspecified row
fosfomean <- fosfomean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
fosfographic <- ggplot(fosfomean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Fosfomycin")
# Fusidic acid
fusidicmean <- df %>%
group_by(continent)%>%
summarise(mean=mean(fusidic_acid, exclude.NA=T)/1*100)
fusidicmean <- fusidicmean[-1,] # Get rid of unspecified row
fusidicmean <- fusidicmean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
fusidicgraphic <- ggplot(fusidicmean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Fusidic acid")
# Glycopeptides
glycomean <- df %>%
group_by(continent)%>%
summarise(mean=mean(glycopeptide, exclude.NA=T)/1*100)
glycomean <- glycomean[-1,] # Get rid of unspecified row
glycomean <- glycomean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
glycographic <- ggplot(glycomean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Glycopeptides")
# Macrolides
macromean <- df %>%
group_by(continent)%>%
summarise(mean=mean(macrolide, exclude.NA=T)/1*100)
macromean <- macromean[-1,] # Get rid of unspecified row
macromean <- macromean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
macrographic <- ggplot(macromean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Macrolides")
# Nitroimidazole
nitromean <- df %>%
group_by(continent)%>%
summarise(mean=mean(nitroimidazole, exclude.NA=T)/1*100)
nitromean <- nitromean[-1,] # Get rid of unspecified row
nitromean <- nitromean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
nitrographic <- ggplot(nitromean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Nitroimidazole")
# Oxazolidinone
oxazmean <- df %>%
group_by(continent)%>%
summarise(mean=mean(oxazolidinone, na.rm=T, exclude.NA=T)/1*100)
oxazmean <- oxazmean[-1,] # Get rid of unspecified row
oxazmean <- oxazmean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
oxazgraphic <- ggplot(oxazmean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Oxazolidinone")
# Phenicol
phemean <- df %>%
group_by(continent)%>%
summarise(mean=mean(phenicol, na.rm=T, exclude.NA=T)/1*100)
phemean <- phemean[-1,] # Get rid of unspecified row
phemean <- phemean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
phegraphic <- ggplot(phemean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Phenicol")
# Pseudomonic acid
pseudomean <- df %>%
group_by(continent)%>%
summarise(mean=mean(pseudomonic_acid, na.rm=T, exclude.NA=T)/1*100)
pseudomean <- pseudomean[-1,] # Get rid of unspecified row
pseudomean <- pseudomean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
pseudographic <- ggplot(pseudomean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Pseudomonic acid")
# Quinolones
quinomean <- df %>%
group_by(continent)%>%
summarise(mean=mean(quinolone, na.rm=T, exclude.NA=T)/1*100)
quinomean <- quinomean[-1,] # Get rid of unspecified row
quinomean <- quinomean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
quinographic <- ggplot(quinomean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Quinolones")
# Rifamycin
rifamean <- df %>%
group_by(continent)%>%
summarise(mean=mean(rifampicin, na.rm=T, exclude.NA=T)/1*100)
rifamean <- rifamean[-1,] # Get rid of unspecified row
rifamean <- rifamean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
rifagraphic <- ggplot(rifamean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Rifamycin")
# Sulphonamides
sulfamean <- df %>%
group_by(continent)%>%
summarise(mean=mean(sulfonamide, na.rm=T, exclude.NA=T)/1*100)
sulfamean <- sulfamean[-1,] # Get rid of unspecified row
sulfamean <- sulfamean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
sulfagraphic <- ggplot(sulfamean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Sulphonamides")
# Tetracyclines
tetmean <- df %>%
group_by(continent)%>%
summarise(mean=mean(tetracycline, na.rm=T, exclude.NA=T)/1*100)
tetmean <- tetmean[-1,] # Get rid of unspecified row
tetmean <- tetmean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
tetgraphic <- ggplot(tetmean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Tetracyclines")
# Trimethoprim
trimean <- df %>%
group_by(continent)%>%
summarise(mean=mean(trimethoprim, na.rm=T, exclude.NA=T)/1*100)
trimean <- trimean[-1,] # Get rid of unspecified row
trimean <- trimean %>%
mutate(percentage=mean/sum(mean)*100) # convert to percentage
trigraphic <- ggplot(trimean, aes(x=continent, y=percentage, fill=continent)) +
xlab("") +
ylab("") +
geom_bar(stat="identity") + # bar plot
theme(legend.key.size = unit(0.1, "cm"),
axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title=element_text(hjust=0.6, vjust=0.5, size=10)) +
ggtitle("Trimethoprim")
#Joining the graphs - excluded disinfectants as cannot fit
Continent_AMR_Class<-ggarrange(aminographic,betagraphic,colistingraphic,fosfographic,
fusidicgraphic,glycographic,macrographic,nitrographic,oxazgraphic,phegraphic,
pseudographic,quinographic,rifagraphic,sulfagraphic,tetgraphic,trigraphic)
#Adding the title and the axis
annotate_figure(Continent_AMR_Class,
#top=text_grob("AMR"),
bottom=text_grob("Continent"),
left = text_grob("Level of resistance %",rot = 90, vjust = 1))