Taxonomy — Queries

Taxonomy tree queries

These functions navigate the PBDB taxonomic hierarchy by name, returning descendants or ancestors at a requested rank. All functions are backed by the same Scratch-managed snapshot used by the filters above and build their indices on first use (no extra download required).

using PaleobiologyDB.Taxonomy

# Valid rank names
taxonomic_ranks()
# → ["subspecies", "species", "genus", …, "kingdom"]

# All accepted taxon names (tens of thousands)
registered_taxa()

# Names matching a pattern
registered_taxa(r"^Canis\b")
# → ["Canis", "Canis aureus", "Canis lupus", …]

# Union of patterns
registered_taxa([r"^Canis\b", r"^Vulpes\b"])

# All families within Carnivora
child_taxa("Carnivora", "family")
# → ["Ailuridae", "Amphicyonidae", "Canidae", "Felidae", …]

# All genera within Canidae
child_taxa("Canidae", "genus")
# → ["Borophagus", "Canis", "Lycaon", "Urocyon", "Vulpes", …]

# All species within a genus
child_taxa("Canis", "species")
# → ["Canis aureus", "Canis lupus", "Canis mesomelas", …]

# Every descendant at any rank (no filter)
child_taxa("Canidae")

# Full ancestor chain of a species, child → root
parent_taxa("Canis lupus")
# → ["Canis", "Canidae", "Carnivora", "Mammalia", …, "Animalia"]

# Only the family
parent_taxa("Canis lupus", "family")
# → ["Canidae"]
PaleobiologyDB.Taxonomy.taxonomic_ranksFunction
taxonomic_ranks() -> Vector{String}

Return all taxonomic rank names recognised by the PBDB, ordered from most specific (subspecies) to most general (kingdom).

The returned vector is a copy of PBDB_RANK_HIERARCHY; mutating it has no effect on the package's internal state.

Returns

A Vector{String} of 19 ranks:

"subspecies" "species" "genus" "subtribe" "tribe" "subfamily"
"family" "superfamily" "infraorder" "suborder" "order"
"superorder" "infraclass" "subclass" "class" "superclass"
"subphylum" "phylum" "kingdom"

Examples

using PaleobiologyDB, PaleobiologyDB.Taxonomy

taxonomic_ranks()
# → ["subspecies", "species", "genus", …, "kingdom"]

# Enumerate from coarsest to finest
reverse(taxonomic_ranks())

See also PBDB_RANK_HIERARCHY, registered_taxa, child_taxa, parent_taxa.

source
PaleobiologyDB.Taxonomy.registered_taxaFunction
registered_taxa(taxon_name=nothing) -> Vector{String}

Return accepted taxon names from the Scratch-cached PBDB taxa list snapshot that match the given filter.

Arguments

  • taxon_name — filter criterion; one of:
    • nothing (default) — return all accepted names.
    • Regex — return names where occursin(taxon_name, name) is true.
    • AbstractVector{<:Regex} — return names matching any pattern (union semantics).

Only accepted (non-synonym) names are included, consistent with child_taxa and parent_taxa.

Returns

A sorted Vector{String}. Returns an empty vector when no names match.

Examples

using PaleobiologyDB, PaleobiologyDB.Taxonomy

# All accepted names (tens of thousands of entries)
all_taxa = registered_taxa()

# Names containing "Canis" (case-sensitive)
registered_taxa(r"Canis")
# → ["Canis", "Canis aureus", "Canis lupus", …]

# Case-insensitive search
registered_taxa(r"canid"i)

# Union of two patterns
registered_taxa([r"^Canis", r"^Vulpes"])
# → ["Canis", "Canis aureus", …, "Vulpes", "Vulpes vulpes", …]

See also taxonomic_ranks, child_taxa, parent_taxa, istaxon.

source
PaleobiologyDB.Taxonomy.child_taxaFunction
child_taxa(taxon_name, taxonomic_rank=nothing) -> Vector{String}

Return the names of all descendants of taxon_name at the given taxonomic_rank, resolved from the Scratch-cached PBDB taxa list snapshot.

If taxonomic_rank is nothing, all descendants at every rank are returned.

Arguments

  • taxon_name — accepted taxon name exactly as it appears in PBDB (e.g. "Carnivora", "Canidae", "Canis").

  • taxonomic_rank — rank string, or nothing (default). Must be one of:

    "subspecies" "species" "genus" "subtribe" "tribe" "subfamily"
    "family" "superfamily" "infraorder" "suborder" "order"
    "superorder" "infraclass" "subclass" "class" "superclass"
    "subphylum" "phylum" "kingdom"

Returns

A sorted Vector{String} of matching taxon names. Returns an empty vector when taxon_name is not found in the PBDB snapshot.

Examples

using PaleobiologyDB, PaleobiologyDB.Taxonomy

child_taxa("Carnivora", "family")   # → ["Ailuridae", "Canidae", "Felidae", …]
child_taxa("Canidae", "genus")      # → ["Canis", "Lycaon", "Vulpes", …]
child_taxa("Canis", "species")      # → ["Canis aureus", "Canis lupus", …]
child_taxa("Carnivora")             # → all descendants at every rank
child_taxa("INVALID", "genus")      # → String[]

See also parent_taxa, augment_taxonomy.

source
PaleobiologyDB.Taxonomy.parent_taxaFunction
parent_taxa(taxon_name, taxonomic_rank=nothing) -> Vector{String}

Return the names of all ancestors of taxon_name at the given taxonomic_rank, resolved from the Scratch-cached PBDB taxa list snapshot.

If taxonomic_rank is nothing, all ancestors at every rank are returned, ordered from immediate parent up to the root.

Arguments

  • taxon_name — accepted taxon name exactly as it appears in PBDB (e.g. "Canis lupus", "Canis", "Canidae").

  • taxonomic_rank — rank string, or nothing (default). Must be one of:

    "subspecies" "species" "genus" "subtribe" "tribe" "subfamily"
    "family" "superfamily" "infraorder" "suborder" "order"
    "superorder" "infraclass" "subclass" "class" "superclass"
    "subphylum" "phylum" "kingdom"

Returns

A Vector{String} of matching ancestor names, ordered child → root. Returns an empty vector when taxon_name is not found in the PBDB snapshot.

Examples

using PaleobiologyDB, PaleobiologyDB.Taxonomy

parent_taxa("Canis lupus")            # → ["Canis", "Canidae", …, "Animalia"]
parent_taxa("Canis", "family")        # → ["Canidae"]
parent_taxa("Canis", "order")         # → ["Carnivora"]
parent_taxa("Canis", nothing)         # → all ancestors, child → root
parent_taxa("INVALID", "family")      # → String[]

See also child_taxa, augment_taxonomy.

source