R/getSignatures.R
extractTaxLevel.RdFunctionality 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
)character. Microbe signature containing taxonomic clades in MetaPhlAn format.
Character. Taxonomic ID type of the returned microbe
sets.
Either "metaphlan" (default) or "taxname".
character. Either "mixed" or any subset of
c("kingdom", "phylum", "class", "order", "family", "genus", "species",
"strain"). This full vector is equivalent to "mixed".
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.
a character vector storing taxonomic clades restricted to chosen taxonomic level(s).
BugSigDB: https://bugsigdb.org
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)