library(rbiom)
infile <- system.file("extdata", "hmp50.bz2", package = "rbiom")
biom <- read.biom(infile)
biom <- select(biom, 1:10)
dm <- unifrac(biom)
plot(hclust(dm), cex=.8)
as.matrix(dm)[1:4,1:4]
# Using a custom matrix and tree
mtx <- matrix(sample.int(12*20), ncol=20)
dimnames(mtx) <- list(LETTERS[1:12], letters[1:20])
tree <- ape::as.phylo(hclust(dist(mtx)))
dm <- unifrac(mtx, tree=tree)
as.matrix(dm)[1:4,1:4]
Run the code above in your browser using DataLab