otuCollap: collapse a OTU table at given level.

View source: R/otuCollap.R

otuCollapR Documentation

collapse a OTU table at given level.

Description

The function will collapse a structured OTU table at given taxonomic level.

Usage

otuCollap(otutab, taxto, siteInCol = TRUE, taxhead = "taxonomy",
    pattern = ";", collap = ";")

Arguments

otutab

A OTU table of microbial community, which must contain a taxonomic column (if siteInCol) or row (if site in rows). The otu table can be given in numeric counts or in relative abundance.

taxto

numeric, collapse the otutable at the taxonomic level which start position (index) from the left of taxonomy. For example, in "Archaea; Euryarchaeota; Methanomicrobia; Methanomicrobiales; Methanoregulaceae", the indices of "Euryarchaeota" and "Methanomicrobiales" are 2 and 4, respectively.

siteInCol

Logical, if "TRUE", the OTU table contains samples in columns and taxa in rows. The function will decide whether to transpose the otu table based on this parameter.

taxhead

Character, specify the header of taxonomy. By default we assume your taxonomic column is entitled "taxonomy".

pattern

Character, specify the separation of taxonomy. By default, the taxonomy is separated by semicolon (";").

collap

Character, tell the function about the separation for the hierarchical order in the output.

Details

This function will directly collapse the otu table according to numeric position of structured taxonony. This function can also collapse data with structured format like the example OTU table.

Value

The function will return a collapsed OTU table.

Author(s)

Sizhong Yang <yanglzu@163.com>

See Also

otuReport

Examples


data(otuqiime)
dim(otuqiime)

result <- otuCollap(otutab = otuqiime, taxto = 2, siteInCol = TRUE,
    taxhead = "taxonomy", pattern = ";")

dim(result)


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