Alpha diversity wrapper
Arguments
- counts
An OTU abundance matrix where each column is a sample, and each row is an OTU. Any object coercible with
as.matrix()
can be given here, as well asphyloseq
,rbiom
,SummarizedExperiment
, andTreeSummarizedExperiment
objects.- metric
The name of an alpha diversity metric. Current options are
c('observed', 'chao1', 'shannon', 'simpson', 'inv_simpson', 'faith')
. Case-insensitive and partial name matching is supported. Options are also available vianames(metrics$alpha)
.- ...
Additional options to pass through to the called function. I.e.
cpus
ortree
.
Examples
# Example counts matrix
ex_counts
#> Saliva Gums Nose Stool
#> Streptococcus 162 793 22 1
#> Bacteroides 2 4 2 611
#> Corynebacterium 0 0 498 1
#> Haemophilus 180 87 2 1
#> Propionibacterium 1 1 251 0
#> Staphylococcus 0 1 236 1
# Shannon diversity values
alpha_div(ex_counts, 'Shannon')
#> Saliva Gums Nose Stool
#> 0.74119910 0.36684449 1.14222899 0.04824952
# Chao1 diversity values
alpha_div(ex_counts, 'c')
#> Saliva Gums Nose Stool
#> 4.5 Inf 6.0 Inf
# Faith PD values
alpha_div(ex_counts, 'faith', tree = ex_tree)
#> Saliva Gums Nose Stool
#> 180 191 215 202