annotate: Annotate a custom taxonomy

View source: R/helper_methods.R

annotateR Documentation

Annotate a custom taxonomy

Description

Annotate a custom taxonomy

Usage

annotate(x, names, new_column, present = "1", absent = NA)

Arguments

x

A tibble with taxonomic data to be annotated.

names

A character vector containing scientific names that will be matched to scientific names in x.

new_column

A string to be the name of a new column that will contain annotations.

present

A string with the annotation in the case of a match (Defaults to "1").

absent

A string with the annotation in case of no match (Defaults to NA).

Details

This method takes as input a character vector with scientific names. If the scientific name(s) in the vector match with scientific names in the tibble, a new column will be created and an annotation of choice will be added to the relevant row in the new column. This method is useful for annotating scientific names with identified ambiguity, duplication or any other characteristic. The character vector could, for example, even contain scientific names that have not been derived with a Taxonbridge method.

Value

A tibble that contains an additional column with annotations.

Examples

sample <- load_sample()
lineages <- get_lineages(sample)
kingdom <- get_validity(lineages, rank = "kingdom", valid = FALSE)
family <- get_validity(lineages, rank = "family", valid = FALSE)
candidates <- list(kingdom, family)
binomials <- get_inconsistencies(candidates, uninomials = FALSE, set = "intersect")
x <- annotate(sample, binomials, new_column = "inconsistencies", "Accepted but ambigious")
x[!is.na(x$inconsistencies),c("inconsistencies")]

MoultDB/moultdbtools documentation built on Feb. 2, 2024, 5:21 p.m.