-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
124 lines (91 loc) · 3.59 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# yatah <a href='https://abichat.github.io/yatah/'><img src='man/figures/logo.png' align="right" height="139" /></a>
<!-- badges: start -->
```{r, echo = FALSE}
version <- as.vector(read.dcf('DESCRIPTION')[, 'Version'])
version <- gsub('-', '.', version)
```
![packageversion](https://img.shields.io/badge/version-`r version`-orange.svg)
[![R-CMD-check](https://github.com/abichat/yatah/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/abichat/yatah/actions/workflows/R-CMD-check.yaml)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/yatah)](https://cran.r-project.org/package=yatah)
<!-- badges: end -->
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](https://CRAN.R-project.org) with:
``` r
install.packages("yatah")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("abichat/yatah")
```
## Example
```{r}
library(yatah)
```
**yatah** handles 8 different ranks:
```{r}
all_ranks
```
A _lineage_ is composed of a succession of clades separated by special characters indicating the current rank.
```{r}
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()` and `is_at_least_rank()` check if the lineages are of the desired rank.
```{r is_rank}
is_rank(lineages, rank = "order")
is_at_least_rank(lineages, rank = "species")
```
* `is_clade()` checks if the lineages belong to the desired clade.
```{r is_clade}
is_clade(lineages, clade = "Proteobacteria", rank = "phylum")
```
* `get_clade()` extracts the clade of the desired rank.
```{r}
get_clade(lineages, rank = "class")
```
* `get_last_clade()` extracts the last clade of the lineages.
```{r get_last_clade}
get_last_clade(lineages)
```
* `get_all_clades()` extracts all clades of the lineages.
```{r get_all_clades}
get_all_clades(lineages, simplify = TRUE)
```
* `taxtable()` computes the taxonomic table corresponding to the lineages.
```{r taxtable}
table <- taxtable(lineages)
table
```
* `taxtree()` computes the taxonomic tree (format `phylo`) from a taxonomic table.
```{r taxtree}
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 = "\\|")`.