| estimateDivergence {mia} | R Documentation |
This function estimates a divergence within samples.
estimateDivergence( x, abund_values = "counts", name = "divergence", reference = "median", FUN = vegan::vegdist, method = "bray", ... ) ## S4 method for signature 'SummarizedExperiment' estimateDivergence( x, abund_values = "counts", name = "divergence", reference = "median", FUN = vegan::vegdist, method = "bray", ... )
x |
a |
abund_values |
the name of the assay used for calculation of the sample-wise estimates |
name |
a name for the column of the colData the results should be
stored in. By defaut, |
reference |
a numeric vector that has length equal to number of
features, or a non-empty character value; either 'median' or 'mean'.
|
FUN |
a |
method |
a method that is used to calculate the distance. Method is
passed to the function that is specified by |
... |
optional arguments |
Microbiota divergence (heterogeneity / spread) within a given sample set can be quantified by the average sample dissimilarity or beta diversity with respect to a given reference sample.
This measure is sensitive to sample size. Subsampling or bootstrapping can be applied to equalize sample sizes between comparisons.
x with additional colData named *name*
Leo Lahti and Tuomas Borman. Contact: microbiome.github.io
data(GlobalPatterns)
tse <- GlobalPatterns
# By default, reference is median of all samples. The name of column where results
# is "divergence" by default, but it can be specified.
tse <- estimateDivergence(tse)
# The method that are used to calculate distance in divergence and
# reference can be specified. Here, euclidean distance and dist function from
# stats package are used. Reference is the first sample.
tse <- estimateDivergence(tse, name = "divergence_first_sample",
reference = assays(tse)$counts[,1],
FUN = stats::dist, method = "euclidean")
# Reference can also be median or mean of all samples.
# By default, divergence is calculated by using median. Here, mean is used.
tse <- estimateDivergence(tse, name = "divergence_average", reference = "mean")
# All three divergence results are stored in colData.
colData(tse)