get_GUniFrac: Generalized UniFrac distances for comparing microbial...

View source: R/gv_distance.R

get_GUniFracR Documentation

Generalized UniFrac distances for comparing microbial communities

Description

A generalized version of commonly used UniFrac distances. The unweighted and weighted UniFrac, and variance-adjusted weighted UniFrac distances are also implemented.

Usage

get_GUniFrac(
   otu.tab,
   tree,
   alpha = c(0, 0.5, 1))

Arguments

otu.tab

(Required). a matrix, an OTU count table, row - n sample, column - q OTU.

tree

(Required). tree. a rooted phylogenetic tree of R class “phylo”.

alpha

(optional). numeric. the parameter controlling weight on abundant lineages.

Value

a three dimensional array containing all the UniFrac distance matrices.

unifracs: three dimensional array containing the generalized UniFrac distances, unweighted UniFrac distance and variance adjusted UniFrac distances.

Author(s)

Created by Jun Chen; modified by Hua Zou (5/14/2022 Shenzhen China)

References

https://github.com/cran/GUniFrac/blob/master/R/GUniFrac.R

Examples


## Not run: 
data("cid_ying")
otu.tab <- phyloseq::otu_table(cid_ying)
tree <- phyloseq::phy_tree(cid_ying)

unifracs <- get_GUniFrac(otu.tab, tree, alpha=c(0, 0.5, 1))$unifracs

dw <- unifracs[, , "d_1"]    # Weighted UniFrac
du <- unifracs[, , "d_UW"]   # Unweighted UniFrac
dv <- unifracs[, , "d_VAW"]  # Variance adjusted weighted UniFrac
d0 <- unifracs[, , "d_0"]    # GUniFrac with alpha 0
d5 <- unifracs[, , "d_0.5"]  # GUniFrac with alpha 0.5


## End(Not run)


HuaZou/MicrobiomeAnalysis documentation built on May 13, 2024, 11:10 a.m.