make_taxa_labels: Create a Label for Each Taxon

View source: R/helpers.R

make_taxa_labelsR Documentation

Create a Label for Each Taxon

Description

This function takes a table of taxonomic ranks, such as that stored in the tax_table slot of a phyloseq object, and creates a label for each taxon for use in plots and tables.

Usage

make_taxa_labels(taxtab)

Arguments

taxtab

A matrix or data frame, with taxa in rows and taxonoic ranks in columns. The last column should be “Species”, the first column should be kingdom or domain, and columns in between should progress in order of rank.

Details

Species labels that pass findnonmissing are used, and otherwise species are labeled “"sp."”. The lowest rank that passes findnonmissing is pasted before the species label.

Value

A character vector containing the labels. If taxtab has row names, these are used to name the vector.

Author(s)

Lindsay V. Clark

Examples

tt <- matrix(c("Bacteria", "Firmicutes", "Clostridia",
               "Peptostreptococcales-Tissierellales", "Anaerovoracaceae",
               "Mogibacterium", "Unclassified",
               "Bacteria", "Firmicutes", "Clostridia", "Oscillospirales",
               "Ruminococcaceae", "Faecalibacterium", "prausnitzii",
               "Bacteria", "Firmicutes", "Clostridia",
               "Clostridia vadinBB60 group", "Unclassified", "Unclassified",
               "Unclassified"),
               nrow = 3, ncol = 7, byrow = TRUE,
               dimnames = list(c("db3b201de3a824d7356ce4d8360e5bc3",
                                 "615ce01e68e098adc445d06e072ba255",
                                 "6f643e7faeab3e737b38f5304b841d97"),
                               c("Kingdom", "Phylum", "Class", "Order",
                                 "Family", "Genus", "Species")))

make_taxa_labels(tt)

HPCBio/plotly_microbiome documentation built on May 9, 2022, 11:37 p.m.