Skip to contents

Test if a lineage belongs to a clade

Usage

is_clade(lineage, clade, rank = c(".", yatah::all_ranks))

Arguments

lineage

string. Vector of lineages.

clade

string.

rank

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

Value

logical.

Details

If rank is set to ., clade is looked for among all ranks.

Examples

lineage1 <- "k__Bacteria|p__Verrucomicrobia|c__Verrucomicrobiae"
lineage2 <- "k__Bacteria|p__Firmicutes|c__Clostridia"
is_clade(c(lineage1, lineage2), clade = "Verrucomicrobia", rank = "phylum")
#> [1]  TRUE FALSE
is_clade(c(lineage1, lineage2), clade = "Clostridia")
#> [1] FALSE  TRUE