Learn R Programming

yatah (version 1.0.0)

trim_rank: Trim lineages until a specified rank

Description

Trim lineages until a specified rank

Usage

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

Value

The trimmed lineages. Depth could be different among them.

Arguments

lineage

string. Vector of lineages.

rank

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

same

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

Details

Returns NA if a lineage is not as deep as the specified rank.

Examples

Run this code
lineage1 <- "k__Bacteria|p__Verrucomicrobia|c__Verrucomicrobiae"
lineage2 <- "k__Bacteria|p__Firmicutes|c__Clostridia"
trim_rank(c(lineage1, lineage2), rank = "phylum")
trim_rank(c(lineage1, lineage2), rank = "genus")

Run the code above in your browser using DataLab