导入数据
library("phyloseq")
library("ggplot2")
library(ggrepel)
library(ggsci)
library(MicrobiotaProcess)
otu <- "1_table-dada2_pe.qza"
rep <- "2_rep-seqs-dada2_pe.qza"
tree <- "3_rooted-tree_pe.qza"
tax <- "4_taxonomy_pe.qza"
sample <- "5_metadata.txt"
qiimedata <- import_qiime2(otuqza=otu, taxaqza=tax,refseqqza=rep,
mapfilename=sample,treeqza=tree)
qiimedata@sam_data[["group"]]<-factor(qiimedata@sam_data[["group"]],levels = c("Pre","Post"))
PCoA
生成排序矩阵
ordu<-ordinate(qiimedata,distance = 'uunifrac',
method = "PCoA")
碎石图来查看排名前几的轴的贡献率
plot_scree(ordu)+ theme_bw()
p1 <- plot_ordination(norm_qiimedata, ordu, color="group",shape = "group")
p1
p2<-p1+
stat_ellipse()+
theme_bw()+
scale_color_aaas()+
scale_fill_aaas(alpha=0.7)+
geom_point(size = 5)
p2
NMDS 非度量多维尺度分析
ordu = ordinate(qiimedata, "NMDS", "unifrac")
p1 <- plot_ordination(qiimedata, ordu, color="group",shape = "group")
p1
p2<-p1+ geom_line() + geom_point(size=5)+
theme_bw()+scale_color_aaas()
p2