knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

yatah

version <- as.vector(read.dcf('DESCRIPTION')[, 'Version'])
version <- gsub('-', '.', version)

packageversion R-CMD-check CRAN_Status_Badge

The goal of yatah is to manage taxonomy when lineages are described with strings and ranks separated with special patterns like |*__ or ;*__.

For instance, the well-known Escherichia coli could be coded as k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Enterobacteriales|f__Enterobacteriaceae|g__Escherichia|s__Escherichia_coli.

Installation

You can install the released version of yatah from CRAN with:

install.packages("yatah")

And the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("abichat/yatah")

Example

library(yatah)

yatah handles 8 different ranks:

all_ranks

A lineage is composed of a succession of clades separated by special characters indicating the current rank.

lineages <- c(
  "k__Bacteria|p__Actinobacteria|c__Actinobacteria|o__Coriobacteriales",
  "k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales",
  "k__Bacteria|p__Bacteroidetes|c__Flavobacteriia|o__Flavobacteriales",
  "k__Bacteria|p__Firmicutes|c__Bacilli|o__Bacillales",
  "k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales",
  "k__Bacteria|p__Firmicutes|c__Clostridia|o__Clostridiales",
  "k__Bacteria|p__Proteobacteria|c__Epsilonproteobacteria|o__Campylobacterales",
  "k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Enterobacteriales",
  "k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Pseudomonadales"
)

yatah offers functions to verify if lineages meet a desired property, to extract information, or to compute summary objects.

is_rank(lineages, rank = "order")
is_at_least_rank(lineages, rank = "species")
is_clade(lineages, clade = "Proteobacteria", rank = "phylum")
get_clade(lineages, rank = "class")
get_last_clade(lineages)
get_all_clades(lineages, simplify = TRUE)
table <- taxtable(lineages)
table
tree <- taxtree(table)
tree
plot(tree, show.node.label = TRUE)

Separator

If you want to change the default separator from | to, e.g., ;, use options(yatah_sep = ";"). Reset it with options(yatah_sep = "\\|").



abichat/yatah documentation built on April 14, 2024, 7:25 a.m.