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
Sample | berger_parker | buzas_gibson | chao1 | dominance | equitability | jost | jost1 | reads | richness | robbins | simpson | shannon_e | shannon_2 | shannon_10 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
KO1 | 0.0584 | 0.0358 | 1211.1 | 0.99 | 0.828 | 172.6 | 357.9 | 10000 | 1210 | 0.258 | 0.0102 | 5.88 | 8.48 | 2.55 |
KO2 | 0.0536 | 0.0385 | 1198.8 | 0.992 | 0.84 | 202.5 | 385.2 | 10000 | 1198 | 0.239 | 0.00827 | 5.95 | 8.59 | 2.59 |
KO3 | 0.0658 | 0.0273 | 1052.3 | 0.988 | 0.806 | 140.1 | 273.2 | 10000 | 1051 | 0.298 | 0.0116 | 5.61 | 8.09 | 2.44 |
KO4 | 0.0598 | 0.0278 | 1051.2 | 0.989 | 0.809 | 145.9 | 278.4 | 10000 | 1050 | 0.275 | 0.0109 | 5.63 | 8.12 | 2.44 |
KO5 | 0.0727 | 0.0226 | 968.9 | 0.986 | 0.789 | 112.6 | 226.2 | 10000 | 968 | 0.282 | 0.0144 | 5.42 | 7.82 | 2.35 |
KO6 | 0.0503 | 0.0333 | 1119 | 0.991 | 0.827 | 179.1 | 332.6 | 10000 | 1118 | 0.256 | 0.00888 | 5.81 | 8.38 | 2.52 |
使用vegan包计算alpha多样性指数
#OTUID | KO1 | KO2 | KO3 | KO4 | KO5 | KO6 | OE1 | OE2 | OE3 | OE4 | OE5 | OE6 | WT1 | WT2 | WT3 | WT4 | WT5 | WT6 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ASV_1 | 382 | 671 | 282 | 438 | 381 | 390 | 476 | 590 | 500 | 360 | 490 | 357 | 799 | 830 | 567 | 664 | 508 | 519 |
ASV_2 | 671 | 412 | 863 | 793 | 1032 | 631 | 245 | 169 | 414 | 440 | 348 | 239 | 440 | 536 | 267 | 386 | 497 | 424 |
ASV_3 | 213 | 173 | 369 | 296 | 445 | 308 | 211 | 151 | 372 | 367 | 316 | 242 | 327 | 635 | 357 | 416 | 413 | 274 |
ASV_4 | 506 | 141 | 181 | 257 | 480 | 178 | 203 | 196 | 134 | 210 | 214 | 129 | 362 | 473 | 196 | 192 | 394 | 290 |
ASV_8 | 189 | 195 | 215 | 148 | 77 | 101 | 132 | 183 | 540 | 300 | 211 | 190 | 230 | 275 | 199 | 356 | 169 | 184 |
ASV_6 | 302 | 232 | 307 | 309 | 490 | 365 | 89 | 95 | 114 | 143 | 134 | 137 | 178 | 191 | 154 | 184 | 158 | 158 |
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
SampleID | richness | chao1 | ACE | shannon | simpson | invsimpson |
---|---|---|---|---|---|---|
KO1 | 1210 | 1439.9336492891 | 1433.18771126219 | 5.88030042614566 | 0.98975464 | 97.6051597991676 |
KO2 | 1198 | 1376.43913043478 | 1399.75229527834 | 5.95381577180023 | 0.99172944 | 120.910796850516 |
KO3 | 1051 | 1298.8578680203 | 1318.90880535978 | 5.61028156370725 | 0.98841646 | 86.3293949863341 |
KO4 | 1050 | 1274.95135135135 | 1267.60312612405 | 5.62923484359834 | 0.98911074 | 91.8336048546917 |
KO5 | 968 | 1152.71641791045 | 1191.25655835447 | 5.42149950885837 | 0.98560856 | 69.4857498624182 |
KO6 | 1118 | 1315.3125 | 1328.64990957236 | 5.80703938504695 | 0.99112052 | 112.619207431066 |