calculateUnifrac | R Documentation |
This function calculates the (Fast) Unifrac distance for all sample-pairs
in a TreeSummarizedExperiment
object.
calculateUnifrac(x, tree, ...)
## S4 method for signature 'ANY,phylo'
calculateUnifrac(
x,
tree,
weighted = FALSE,
normalized = TRUE,
BPPARAM = SerialParam(),
...
)
## S4 method for signature 'TreeSummarizedExperiment,missing'
calculateUnifrac(
x,
assay.type = assay_name,
assay_name = exprs_values,
exprs_values = "counts",
tree_name = "phylo",
transposed = FALSE,
...
)
runUnifrac(
x,
tree,
weighted = FALSE,
normalized = TRUE,
nodeLab = NULL,
BPPARAM = SerialParam(),
...
)
x |
a numeric matrix or a
Please note that |
tree |
if |
... |
optional arguments not used. |
weighted |
|
normalized |
|
BPPARAM |
A
|
assay.type |
a single |
assay_name |
a single |
exprs_values |
a single |
tree_name |
a single |
transposed |
Logical scalar, is x transposed with cells in rows, i.e.,
is Unifrac distance calculated based on rows (FALSE) or columns (TRUE).
(By default: |
nodeLab |
if |
Please note that if calculateUnifrac
is used as a FUN
for
runMDS
, the argument ntop
has to be set to nrow(x)
.
a sample-by-sample distance matrix, suitable for NMDS, etc.
Paul J. McMurdie. Adapted for mia by Felix G.M. Ernst
http://bmf.colorado.edu/unifrac/
The main implementation (Fast Unifrac) is adapted from the algorithm's description in:
Hamady, Lozupone, and Knight, “Fast UniFrac: facilitating high-throughput phylogenetic analyses of microbial communities including analysis of pyrosequencing and PhyloChip data.” The ISME Journal (2010) 4, 17–27.
See also additional descriptions of Unifrac in the following articles:
Lozupone, Hamady and Knight, “Unifrac - An Online Tool for Comparing Microbial Community Diversity in a Phylogenetic Context.”, BMC Bioinformatics 2006, 7:371
Lozupone, Hamady, Kelley and Knight, “Quantitative and qualitative (beta) diversity measures lead to different insights into factors that structure microbial communities.” Appl Environ Microbiol. 2007
Lozupone C, Knight R. “Unifrac: a new phylogenetic method for comparing microbial communities.” Appl Environ Microbiol. 2005 71 (12):8228-35.
data(esophagus)
library(scater)
calculateUnifrac(esophagus, weighted = FALSE)
calculateUnifrac(esophagus, weighted = TRUE)
calculateUnifrac(esophagus, weighted = TRUE, normalized = FALSE)
# for using calculateUnifrac in conjunction with runMDS the tree argument
# has to be given separately. In addition, subsetting using ntop must
# be disabled
esophagus <- runMDS(esophagus, FUN = calculateUnifrac, name = "Unifrac",
tree = rowTree(esophagus),
exprs_values = "counts",
ntop = nrow(esophagus))
reducedDim(esophagus)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.