pbray: Partition the Bray-Curtis distance dissimilarity

View source: R/pbray.R

pbrayR Documentation

Partition the Bray-Curtis distance dissimilarity

Description

The pbray function partitions the Bray-Curtis distance matrix based on the who community and the subset of the community data.

Usage

pbray(allComm, subComm, tolower = TRUE)

Arguments

allComm

A otu table of microbial community which contains sample in rows and taxa in column. The otu table should not contain a taxonomic column.

subComm

A subset of the otu table, with the same samples as allComm.

tolower

Logical, by default the function returns the lower triangular matrix.

Details

The Bray-Curtis dissimilarity is a scaled summation of abundance differences between two communities, it is thus could be partitioned between two samples attributable to a subset of the community (Shade et al., 2014; Yang et al., 2017). Note, the pbray function requires the input for "allComm" and "subComm" keep consistent either in either counts or relative abundance. If the input for "allComm" and "subComm" are the same data, the function will return the Bray-Curtis matrix for the whole community.

Value

The function returns a distance matrix by using the subset community against the whole community data.

Author(s)

Sizhong Yang <yanglzu@163.com>

References

Shade A, Jones SE, Caporaso JG, Handelsman J, Knight R, Fierer N, and Gilbert JA. Conditionally rare taxa disproportionately contribute to temporal changes in microbial diversity. Mbio, 2014, 5(4): e01371-01314.

Yang S, Winkel M, Wagner D, and Liebner S. Community structure of rare methanogenic archaea: insight from a single functional group. FEMS Microbiology Ecology, 2017: fix126.

See Also

function contrib(), matrixConvert().

Examples

data(otumothur)

subotus <- subOTU(otutab = otumothur, taxhead = "taxonomy", siteInCol = TRUE,
    percent = FALSE, choose = "rare", outype = "counts", sort = FALSE)
pRare <- pbray(allComm = t(otumothur[,-454]), subComm = t(subotus[,-454]))
class(pRare)

# convert to long format data frame

longdist <- matrixConvert(pRare, colname = c("sp1", "sp2", "bray"))

otuSummary documentation built on Sept. 8, 2023, 6:05 p.m.