|
a |
|
b/6-Figure scripts/Fig S1.R |
|
|
1 |
library(readxl) |
|
|
2 |
library(dplyr) |
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
#Figure S1a -------------------------------------- |
|
|
7 |
# Figure S1a. genes #### |
|
|
8 |
dat.genes <- read_excel("Fig S1 Source Data.xlsx", sheet = "Fig S1a rarefaction genes") |
|
|
9 |
dat.KO <- read_excel("Fig S1 Source Data.xlsx", sheet = "Fig S1a rarefaction KOs") |
|
|
10 |
|
|
|
11 |
|
|
|
12 |
data1<-dat.genes[(dat.genes$Group=="COPD"),] |
|
|
13 |
data2<-dat.genes[(dat.genes$Group=="Health"),] |
|
|
14 |
dat_combined <- merge(data1,data2, by = "Samples",all = T) |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
library(ggplot2) |
|
|
18 |
p1<-ggplot(dat_combined,aes(x=factor(Samples),y=Genes.x/1000000))+ |
|
|
19 |
geom_boxplot(colour="#f0999f",outlier.colour=NULL,outlier.shape=19,outlier.size=1)+ |
|
|
20 |
#scale_y_continuous(limits = c(0,2)) + |
|
|
21 |
theme_bw() + theme(panel.grid.minor =element_blank(), panel.grid.major = element_blank()) |
|
|
22 |
p1 |
|
|
23 |
|
|
|
24 |
library(ggpubr) |
|
|
25 |
library(cowplot) |
|
|
26 |
p2<-ggplot(dat_combined,aes(x=factor(Samples),y=Genes.y/1000000)) + |
|
|
27 |
geom_boxplot(colour="#46bbc0",outlier.colour=NULL,outlier.shape=19,outlier.size=1)+ |
|
|
28 |
scale_y_continuous(limits = c(0,1.25), position = "right", |
|
|
29 |
breaks = seq(0,1.25, by=0.25)) + |
|
|
30 |
theme_half_open(11, rel_small = 1) + |
|
|
31 |
rremove("x.axis")+ |
|
|
32 |
rremove("xlab") + |
|
|
33 |
rremove("x.text") + |
|
|
34 |
rremove("x.ticks") + |
|
|
35 |
rremove("legend") |
|
|
36 |
|
|
|
37 |
p2 |
|
|
38 |
|
|
|
39 |
aligned_plots <- align_plots(p1, p2, align="hv", axis="tblr") |
|
|
40 |
FigS1a.genes <- ggdraw(aligned_plots[[1]]) + draw_plot(aligned_plots[[2]]) |
|
|
41 |
FigS1a.genes |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
# Figure S1a. KO #### |
|
|
45 |
|
|
|
46 |
data1<-dat.KO[(dat.KO$Group=="COPD"),] |
|
|
47 |
data2<-dat.KO[(dat.KO$Group=="Health"),] |
|
|
48 |
dat_combined <- merge(data1,data2, by = "Samples",all = T) |
|
|
49 |
|
|
|
50 |
p1<-ggplot(dat_combined,aes(x=factor(Samples),y=Genes.x/1000))+ |
|
|
51 |
geom_boxplot(colour="#f0999f",outlier.colour=NULL,outlier.shape=19,outlier.size=1)+ |
|
|
52 |
scale_y_continuous(limits = c(2.5,7)) + |
|
|
53 |
theme_bw() + theme(panel.grid.minor =element_blank(), panel.grid.major = element_blank()) |
|
|
54 |
p1 |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
p2<-ggplot(dat_combined,aes(x=factor(Samples),y=Genes.y/1000)) + |
|
|
58 |
geom_boxplot(colour="#46bbc0",outlier.colour=NULL,outlier.shape=19,outlier.size=1)+ |
|
|
59 |
scale_y_continuous(limits = c(2.5,7), position = "right", |
|
|
60 |
breaks = seq(3,7, by=1)) + |
|
|
61 |
theme_half_open(11, rel_small = 1) + |
|
|
62 |
rremove("x.axis")+ |
|
|
63 |
rremove("xlab") + |
|
|
64 |
rremove("x.text") + |
|
|
65 |
rremove("x.ticks") + |
|
|
66 |
rremove("legend") |
|
|
67 |
|
|
|
68 |
p2 |
|
|
69 |
|
|
|
70 |
aligned_plots <- align_plots(p1, p2, align="hv", axis="tblr") |
|
|
71 |
FigS1a.KO <- ggdraw(aligned_plots[[1]]) + draw_plot(aligned_plots[[2]]) |
|
|
72 |
FigS1a.KO |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
# Figure S1b. ----------------------------------------------------- |
|
|
77 |
rm(list = ls()) |
|
|
78 |
# Fig S1b.stats ##### |
|
|
79 |
data<-read_excel("Fig S1 Source Data.xlsx" ,sheet = "Fig S1b bin stats") |
|
|
80 |
plotDat<-melt(data,id.vals="NAME") |
|
|
81 |
group<-factor(plotDat$Group,levels=c("High","Medium","Low")) |
|
|
82 |
FigS1b.stats <- |
|
|
83 |
ggplot(plotDat,aes(x=group,y=value))+ |
|
|
84 |
geom_boxplot(outlier.shape=NA,aes(fill=group))+ |
|
|
85 |
geom_jitter(alpha=0.1,shape=20,size=3,position=position_jitter(0.2))+ |
|
|
86 |
facet_wrap(~variable,scale="free")+ |
|
|
87 |
scale_fill_manual(values=c("#3081bc","#9fc8e2","#dfebf5")) + |
|
|
88 |
theme_bw()+theme(axis.line = element_line(colour = "black"), |
|
|
89 |
panel.grid.major = element_blank(), |
|
|
90 |
panel.grid.minor = element_blank(), |
|
|
91 |
panel.background = element_blank()) |
|
|
92 |
FigS1b.stats |
|
|
93 |
|
|
|
94 |
# Fig S1b.taxa ##### |
|
|
95 |
data <- read_excel("Fig S1 Source Data.xlsx", sheet = "Fig S1b bin taxa") |
|
|
96 |
plotDat <- data %>% reshape2::melt() %>% |
|
|
97 |
group_by(variable, Genus) %>% |
|
|
98 |
summarise(sumed = sum(value), Phylum=unique(Phylum)) %>% |
|
|
99 |
mutate(freq=sumed/sum(sumed)) |
|
|
100 |
|
|
|
101 |
plotDat$Phylum <- factor(plotDat$Phylum, |
|
|
102 |
levels = c("Bacteroidetes","Proteobacteria","Actinobacteria", |
|
|
103 |
"Firmicutes","Spirochaetes","TM7")) |
|
|
104 |
genus.level <- c("Prevotella","Porphyromonadaceae","Bacteroidales", |
|
|
105 |
"Neisseria","Haemophilus","Moraxella","Campylobacter","Ralstonia","Pseudomonas","Lautropia", |
|
|
106 |
"Rothia","Schaalia","Actinomyces", |
|
|
107 |
"Streptococcus","Veillonella","Lachnospiraceae","Mogibacterium", |
|
|
108 |
"Megasphaera","Selenomonas","Lactobacillus", |
|
|
109 |
"Treponema","Saccharibacteria","Others","Unclassified") |
|
|
110 |
plotDat$Genus[!plotDat$Genus %in% genus.level] <- "Others" |
|
|
111 |
|
|
|
112 |
plotDat$Genus <- factor(plotDat$Genus,levels = rev(genus.level)) |
|
|
113 |
|
|
|
114 |
mypalette <- c("#E25554","#E88D8D","#F2C3C3", |
|
|
115 |
"#EEA020","#F0AD4D","#F4BF76","#F7CF9E","#F6D9B9","#FBE9D8","#FCF2EA", |
|
|
116 |
"#49A9CE","#80CCE0","#BFE4EE", |
|
|
117 |
"#33A863","#4EB676","#77C392","#96CFA9", |
|
|
118 |
"#B4DCC1","#C5E3D0","#E2F1E6", |
|
|
119 |
"#D0BB8A","#968CBC","#B7B6B6","#E5E3E2") |
|
|
120 |
|
|
|
121 |
FigS1b.taxa <- ggplot(plotDat) + |
|
|
122 |
geom_col(aes(x=variable, y=freq, fill=Genus))+ |
|
|
123 |
scale_fill_manual(values = rev(mypalette))+ |
|
|
124 |
theme_classic() |
|
|
125 |
FigS1b.taxa |