Skip to contents

Test if a lineage goes down to a specified rank

Usage

is_rank(lineage, rank = yatah::all_ranks)

is_at_least_rank(lineage, rank = yatah::all_ranks)

Arguments

lineage

string. Vector of lineages.

rank

string. One of c("kingdom", "phylum", "class", "order", "family", "genus", "species", "strain") with partial matching.

Value

logical.

Examples

lineage1 <- "k__Bacteria|p__Verrucomicrobia|c__Verrucomicrobiae"
lineage2 <- "k__Bacteria|p__Firmicutes|c__Clostridia"
is_rank(c(lineage1, lineage2), "class")
#> [1] TRUE TRUE
is_rank(c(lineage1, lineage2), "order")
#> [1] FALSE FALSE
is_at_least_rank(c(lineage1, lineage2), "phylum")
#> [1] TRUE TRUE
is_at_least_rank(c(lineage1, lineage2), "order")
#> [1] FALSE FALSE