beta.div: Make a distance matrix of samples vs samples.

Description Usage Arguments Value Examples

Description

Make a distance matrix of samples vs samples.

Usage

1
beta.div(biom, method, weighted = TRUE, tree = NULL)

Arguments

biom

A matrix, simple_triplet_matrix, or BIOM object, as returned from read.biom. For matrices, the rows and columns are assumed to be the taxa and samples, respectively.

method

The distance algorithm to use. Options are: “manhattan”, “euclidean”, “bray-curtis”, “jaccard”, and “unifrac”. Non-ambiguous abbrevations of the method names are also accepted. A phylogentic tree must be present in biom or explicitly provided via tree= to use the UniFrac methods.

weighted

Take relative abundances into account. When weighted=FALSE, only presence/absence is considered.

tree

A phylo object representing the phylogenetic relationships of the taxa in biom. Will be taken from the tree embedded in the biom object if not explicitly specified. Only required for computing UniFrac distance matrices.

Value

A distance matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    library(rbiom)
    
    infile <- system.file("extdata", "hmp50.bz2", package = "rbiom")
    biom <- read.biom(infile)
    biom <- select(biom, 1:10)
    
    dm <- beta.div(biom, 'unifrac')
    
    as.matrix(dm)[1:4,1:4]
    plot(hclust(dm))

rbiom documentation built on Nov. 5, 2021, 9:11 a.m.