Learn R Programming

tidyMicro (version 1.47)

alpha_div: Alpha Diversity Calculations for tidy_micro

Description

A wrapper function to calculate Sobs, Choa1, Goods, Shannon's diversity and evenness, and Simpson's diversity and evenness alpha diversities for your micro_set. Estimates are calculated based on rarefied bootstrapped samples

Usage

alpha_div(micro_set, table = NULL, iter = 100, min_depth = 0, min_goods = 0)

Arguments

micro_set

A tidy_micro data set

table

OTU table of interest

iter

The number of bootstrap resamples used for estimation

min_depth

Filter out libraries with sequencing depth (Total) below min_depth

min_goods

Filter out libraries Good's coverage below min_goods

Value

A tidy_micro set with alpha diversity columns added in to the left of clinical data

Details

If you have multiple otu tables, you can specify the table you'd like to use to calculate your alpha diversities using the table option. We highly recommend using the lowest taxonomic rank available to calculate your alpha diversity. If you would like to calculate alpha diversities for each otu table in your micro_set, you can leave the table option as NULL and the function will calculate the alpha diversity for each table. The function will append the estimated alpha diversities to the tidy_micro supplied. The alpha diversity columns will be just before your clinical data. Since alpha diversity is estimated for each individual library (Lib), it will be repeated within each taxa block.

Examples

Run this code
# NOT RUN {
data(bpd_phy); data(bpd_cla); data(bpd_ord); data(bpd_fam); data(bpd_clin)
otu_tabs = list(Phylum = bpd_phy, Class = bpd_cla,
Order = bpd_ord, Family = bpd_fam)

set <- tidy_micro(otu_tabs = otu_tabs, clinical = bpd_clin) %>%
filter(day == 7) ## Only including the first week

# }
# NOT RUN {
## calculate alpha diversity for every table
set_alpha <- set %>% alpha_div(min_depth = 5000, min_goods = 90)

## calculate alpha diversity for a specific table
set_fam_alpha <- set %>% alpha_div(table = "Family", min_depth = 5000, min_goods = 90)
# }

Run the code above in your browser using DataLab