|
a |
|
b/6-Figure scripts/Fig S5.R |
|
|
1 |
library(readxl) |
|
|
2 |
# Fig S3 -------------------------------- |
|
|
3 |
# NEU |
|
|
4 |
dat <- read_excel("Fig S5 Source Data.xlsx", sheet = "NEU") |
|
|
5 |
|
|
|
6 |
library(ggplot2) |
|
|
7 |
library(ggrepel) |
|
|
8 |
|
|
|
9 |
head(dat) |
|
|
10 |
labeledDots <- c("MetaG_P00380-MetaB_M056-HostT_M318","MetaG_M00044-MetaB_M100-HostT_M490","MetaG_P00250-MetaB_M006-HostT_M490") |
|
|
11 |
plotDat <- |
|
|
12 |
dat %>% |
|
|
13 |
mutate(Label = sapply(`...1`,function(x) if(x %in% labeledDots) x else NA) ) %>% |
|
|
14 |
mutate(Color = sapply(Label, function(x) if(is.na(x)) "black" else "red")) |
|
|
15 |
p1.NEU <- ggplot(plotDat, aes(x=RSQ, y=RMSE)) + |
|
|
16 |
geom_point(aes(color = Color, fill=Color), shape=21) + |
|
|
17 |
scale_color_manual(values = c("black","red"))+ |
|
|
18 |
scale_fill_manual(values = c("white","red"))+ |
|
|
19 |
geom_text_repel(aes(label=Label))+ |
|
|
20 |
theme_bw()+ theme(panel.grid = element_blank(), |
|
|
21 |
legend.position = "none") |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
p2.NEU <- ggplot(plotDat, aes(x=RSQ, y=MAE)) + |
|
|
25 |
geom_point(aes(color = Color, fill=Color), shape=21) + |
|
|
26 |
scale_color_manual(values = c("black","red"))+ |
|
|
27 |
scale_fill_manual(values = c("white","red"))+ |
|
|
28 |
geom_text_repel(aes(label=Label))+ |
|
|
29 |
theme_bw()+ theme(panel.grid = element_blank(), |
|
|
30 |
legend.position = "none") |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
p3.NEU <- ggplot(plotDat, aes(x=RMSE, y=MAE)) + |
|
|
34 |
geom_point(aes(color = Color, fill=Color), shape=21) + |
|
|
35 |
scale_color_manual(values = c("black","red"))+ |
|
|
36 |
scale_fill_manual(values = c("white","red"))+ |
|
|
37 |
geom_text_repel(aes(label=Label))+ |
|
|
38 |
theme_bw()+ theme(panel.grid = element_blank(), |
|
|
39 |
legend.position = "none") |
|
|
40 |
library(ggpubr) |
|
|
41 |
|
|
|
42 |
P.NEU <- ggarrange(p1.NEU, p2.NEU, p3.NEU, ncol = 3) |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
# EOS |
|
|
47 |
dat <- read_excel("Fig S5 Source Data.xlsx", sheet = "EOS") |
|
|
48 |
|
|
|
49 |
library(ggplot2) |
|
|
50 |
library(ggrepel) |
|
|
51 |
|
|
|
52 |
head(dat) |
|
|
53 |
labeledDots <- c("MetaG_P00564-MetaB_M123-HostT_M391") |
|
|
54 |
plotDat <- |
|
|
55 |
dat %>% |
|
|
56 |
mutate(Label = sapply(`...1`,function(x) if(x %in% labeledDots) x else NA) ) %>% |
|
|
57 |
mutate(Color = sapply(Label, function(x) if(is.na(x)) "black" else "red")) |
|
|
58 |
p1.EOS <- ggplot(plotDat, aes(x=RSQ, y=RMSE)) + |
|
|
59 |
geom_point(aes(color = Color, fill=Color), shape=21) + |
|
|
60 |
scale_color_manual(values = c("black","red"))+ |
|
|
61 |
scale_fill_manual(values = c("white","red"))+ |
|
|
62 |
geom_text_repel(aes(label=Label))+ |
|
|
63 |
theme_bw()+ theme(panel.grid = element_blank(), |
|
|
64 |
legend.position = "none") |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
p2.EOS <- ggplot(plotDat, aes(x=RSQ, y=MAE)) + |
|
|
68 |
geom_point(aes(color = Color, fill=Color), shape=21) + |
|
|
69 |
scale_color_manual(values = c("black","red"))+ |
|
|
70 |
scale_fill_manual(values = c("white","red"))+ |
|
|
71 |
geom_text_repel(aes(label=Label))+ |
|
|
72 |
theme_bw()+ theme(panel.grid = element_blank(), |
|
|
73 |
legend.position = "none") |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
p3.EOS <- ggplot(plotDat, aes(x=RMSE, y=MAE)) + |
|
|
77 |
geom_point(aes(color = Color, fill=Color), shape=21) + |
|
|
78 |
scale_color_manual(values = c("black","red"))+ |
|
|
79 |
scale_fill_manual(values = c("white","red"))+ |
|
|
80 |
geom_text_repel(aes(label=Label))+ |
|
|
81 |
theme_bw()+ theme(panel.grid = element_blank(), |
|
|
82 |
legend.position = "none") |
|
|
83 |
library(ggpubr) |
|
|
84 |
|
|
|
85 |
P.EOS <-ggarrange(p1.EOS, p2.EOS, p3.EOS, ncol = 3) |