add_alpha()
adds an alpha diversity measures to the sample table of a
tidytacos object.
Arguments
- ta
A tidytacos object.
- method
The diversity measure to use, see
vegan::diversity()
for further information on these.- keep_empty_samples
Whether to keep empty samples or not.
- subsample
Wether to use subsampling to be able to compare samples of varying sequencing depths. Schloss et al., 2023
- ...
Arguments passed on to
add_subsampled_alpha
min_lib_size
the minimum lib size samples need to have. Samples with lower lib sizes will be discarded and samples with a higher readcount will be itteratively subsampled to this readcount to allow for a fair comparison across read_depths.
itterations
the amount of itterations for subsampling. Please report this number in your research.
Details
This function can add different alpha diversity measures to the sample table, specified by the method argument. The following methods are available:
invsimpson: Inverse Simpson index
shannon: Shannon index
simpson: Simpson index
pielou: Pielou's evenness index
obs: Observed richness
s.chao1: Chao1 richness estimator
s.ace: ACE richness estimator
See also
Other sample-modifiers:
add_alphas()
,
add_dominant_taxa()
,
add_metadata()
,
add_ord()
,
add_sample_clustered()
,
add_spike_ratio()
,
add_subsampled_alpha()
,
add_total_absolute_abundance()
,
add_total_count()
,
add_total_density()
,
cluster_samples()
Other diversity-metrics:
add_alphas()
,
add_ord()
,
add_subsampled_alpha()
Examples
# Initiate counts matrix
x <- matrix(
c(1500, 1300, 280, 356),
ncol = 2
)
rownames(x) <- c("taxon1", "taxon2")
colnames(x) <- c("sample1", "sample2")
# Convert to tidytacos object
data <- create_tidytacos(x,
taxa_are_columns = FALSE
)
# Add alpha diversity measures
data <- data %>%
add_alpha()
data <- data %>%
add_alpha(method = "shannon")