generalized_unifrac | R Documentation |
Generalized UniFrac beta diversity metric.
generalized_unifrac(
counts,
tree = NULL,
alpha = 0.5,
pairs = NULL,
cpus = n_cpus()
)
counts |
An OTU abundance matrix where each column is a sample, and
each row is an OTU. Any object coercible with |
tree |
A |
alpha |
How much weight to give to relative abundances; a value
between 0 and 1, inclusive. Setting |
pairs |
Which combinations of samples should distances be
calculated for? The default value ( |
cpus |
How many parallel processing threads should be used. The
default, |
A dist
object.
Given n
branches with lengths L
, a pair of samples'
abundances (A
and B
) on each of those branches, and
abundance weighting 0 \le \alpha \le 1
:
D = \displaystyle \frac{\sum_{i = 1}^{n} L_i(\frac{A_i}{A_T} + \frac{B_i}{B_T})^{\alpha}|\displaystyle \frac{\frac{A_i}{A_T} - \frac{B_i}{B_T}}{\frac{A_i}{A_T} + \frac{B_i}{B_T}} |}{\sum_{i = 1}^{n} L_i(\frac{A_i}{A_T} + \frac{B_i}{B_T})^{\alpha}}
See vignette('unifrac')
for details and a worked example.
Chen J, Bittinger K, Charlson ES, Hoffmann C, Lewis J, Wu GD, Collman RG, Bushman FD, Li H 2012. Associating microbiome composition with environmental covariates using generalized UniFrac distances. Bioinformatics, 28(16). \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/bioinformatics/bts342")}
Other beta_diversity:
bray_curtis()
,
canberra()
,
euclidean()
,
gower()
,
jaccard()
,
kulczynski()
,
manhattan()
,
unweighted_unifrac()
,
variance_adjusted_unifrac()
,
weighted_normalized_unifrac()
,
weighted_unifrac()
# Example counts matrix
ex_counts
# Generalized UniFrac distance matrix
generalized_unifrac(ex_counts, tree = ex_tree)
# Only calculate distances for A vs all.
generalized_unifrac(ex_counts, tree = ex_tree, pairs = 1:3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.