| Title: | Taxonomic Name Resolution and Validation Tools |
|---|---|
| Description: | Provides reproducible tools for cleaning, parsing, classifying, standardising, validating and resolving scientific names in ecological and biodiversity datasets. Taxonomic matches can be assessed for match quality and taxonomic status, records requiring manual review can be identified, and resolution results can be summarised, reported and exported. Taxonomic name resolution can use the 'GBIF' species matching service and the GBIF Backbone Taxonomy described by GBIF Secretariat (2023) <doi:10.15468/39omei>. |
| Authors: | Patricio R. De los Ríos-Escalante [aut, cre] (ORCID: <https://orcid.org/0000-0001-5056-7003>) |
| Maintainer: | Patricio R. De los Ríos-Escalante <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-09-22 10:00:09 UTC |
| Source: | https://github.com/prdelosriosescalante/taxresolver |
Classifies taxonomic resolutions returned by resolve_taxonomy()
according to resolution status, match quality, and taxonomic
acceptance status.
assess_taxonomic_match(x)assess_taxonomic_match(x)
x |
A data frame containing taxonomic resolution results,
typically returned by |
Resolution status distinguishes names that were successfully resolved, names that were queried but could not be resolved, and inputs that were not suitable for an external taxonomic query.
Match quality is assessed independently. Exact successful matches
are classified as "high", successful non-exact matches as
"moderate", successful matches lacking match-type information as
"low", and queried but unresolved names as "unresolved".
Taxonomic acceptance status is assessed separately from match
quality. Resolved names with taxonomic status "ACCEPTED" are
classified as "accepted", synonyms as "not_accepted", and
other non-missing taxonomic statuses as "uncertain".
Queried but unresolved names are classified as "unresolved".
Inputs that were not queryable receive "not_queryable" as their
resolution status and NA for match quality and taxonomic
acceptance status.
The input data frame with three additional character columns:
resolution_status, match_quality, and accepted_status.
x <- data.frame( query_name = c( "Homo sapiens", "Homo sapens", "Unknown species", NA_character_ ), taxonomic_status = c( "ACCEPTED", "ACCEPTED", NA_character_, NA_character_ ), match_type = c( "EXACT", "VARIANT", NA_character_, NA_character_ ), resolution_success = c( TRUE, TRUE, FALSE, FALSE ), stringsAsFactors = FALSE ) assess_taxonomic_match(x)x <- data.frame( query_name = c( "Homo sapiens", "Homo sapens", "Unknown species", NA_character_ ), taxonomic_status = c( "ACCEPTED", "ACCEPTED", NA_character_, NA_character_ ), match_type = c( "EXACT", "VARIANT", NA_character_, NA_character_ ), resolution_success = c( TRUE, TRUE, FALSE, FALSE ), stringsAsFactors = FALSE ) assess_taxonomic_match(x)
Classifies scientific names according to their structural status after cleaning, parsing, and standardization.
classify_scientific_names(x)classify_scientific_names(x)
x |
Character vector containing scientific names. |
The function uses the existing TaxResolveR workflow to distinguish successfully parsed taxonomic names, genus-level placeholders, genus-only names, missing values, empty strings, and names that could not be parsed.
Structural classification does not constitute taxonomic validation.
In particular, the status valid_structure indicates that the
name has a syntactic structure recognised by TaxResolveR. It does
not indicate that the taxon exists, that the name is currently
accepted, or that it has been verified against an external
taxonomic authority.
A data.frame with one row per input name and the following columns:
Original input supplied by the user.
Name after internal cleaning and formatting.
Parsed genus name.
Parsed specific epithet.
Explicit infraspecific rank, when present.
Parsed infraspecific epithet.
Taxonomic structure detected by the parser.
Canonical name reconstructed from parsed components.
Logical value indicating successful syntactic parsing.
Structural classification assigned to the input name.
Possible values of name_status are:
valid_structureA species or supported infraspecific name was successfully parsed.
placeholderA genus-level placeholder using sp. was detected.
genus_onlyA genus name without a specific epithet was detected.
missingThe original input was a missing value.
emptyThe input was empty or contained only whitespace after cleaning.
unparsedA non-empty input could not be interpreted by the parser.
classify_scientific_names(c( "Homo sapiens", "Chilina sp.", "Chilina", "Parastacus brasiliensis subsp. promatensis", NA_character_, "", "12345" ))classify_scientific_names(c( "Homo sapiens", "Chilina sp.", "Chilina", "Parastacus brasiliensis subsp. promatensis", NA_character_, "", "12345" ))
Standardises the format of scientific names before taxonomic validation or external database queries.
clean_scientific_names(x)clean_scientific_names(x)
x |
Character vector containing scientific names. |
Missing values are preserved as missing values.
A cleaned character vector.
clean_scientific_names(c( " homo sapiens ", "Panthera\tleo", "Chilina sp .", NA_character_ ))clean_scientific_names(c( " homo sapiens ", "Panthera\tleo", "Chilina sp .", NA_character_ ))
Exports the results of a TaxResolveR taxonomic resolution workflow to a set of standardised CSV files.
export_taxonomic_results(x, path, overwrite = FALSE)export_taxonomic_results(x, path, overwrite = FALSE)
x |
A data frame containing taxonomic resolution results. Typically,
this is the object returned by |
path |
A single non-empty character string specifying the directory where the CSV files will be written. If the directory does not exist, it is created recursively. |
overwrite |
A single non-missing logical value indicating whether
existing TaxResolveR output files should be replaced. The default is
|
The function writes the complete input data frame together with summary tables describing overall taxonomic resolution, resolution status, match quality, and reasons for manual taxonomic review.
Existing output files are not overwritten unless overwrite = TRUE.
Files unrelated to TaxResolveR are never removed or modified.
Invisibly returns a named character vector containing the normalised paths of the five exported CSV files:
Complete taxonomic resolution results.
Overall taxonomic resolution summary.
Counts and proportions by resolution status.
Counts and proportions by match quality.
Counts and proportions by manual review reason.
x <- data.frame( resolution_status = c( "resolved", "resolved", "not_queryable" ), match_quality = c( "high", "moderate", NA ), accepted_status = c( "accepted", "accepted", NA ), review_required = c( FALSE, TRUE, TRUE ), review_reason = c( NA, "non_exact_match", "not_queryable" ), stringsAsFactors = FALSE ) output_dir <- tempfile( "TaxResolveR_example_" ) paths <- export_taxonomic_results( x, path = output_dir ) names(paths) unlink( output_dir, recursive = TRUE, force = TRUE )x <- data.frame( resolution_status = c( "resolved", "resolved", "not_queryable" ), match_quality = c( "high", "moderate", NA ), accepted_status = c( "accepted", "accepted", NA ), review_required = c( FALSE, TRUE, TRUE ), review_reason = c( NA, "non_exact_match", "not_queryable" ), stringsAsFactors = FALSE ) output_dir <- tempfile( "TaxResolveR_example_" ) paths <- export_taxonomic_results( x, path = output_dir ) names(paths) unlink( output_dir, recursive = TRUE, force = TRUE )
Identifies taxonomic resolution records that should be reviewed manually based on resolution status, match quality, and taxonomic acceptance status.
flag_taxonomic_review(x)flag_taxonomic_review(x)
x |
A data frame containing taxonomic assessment results,
typically returned by |
Records representing resolved, high-quality, accepted taxonomic matches are not flagged. Non-exact matches, low-information matches, unresolved names, non-queryable inputs, synonyms, uncertain taxonomic statuses, and records with insufficient assessment information are flagged for review.
The input data frame with two additional columns:
review_required, a logical vector indicating whether manual
review is recommended, and review_reason, a character vector
describing the primary reason for review.
x <- data.frame( resolution_status = c( "resolved", "resolved", "resolved", "unresolved" ), match_quality = c( "high", "moderate", "high", "unresolved" ), accepted_status = c( "accepted", "accepted", "not_accepted", "unresolved" ), stringsAsFactors = FALSE ) flag_taxonomic_review(x)x <- data.frame( resolution_status = c( "resolved", "resolved", "resolved", "unresolved" ), match_quality = c( "high", "moderate", "high", "unresolved" ), accepted_status = c( "accepted", "accepted", "not_accepted", "unresolved" ), stringsAsFactors = FALSE ) flag_taxonomic_review(x)
Parses scientific names into their main taxonomic components.
parse_scientific_names(x)parse_scientific_names(x)
x |
Character vector containing scientific names. |
The function recognises genus names, binomial species names, simple infraspecific names, explicit subspecies names, genus-level placeholders using "sp.", and missing values.
A data.frame containing the original name, genus, specific epithet, infraspecific rank, infraspecific epithet, and detected rank.
parse_scientific_names(c( "Homo sapiens", "Chilina sp.", "Chilina", "Parastacus brasiliensis promatensis", "Parastacus brasiliensis subsp. promatensis", NA ))parse_scientific_names(c( "Homo sapiens", "Chilina sp.", "Chilina", "Parastacus brasiliensis promatensis", "Parastacus brasiliensis subsp. promatensis", NA ))
Prepares scientific names for subsequent queries to external taxonomic authorities.
prepare_taxonomic_queries(x)prepare_taxonomic_queries(x)
x |
Character vector containing scientific names. |
The function uses the structural classification generated by
classify_scientific_names() to determine the appropriate
name to submit to an external taxonomic authority.
Species and supported infraspecific names are queried using their
canonical names. Genus-only names are queried using the genus.
Genus-level placeholders such as "Chilina sp." are reduced
to the corresponding genus name.
Missing, empty, and unparsed inputs are not considered suitable
for external taxonomic queries and therefore receive NA
as their query value.
This function prepares taxonomic queries only. It does not communicate with GBIF, WoRMS, Catalogue of Life, or any other external taxonomic authority.
The function distinguishes between the name originally supplied
by the user and the name prepared for an external query. For
example, "Chilina sp." is preserved as the original name,
while its query is prepared as "Chilina". This avoids
treating an identification at genus level as if it represented
a species-level scientific name.
A value of TRUE in query_ready means only that
TaxResolveR was able to construct a syntactically suitable query.
It does not imply that the taxon exists, that the name is
taxonomically accepted, or that an external authority will return
a match.
A data.frame with one row per input name. The output
contains all columns generated by
classify_scientific_names(), together with:
Character value containing the scientific name that should
be submitted to an external taxonomic authority. Unsuitable
inputs receive NA.
Logical value indicating whether a suitable taxonomic query could be generated.
prepare_taxonomic_queries(c( "Homo sapiens", "Chilina sp.", "Chilina", "Parastacus brasiliensis subsp. promatensis", NA_character_, "", "12345" ))prepare_taxonomic_queries(c( "Homo sapiens", "Chilina sp.", "Chilina", "Parastacus brasiliensis subsp. promatensis", NA_character_, "", "12345" ))
Resolves scientific names against a supported external taxonomic source and returns the results using the standard TaxResolveR taxonomic result structure.
resolve_taxonomy(x, source = "gbif")resolve_taxonomy(x, source = "gbif")
x |
Character vector containing scientific names. |
source |
Character string specifying the taxonomic source.
Currently, |
Names are first prepared using the TaxResolveR scientific-name workflow. Only names considered suitable for external taxonomic queries are submitted to the selected backend.
Duplicate query names are resolved only once by the corresponding backend and are subsequently restored to their original positions.
A data frame containing one taxonomic resolution result for each input value.
resolve_taxonomy( c( "Homo sapiens", "Chilina", "Parastacus brasiliensis" ) ) resolve_taxonomy( c( " homo sapiens ", " chilina ", NA_character_ ), source = "gbif" )resolve_taxonomy( c( "Homo sapiens", "Chilina", "Parastacus brasiliensis" ) ) resolve_taxonomy( c( " homo sapiens ", " chilina ", NA_character_ ), source = "gbif" )
Cleans and parses scientific names into a standardized taxonomic representation suitable for subsequent taxonomic resolution.
standardize_scientific_names(x)standardize_scientific_names(x)
x |
Character vector containing scientific names. |
The function preserves the original input, generates a cleaned version of each name, extracts supported taxonomic components, reconstructs a canonical scientific name, and reports whether the name was successfully parsed.
Supported structures currently include genus names, genus-level
placeholders using sp., binomial species names, simple
trinomial names, and explicit infraspecific ranks using
subsp., var., and f..
The parse_success field indicates whether TaxResolveR
successfully interpreted the syntactic structure of the name.
It does not indicate whether the taxon exists, whether the name
is currently accepted, or whether it has been verified against
an external taxonomic authority.
A data.frame with one row per input name and the following columns:
Original input supplied by the user.
Name after internal cleaning and formatting.
Parsed genus name.
Parsed specific epithet.
Explicit infraspecific rank, when present.
Parsed infraspecific epithet.
Taxonomic structure detected by the parser.
Canonical name reconstructed from parsed components.
Logical value indicating successful syntactic parsing.
standardize_scientific_names(c( " homo sapiens ", "Chilina sp.", "Parastacus brasiliensis subsp. promatensis", "Brassica oleracea var. capitata", NA_character_ ))standardize_scientific_names(c( " homo sapiens ", "Chilina sp.", "Parastacus brasiliensis subsp. promatensis", "Brassica oleracea var. capitata", NA_character_ ))
Produces a compact one-row summary of taxonomic resolution results.
The function counts the total number of names and the number of records assigned to the main resolution, match-quality, acceptance, and review categories.
Character category values are standardised internally by removing leading and trailing whitespace and converting text to lower case. Empty character values are treated as missing values.
summarize_taxonomic_resolution(x)summarize_taxonomic_resolution(x)
x |
A data frame containing taxonomic resolution results.
The object must contain the columns |
A one-row data frame with the following columns:
total_names: total number of input records.
resolved: number of resolved records.
unresolved: number of unresolved records.
not_queryable: number of non-queryable records.
high_quality: number of high-quality matches.
moderate_quality: number of moderate-quality matches.
low_quality: number of low-quality matches.
accepted: number of accepted taxonomic matches.
not_accepted: number of non-accepted taxonomic matches.
review_required: number of records requiring manual review.
x <- data.frame( resolution_status = c( "resolved", "unresolved", "not_queryable" ), match_quality = c( "high", "unresolved", NA_character_ ), accepted_status = c( "accepted", "unresolved", NA_character_ ), review_required = c( FALSE, TRUE, TRUE ), stringsAsFactors = FALSE ) summarize_taxonomic_resolution(x)x <- data.frame( resolution_status = c( "resolved", "unresolved", "not_queryable" ), match_quality = c( "high", "unresolved", NA_character_ ), accepted_status = c( "accepted", "unresolved", NA_character_ ), review_required = c( FALSE, TRUE, TRUE ), stringsAsFactors = FALSE ) summarize_taxonomic_resolution(x)
Creates a structured diagnostic report from the results of the TaxResolveR taxonomic resolution workflow.
taxonomic_resolution_report(x)taxonomic_resolution_report(x)
x |
A data frame containing taxonomic resolution results. Typically,
this is the object returned by |
The report summarises overall taxonomic resolution, resolution status, match quality, and reasons for manual taxonomic review. Counts and proportions are calculated using the total number of input records as the denominator.
A named list containing four data frames:
Overall taxonomic resolution summary produced by
summarize_taxonomic_resolution().
Counts and proportions for resolved, unresolved, and non-queryable records.
Counts and proportions for taxonomic match-quality categories.
Counts and proportions for reasons requiring manual taxonomic review.
x <- data.frame( resolution_status = c( "resolved", "resolved", "not_queryable" ), match_quality = c( "high", "moderate", NA ), accepted_status = c( "accepted", "accepted", NA ), review_required = c( FALSE, TRUE, TRUE ), review_reason = c( NA, "non_exact_match", "not_queryable" ), stringsAsFactors = FALSE ) taxonomic_resolution_report(x)x <- data.frame( resolution_status = c( "resolved", "resolved", "not_queryable" ), match_quality = c( "high", "moderate", NA ), accepted_status = c( "accepted", "accepted", NA ), review_required = c( FALSE, TRUE, TRUE ), review_reason = c( NA, "non_exact_match", "not_queryable" ), stringsAsFactors = FALSE ) taxonomic_resolution_report(x)
Provides a high-level interface for taxonomic name resolution in TaxResolveR. Scientific names are resolved against a supported taxonomic source, assessed for resolution and match quality, and flagged when manual taxonomic review is recommended.
taxresolve(x, source = "gbif")taxresolve(x, source = "gbif")
x |
A character vector containing scientific names. |
source |
Character string specifying the taxonomic source.
Currently, |
This function combines resolve_taxonomy(),
assess_taxonomic_match(), and flag_taxonomic_review() into a
single workflow.
A data frame containing the taxonomic resolution returned by
resolve_taxonomy() together with the assessment columns produced
by assess_taxonomic_match() and the review columns produced by
flag_taxonomic_review().
taxresolve( c( "Homo sapiens", "Homo sapens", "Chilina sp." ) )taxresolve( c( "Homo sapiens", "Homo sapens", "Chilina sp." ) )
Performs basic syntactic validation of species names, including missing values, empty names, repeated whitespace, and binomial structure.
validate_species_names(x)validate_species_names(x)
x |
Character vector containing scientific names. |
A data.frame with the original names and logical indicators for missing names, empty names, repeated whitespace, and valid binomial structure.
validate_species_names(c( "Homo sapiens", "Chilina sp.", NA, "" ))validate_species_names(c( "Homo sapiens", "Chilina sp.", NA, "" ))