Diff of /6-Figure scripts/Fig E2.r [000000] .. [16eabd]

Switch to unified view

a b/6-Figure scripts/Fig E2.r
1
# Figure E2a. Total bacterial load ####
2
dat <- read_excel("Fig E2 Source Data.xlsx", sheet = "Bacterial load")
3
4
library(ggpubr)
5
FigE2a <- ggplot(dat) +
6
  geom_boxplot(aes(x=Group_Site, y=log10cpn, fill=Group),outlier.shape = NA, alpha=0.5) +
7
  geom_jitter(aes(x=Group_Site, y=log10cpn, fill=Group),shape=21,size=2, width = 0.2) +
8
  theme_bw() + theme(panel.grid = element_blank()) +
9
  ylab("log10 (16S copy number)")
10
11
FigE2a
12
13
wilcox.test(log10cpn~Group, data = dat %>% as.data.frame() %>% dplyr::filter(Site=="Guangzhou")) 
14
wilcox.test(log10cpn~Group, data = dat %>% as.data.frame() %>% dplyr::filter(Site=="Shenzhen")) 
15
16
17
# Figure E2.b --------------------
18
# Figure E2b. taxonomy #####
19
dat <- read_excel("Fig E2 Source Data.xlsx", sheet = "Taxonomy")
20
21
FigE2b.taxonomy <- ggplot(dat) +
22
  geom_point(aes(x=NUE,y=EOS), size=2)+
23
  geom_text_repel(aes(x=NUE,y=EOS, label = Label),size=3) +
24
  theme_bw()+ theme(panel.grid = element_blank()) +
25
  geom_hline(yintercept = 0, linetype="twodash") +
26
  geom_hline(yintercept = 1, linetype="dashed") +
27
  geom_vline(xintercept = -1, linetype="dashed") +
28
  geom_vline(xintercept = 0, linetype="twodash") +
29
  geom_vline(xintercept = 1, linetype="dashed") +
30
  xlab("Correlation NEU: Directionality x - log(P)")+
31
  ylab("Correlation EOS: Directionality x - log(P)")+
32
  ggtitle("Differential species-level taxa")
33
FigE2b.taxonomy
34
35
# Figure E2b. KEGG modules #####
36
dat <- read_excel("Fig E2 Source Data.xlsx", sheet = "Metagenome")
37
38
FigE2b.KEGG <- ggplot(dat) +
39
  geom_point(aes(x=NEU,y=EOS), size=2) +
40
  theme_bw()+ theme(panel.grid = element_blank()) +
41
  geom_hline(yintercept = 0, linetype="twodash") +
42
  geom_hline(yintercept = 1, linetype="dashed") +
43
  geom_vline(xintercept = -1, linetype="dashed") +
44
  geom_vline(xintercept = 0, linetype="twodash") +
45
  geom_vline(xintercept = 1, linetype="dashed") +
46
  xlab("Correlation NEU: Directionality x - log(P)")+
47
  ylab("Correlation EOS: Directionality x - log(P)")+
48
  ggtitle("Differential KEGG modules")
49
FigE2b.KEGG
50
51
52
53
# Figure E2c. correlation #####
54
dat <- read_excel("Fig E2 Source Data.xlsx", sheet = "Correlation")
55
56
FigE2c <- ggplot(dat,aes(x=bin_based_FC, y=reads_based_FC)) +
57
  geom_point( size=2 )+
58
  theme_classic() + theme(panel.grid = element_blank()) +
59
  geom_hline(yintercept = 0, linetype="dashed") +
60
  geom_vline(xintercept = 0, linetype="dashed") +
61
  geom_smooth(method = "lm", se = F, linetype="dashed", color="black", size=0.5) +
62
  xlim(c(-20, 20)) + ylim(c(-3, 10)) +
63
  scale_y_continuous(breaks = seq(-2, 10, 2))+
64
  xlab("FC (Reads-based)")+
65
  ylab("FC (Bins-based)")
66
FigE2c
67