tax_name | R Documentation |
If your current taxa_names aren't what you want (e.g. they are long DNA sequences), this function will help you set sensible unique names.
It combines:
a prefix like tax, asv, or otu (pick an appropriate prefix or set your own)
a unique (sequential) number
classification information from a chosen taxonomic rank (optional)
tax_name(
ps,
prefix = c("tax", "asv", "otu")[1],
rank = NA,
pad_number = TRUE,
sep = "_"
)
ps |
phyloseq object |
prefix |
e.g. 'tax', 'asv', or 'otu' (or set your own) |
rank |
name of taxonomic rank from which to use classifications in new names |
pad_number |
should unique numbers have zeros added to the front (e.g. 001, 002) to be made the same number of characters? |
sep |
character to separate the unique number and any taxonomic classification info (relevant if rank given) |
Don't confuse this with the phyloseq function taxa_names()
or the newer
microViz function tax_rename()
.
phyloseq object
tax_rename
for a more informative taxon naming tool
phyloseq::taxa_names
for accessing and manually setting names
library(phyloseq)
# get example data
data("enterotype")
ps <- enterotype
head(taxa_names(ps)) # these are mostly fine (except the -1), but imagine you wanted new names
# consider storing the original names for reference (e.g. if they are DNA sequences)
old_taxa_names <- taxa_names(ps)
ps <- tax_name(ps)
taxa_names(ps) %>% head()
# probably better to include the genus info to make these names more informative
ps <- tax_name(ps, rank = "Genus")
taxa_names(ps) %>% head()
# store new names with old names in dataframe for reference
names_df <- tibble::tibble(old = old_taxa_names, new = taxa_names(ps))
# alternative settings
tax_name(ps, pad_number = FALSE) %>%
taxa_names() %>%
head()
tax_name(ps, prefix = "whateveryoulike") %>%
taxa_names() %>%
head()
tax_name(ps, rank = "Genus", sep = "-") %>%
taxa_names() %>%
head()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.