Skip to contents

Classify taxa in a SQL table to a specific level based on the classification table in the Vault database, or a user-supplied override table.

When to is not "original", a cli warning is emitted to alert the user that the automatic classification workflow may contain errors, and to recommend calling get_classification_table() to inspect it.

Usage

classify_taxa(
  data_source = NULL,
  sel_con = NULL,
  to = c("original", "species", "genus", "family"),
  classification_data = NULL
)

Arguments

data_source

A SQL table that contains taxon_id column.

sel_con

A connection to the Vault database. Required when classification_data is NULL.

to

A character vector that specifies the classification level to classify the taxa. The options are original, species, genus, and family.

classification_data

An optional data.frame (or tibble) to use instead of the TaxonClassification table from the database. Must contain a taxon_id column and the column corresponding to to (i.e. taxon_species, taxon_genus, or taxon_family). If NULL (default), the classification is read from the database. Obtain a valid table via get_classification_table(con, return_raw_data = TRUE).

Value

A SQL table with the classified taxa.