展开

Alpha多样性

最后发布时间 : 2022-11-04 11:55:57 浏览量 :
  • 多样性指数统计
  • 多样性指数差异分析
  • 稀释曲线
  • Rank-Aundance曲线
  • 物种累积曲线

https://gitee.com/bioinfoFungi/amplicon

使用USEARCH计算14种alpha多样性指数

http://www.drive5.com/usearch/manual/alpha_metrics.html

usearch -alpha_div results/otutab_rare.txt \
      -output results/alpha/alpha.txt
Sampleberger_parkerbuzas_gibsonchao1dominanceequitabilityjostjost1readsrichnessrobbinssimpsonshannon_eshannon_2shannon_10
KO10.05840.03581211.10.990.828172.6357.91000012100.2580.01025.888.482.55
KO20.05360.03851198.80.9920.84202.5385.21000011980.2390.008275.958.592.59
KO30.06580.02731052.30.9880.806140.1273.21000010510.2980.01165.618.092.44
KO40.05980.02781051.20.9890.809145.9278.41000010500.2750.01095.638.122.44
KO50.07270.0226968.90.9860.789112.6226.2100009680.2820.01445.427.822.35
KO60.05030.033311190.9910.827179.1332.61000011180.2560.008885.818.382.52

使用vegan包计算alpha多样性指数

#OTUIDKO1KO2KO3KO4KO5KO6OE1OE2OE3OE4OE5OE6WT1WT2WT3WT4WT5WT6
ASV_1382671282438381390476590500360490357799830567664508519
ASV_26714128637931032631245169414440348239440536267386497424
ASV_3213173369296445308211151372367316242327635357416413274
ASV_4506141181257480178203196134210214129362473196192394290
ASV_818919521514877101132183540300211190230275199356169184
ASV_63022323073094903658995114143134137178191154184158158

otutab

library(vegan)
suppressMessages(library(tidyverse))
species = read.table("https://gitee.com/bioinfoFungi/amplicon/raw/master/results/otutab.txt", header=T, sep="\t", quote = "", row.names=1, comment.char="")
set.seed(1)
# min(colSums(species)) 抽样数使用最小值,或指定抽样数
depth <- 10000 
# vegan::rrarefy抽平至最小值或指定值
otu = vegan::rrarefy(t(species), depth) 
# 筛选大于抽样数量的样本
idx = rowSums(otu) >= depth
# 丢弃的样本列表
# rownames(otu[!idx,])
# 筛选大于抽样数量的样本的特征表
otu = otu[idx,]
## Alpha diversity
# vegan::estimateR计算obs, chao1和ACE指数
estimateR = t(estimateR(otu))[,c(1,2,4)]
colnames(estimateR) = c("richness", "chao1", "ACE")
# vegan::diversity计算多样性指数shannon, simpson和invsimpson
shannon = diversity(otu, index = "shannon")
simpson = diversity(otu, index = "simpson")
invsimpson = diversity(otu, index = "invsimpson")
# 合并6种指数
alpha_div = cbind(estimateR, shannon, simpson, invsimpson)
alpha_div
SampleIDrichnesschao1ACEshannonsimpsoninvsimpson
KO112101439.93364928911433.187711262195.880300426145660.9897546497.6051597991676
KO211981376.439130434781399.752295278345.953815771800230.99172944120.910796850516
KO310511298.85786802031318.908805359785.610281563707250.9884164686.3293949863341
KO410501274.951351351351267.603126124055.629234843598340.9891107491.8336048546917
KO59681152.716417910451191.256558354475.421499508858370.9856085669.4857498624182
KO611181315.31251328.649909572365.807039385046950.99112052112.619207431066

vegan