addDivergence | R Documentation |
Estimate divergence against a given reference sample.
addDivergence(
x,
assay.type = assay_name,
assay_name = "counts",
name = "divergence",
reference = "median",
FUN = vegan::vegdist,
method = "bray",
...
)
## S4 method for signature 'SummarizedExperiment'
addDivergence(
x,
assay.type = assay_name,
assay_name = "counts",
name = "divergence",
reference = "median",
FUN = vegan::vegdist,
method = "bray",
...
)
x |
a |
assay.type |
the name of the assay used for calculation of the sample-wise estimates. |
assay_name |
a single |
name |
a name for the column of the colData the results should be
stored in. By default, |
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*
plotColData
estimateRichness
estimateEvenness
estimateDominance
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 <- addDivergence(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 <- addDivergence(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 <- addDivergence(tse, name = "divergence_average", reference = "mean")
# All three divergence results are stored in colData.
colData(tse)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.