taxonomy_to_qiime: Prepare taxonomy in QIIME-style

View source: R/taxonomy_to_qiime.R

taxonomy_to_qiimeR Documentation

Prepare taxonomy in QIIME-style

Description

This function merges multiple columns with taxonomic ranks into a single string formatted in QIIME style.

Usage

taxonomy_to_qiime(x, dropNA = TRUE, add_OTUID = TRUE, custom_tax_ranks = NULL)

Arguments

x

data.frame or phyloseq with tax_table slot

dropNA

Logical; if TRUE, missing tax ranks will be removed

add_OTUID

Logical; if TRUE, OTU name will be added to the first column of the resulting table

custom_tax_ranks

Data frame with two columns, taxonomic ranks (with the same names as columns in x) and the corresponding single letter abbreviations

Details

If 'add_OTUID = T' and x is data.frame, the function will take OTU names from rownames of a data frame.

Value

character vector (if 'add_OTUID = FALSE') or data.frame with taxonomy annotations.

Examples

# Load data
data("GlobalPatterns")

# Subset data
GP <- metagMisc::phyloseq_filter_top_taxa(GlobalPatterns, n = 20)

# Prepare taxonomy in QIIME-style (result = data frame with 2 columns)
qtax <- taxonomy_to_qiime(GP)
head(qtax)

# Vector with OTU taxonomy
qvec <- taxonomy_to_qiime(GP, add_OTUID = FALSE)
head(qvec)


vmikk/metagMisc documentation built on Feb. 14, 2024, 2:29 a.m.