Skip to contents

Extract the clade of a desired rank in a lineage

Usage

get_clade(lineage, rank = yatah::all_ranks, same = TRUE)

Arguments

lineage

string. Vector of lineages.

rank

The desired rank of the clade.

same

logical. Does the lineage have the same depth? Default to TRUE.

Value

A string.

Examples

lineage1 <- "k__Bacteria|p__Verrucomicrobia|c__Verrucomicrobiae"
lineage2 <- "k__Bacteria|p__Firmicutes|c__Clostridia"
get_clade(c(lineage1, lineage2), "phylum")
#> [1] "Verrucomicrobia" "Firmicutes"