差异丰度检验是微生物群落数据分析的重要组成部分。它可以用来确定群落间差异的重要分类群。目前,trans_diff类有三种著名的方法来进行这种分析:metastat、LEfSe和random forest。这里我们介绍random forest 方法
> t1 <- trans_diff$new(dataset = dataset, + method = "rf", + group = "Group", + taxa_level = "Genus") 1243 input features ... 751 features are remained after removing unknown features ... Start Kruskal-Wallis rank sum test for Group ... 432 taxa found significant ... After P value adjustment, 397 taxa found significant ... Taxa abundance table is stored in object$res_abund ... rf analysis result is stored in object$res_diff ... > g1 <- t1$plot_diff_bar(use_number = 1:20, + group_order = c("TW", "CW", "IW")) > g1
#lefse方法
> t1 <- trans_diff$new(dataset = dataset, method = "lefse", group = "Group", alpha = 0.01, lefse_subgroup = NULL)
> t1$plot_diff_bar(use_number = 1:30,
width = 0.8,
group_order = c("CW", "IW", "TW")) +
ggsci::scale_color_npg() +
ggsci::scale_fill_npg()
> t1$res_diff[1:5, ] Comparison Taxa Method Group LDA P.unadj P.adj k__Bacteria|p__Proteobacteria CW - IW - TW k__Bacteria|p__Proteobacteria LEfSe CW 4.845260 3.209570e-11 1.075904e-09 k__Bacteria|p__Acidobacteria CW - IW - TW k__Bacteria|p__Acidobacteria LEfSe IW 4.792228 5.749137e-12 2.955057e-10 k__Bacteria|p__Acidobacteria|c__Acidobacteria CW - IW - TW k__Bacteria|p__Acidobacteria|c__Acidobacteria LEfSe IW 4.791686 8.559155e-13 6.946430e-11 k__Bacteria|p__Bacteroidetes CW - IW - TW k__Bacteria|p__Bacteroidetes LEfSe TW 4.770984 1.190230e-09 1.529446e-08 k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria CW - IW - TW k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria LEfSe CW 4.624007 5.474697e-12 2.911029e-10 Significance k__Bacteria|p__Proteobacteria *** k__Bacteria|p__Acidobacteria *** k__Bacteria|p__Acidobacteria|c__Acidobacteria *** k__Bacteria|p__Bacteroidetes *** k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria ***
> t1$plot_diff_abund(use_number = 1:30)
# 然后,我们给出了分类树中差异特征的梯形图。这个数据集中的分类群太多了。
# 作为一个例子,我们只使用了树中最丰富的200个分类群和50个差异特征。
# 我们只在门级显示完整的分类标签,在其他级别使用字母来减少文本重叠。
#需要调用ggtree
library(ggtree)
t1$plot_diff_cladogram(use_taxa_num = 200,
use_feature_num = 50,
clade_label_level = 5,
group_order = c("CW", "IW", "TW"))文章来源:https://www.toymoban.com/news/detail-841206.html
文章来源地址https://www.toymoban.com/news/detail-841206.html
到了这里,关于R语言包:microeco:一个用于微生物群落生态学数据挖掘的R包:第五:trans_diff class的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!