simplify_taxo: Simplify taxonomy by removing some unused characters such as...

View source: R/miscellanous.R

simplify_taxoR Documentation

Simplify taxonomy by removing some unused characters such as "k__"

Description

lifecycle-maturing

Internally used in clean_pq()

Usage

simplify_taxo(
  physeq,
  pattern_to_remove = c(".__", ".*:"),
  remove_space = TRUE,
  remove_NA = FALSE
)

Arguments

physeq

(required): a phyloseq-class object obtained using the phyloseq package.

pattern_to_remove

(a vector of character) the pattern to remove using base::gsub() function.

remove_space

(logical; default TRUE): do we remove space?

remove_NA

(logical; default FALSE): do we remove NA (in majuscule)?

Value

A phyloseq-class object with simplified taxonomy

Author(s)

Adrien Taudière

Examples

d_fm <- data_fungi_mini
d_fm@tax_table[, "Species"] <- paste0(rep(
  c("s__", "s:"),
  ntaxa(d_fm) / 2
), d_fm@tax_table[, "Species"])

# First column is the new vector of Species,
# second column is the column before simplification
cbind(
  simplify_taxo(d_fm)@tax_table[, "Species"],
  d_fm@tax_table[, "Species"]
)
cbind(
  simplify_taxo(d_fm, remove_NA = TRUE)@tax_table[, "Species"],
  d_fm@tax_table[, "Species"]
)

adrientaudiere/MiscMetabar documentation built on Feb. 7, 2025, 5:47 p.m.