knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This vignette illustrates the most useful functions of yatah.
library(dplyr) library(yatah)
For this example, we use data from @zeller2014potential. It is the abundances of bacteria present in 199 stool samples.
abundances <- as_tibble(yatah::abundances) print(abundances, max_extra_cols = 2)
taxonomy <- select(abundances, lineages) taxonomy
Here, we have all the present bacteria at all different ranks. As we are just interested in genera that belong to the Gammaproteobacteria class, we filter()
the lineages with is_clade()
and is_rank()
. The genus name is accessible with get_last_clade()
.
gammap_genus <- taxonomy %>% filter(is_clade(lineages, "Gammaproteobacteria"), is_rank(lineages, "genus")) %>% mutate(genus = get_last_clade(lineages)) gammap_genus
It is useful to have a taxonomic table. taxtable()
do the job.
gammaprot_table <- gammap_genus %>% pull(lineages) %>% taxtable() as_tibble(gammaprot_table)
To have a tree, use taxtree()
with a taxonomic table in input. By default, it collapses ranks with only one subrank.
gammaprot_tree <- taxtree(gammaprot_table) gammaprot_tree
plot(gammaprot_tree, show.node.label = TRUE, cex = 0.7, main = "Taxonomy of Gammaproteobacteria")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.