[16eabd]: / 6-Figure scripts / Fig S5.R

Download this file

86 lines (68 with data), 3.1 kB

 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
library(readxl)
# Fig S3 --------------------------------
# NEU
dat <- read_excel("Fig S5 Source Data.xlsx", sheet = "NEU")
library(ggplot2)
library(ggrepel)
head(dat)
labeledDots <- c("MetaG_P00380-MetaB_M056-HostT_M318","MetaG_M00044-MetaB_M100-HostT_M490","MetaG_P00250-MetaB_M006-HostT_M490")
plotDat <-
dat %>%
mutate(Label = sapply(`...1`,function(x) if(x %in% labeledDots) x else NA) ) %>%
mutate(Color = sapply(Label, function(x) if(is.na(x)) "black" else "red"))
p1.NEU <- ggplot(plotDat, aes(x=RSQ, y=RMSE)) +
geom_point(aes(color = Color, fill=Color), shape=21) +
scale_color_manual(values = c("black","red"))+
scale_fill_manual(values = c("white","red"))+
geom_text_repel(aes(label=Label))+
theme_bw()+ theme(panel.grid = element_blank(),
legend.position = "none")
p2.NEU <- ggplot(plotDat, aes(x=RSQ, y=MAE)) +
geom_point(aes(color = Color, fill=Color), shape=21) +
scale_color_manual(values = c("black","red"))+
scale_fill_manual(values = c("white","red"))+
geom_text_repel(aes(label=Label))+
theme_bw()+ theme(panel.grid = element_blank(),
legend.position = "none")
p3.NEU <- ggplot(plotDat, aes(x=RMSE, y=MAE)) +
geom_point(aes(color = Color, fill=Color), shape=21) +
scale_color_manual(values = c("black","red"))+
scale_fill_manual(values = c("white","red"))+
geom_text_repel(aes(label=Label))+
theme_bw()+ theme(panel.grid = element_blank(),
legend.position = "none")
library(ggpubr)
P.NEU <- ggarrange(p1.NEU, p2.NEU, p3.NEU, ncol = 3)
# EOS
dat <- read_excel("Fig S5 Source Data.xlsx", sheet = "EOS")
library(ggplot2)
library(ggrepel)
head(dat)
labeledDots <- c("MetaG_P00564-MetaB_M123-HostT_M391")
plotDat <-
dat %>%
mutate(Label = sapply(`...1`,function(x) if(x %in% labeledDots) x else NA) ) %>%
mutate(Color = sapply(Label, function(x) if(is.na(x)) "black" else "red"))
p1.EOS <- ggplot(plotDat, aes(x=RSQ, y=RMSE)) +
geom_point(aes(color = Color, fill=Color), shape=21) +
scale_color_manual(values = c("black","red"))+
scale_fill_manual(values = c("white","red"))+
geom_text_repel(aes(label=Label))+
theme_bw()+ theme(panel.grid = element_blank(),
legend.position = "none")
p2.EOS <- ggplot(plotDat, aes(x=RSQ, y=MAE)) +
geom_point(aes(color = Color, fill=Color), shape=21) +
scale_color_manual(values = c("black","red"))+
scale_fill_manual(values = c("white","red"))+
geom_text_repel(aes(label=Label))+
theme_bw()+ theme(panel.grid = element_blank(),
legend.position = "none")
p3.EOS <- ggplot(plotDat, aes(x=RMSE, y=MAE)) +
geom_point(aes(color = Color, fill=Color), shape=21) +
scale_color_manual(values = c("black","red"))+
scale_fill_manual(values = c("white","red"))+
geom_text_repel(aes(label=Label))+
theme_bw()+ theme(panel.grid = element_blank(),
legend.position = "none")
library(ggpubr)
P.EOS <-ggarrange(p1.EOS, p2.EOS, p3.EOS, ncol = 3)