Functionality for extracting specific taxonomic levels (such as genus and species) from a microbe signature containing taxonomic clades in MetaPhlAn format.

extractTaxLevel(
  sig,
  tax.id.type = c("metaphlan", "taxname"),
  tax.level = "mixed",
  exact.tax.level = TRUE
)

Arguments

sig

character. Microbe signature containing taxonomic clades in MetaPhlAn format.

tax.id.type

Character. Taxonomic ID type of the returned microbe sets. Either "metaphlan" (default) or "taxname".

tax.level

character. Either "mixed" or any subset of c("kingdom", "phylum", "class", "order", "family", "genus", "species", "strain"). This full vector is equivalent to "mixed".

exact.tax.level

logical. Should only the exact taxonomic level specified by tax.level be returned? Defaults to TRUE. If FALSE, a more general tax.level is extracted for microbes given at a more specific taxonomic level.

Value

a character vector storing taxonomic clades restricted to chosen taxonomic level(s).

References

BugSigDB: https://bugsigdb.org

Examples


 ord <- "k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales"
 sig <- c("f__Lactobacillaceae|g__Lactobacillus",
          "f__Aerococcaceae|g__Abiotrophia|s__Abiotrophia defectiva",
          "f__Lactobacillaceae|g__Limosilactobacillus|s__Limosilactobacillus mucosae")
 sig <- paste(ord, sig, sep = "|")
 sig <- extractTaxLevel(sig, tax.level = "genus")
 sig <- extractTaxLevel(sig, tax.level = "genus", exact.tax.level = FALSE)
 sig <- extractTaxLevel(sig,
                        tax.id.type = "taxname",
                        tax.level = "genus",
                        exact.tax.level = FALSE)