R/gv_distance.R
get_GUniFrac.Rd
A generalized version of commonly used UniFrac distances. The unweighted and weighted UniFrac, and variance-adjusted weighted UniFrac distances are also implemented.
get_GUniFrac(
otu.tab,
tree,
alpha = c(0, 0.5, 1))
(Required). a matrix, an OTU count table, row - n sample, column - q OTU.
(Required). tree. a rooted phylogenetic tree of R class “phylo”.
(optional). numeric. the parameter controlling weight on abundant lineages.
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.
https://github.com/cran/GUniFrac/blob/master/R/GUniFrac.R
if (FALSE) {
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
}