Phyloseq。如何测试丰度差异

时间:2018-06-03 18:02:33

标签: r rstudio phyloseq

库由ggplot2和phyoloseq组成 数据= Globalpatterns

 GP = filter_taxa(GlobalPatterns, function(x) sum(x > 3) > (0.2*length(x)), TRUE)

GP = filter_taxa(GlobalPatterns, function(x) sum(x > 3) > (0.2*length(x)), TRUE)

定义人类与非人类分类变量,并将此新变量添加到样本数据中:

sample_data(GP)$human = factor( get_variable(GP, "SampleType") %in% c("Feces", "Mock", "Skin", "Tongue")) 将丰度标准化为中值测序深度

total = median(sample_sums(GP))
standf = function(x, t=total) round(t * (x / sum(x)))
gps = transform_sample_counts(GP, standf)

使用3.0的截止值对变异系数

过滤分类单元
gpsf = filter_taxa(gps, function(x) sd(x)/mean(x) > 3.0, TRUE)

    Subset the data to Bacteroidetes, used in some plots
    gpsfb = subset_taxa(gpsf, Phylum=="Bacteroidetes")

绘制数据

title = "plot_bar; Bacteroidetes-only"
plot_bar(gpsfb, "SampleType", "Abundance", title=title)

问题:我需要编写哪些代码,用当前的例子来测试特定样本类型(如粪便)的拟杆菌的丰度差异?

0 个答案:

没有答案