alpha.div {rbiom}R Documentation

Estimate the diversity of each sample.

Description

Estimate the diversity of each sample.

Usage

alpha.div(biom, rarefy = FALSE)

Arguments

biom

A matrix, simple_triplet_matrix, or BIOM object, as returned from read.biom. For matrices, the rows and columns are assumed to be the taxa and samples, respectively.

rarefy

Control how/whether rarefactions are done prior to alpha diversity computations. Options are:

FALSE

Use each sample's current set of observations without applying any rarefaction. (Default)

TRUE

Automatically select and apply a single rarefaction.

"multi"

Automatically select and apply multiple rarefactions.

integer vector

Rarefy at the specified depth(s).

Value

A data frame of four diversity values for each sample in biom. The column names are Sample, Depth and the diversity metrics: OTUs, Shannon, Chao1, Simpson, and InvSimpson. The row names are the sample names, except when multiple rarefactions are done.

Examples

    library(rbiom)
    
    infile <- system.file("extdata", "hmp50.bz2", package = "rbiom")
    biom <- read.biom(infile)
    
    ad <- alpha.div(biom)
    head(ad)
    
    biom <- subset(biom, `Body Site` == "Saliva" & Age < 26)
    ad   <- alpha.div(biom, "multi")
    boxplot(Shannon ~ Depth, data=ad, xlab="Reads", ylab="Diversity")
    

[Package rbiom version 1.0.3 Index]