Get organism taxonomy (Open Tree of Life Taxonomy)

Description

This function retrieves taxonomic information from the Open Tree of Life (OTT) taxonomy service. It cleans organism names, queries the OTT API, and returns structured taxonomic data including OTT IDs and hierarchical classifications.

Usage

get_organism_taxonomy_ott(
  df,
  url = "https://api.opentreeoflife.org/v3/taxonomy/about",
  retry = TRUE
)

Arguments

df Data frame containing organism names in a column named "organism"
url Character string URL of the OTT API endpoint (default: production API, can be changed for testing)
retry Logical indicating whether to retry failed queries using only the generic epithet (genus name) when full species names fail (default: TRUE)

Value

Data frame with taxonomic information including OTT IDs, ranks, and taxonomic hierarchy. Returns empty template if API is unavailable.

Examples

library("tima")

# Single organism
df <- data.frame(organism = "Homo sapiens")
taxonomy <- get_organism_taxonomy_ott(df)

# Multiple organisms
df <- data.frame(organism = c("Homo sapiens", "Arabidopsis thaliana"))
taxonomy <- get_organism_taxonomy_ott(df)