Package 'phyloatlas'

Title: Access to the 'Phylo-Species Atlas' of Empirical Phylogenies
Description: Provides convenience functions to fetch standardized phylogenetic trees and per-tree provenance metadata from the 'Phylo-Species Atlas' <https://github.com/franciscorichter/phylo-species-atlas> directly from R. The atlas is a curated collection of empirical species-level trees covering Bacteria, Archaea, and Eukaryota, organized into 62 partitions of life with tip labels normalized against a shared dictionary of standardized species identifiers. Functions load any of the standardized trees with species labels resolved from the dictionary, list available trees, and inspect per-tree provenance.
Authors: Francisco Richter [aut, cre] (ORCID: <https://orcid.org/0000-0002-0924-4613>)
Maintainer: Francisco Richter <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-06-04 17:04:14 UTC
Source: https://github.com/cran/phyloatlas

Help Index


Clear the in-memory cache

Description

The dictionary and metadata files are downloaded once per R session and cached. Call this if you want to force a re-download (for example after switching 'phyloatlas.base_url').

Usage

atlas_clear_cache()

Value

Invisibly 'NULL'. Called for its side effect of emptying the internal cache environment.

See Also

Other atlas: atlas_info(), list_trees(), load_atlas_tree()

Examples

# Safe to run unconditionally — just empties the in-session cache.
atlas_clear_cache()

Get metadata for a single tree

Description

Get metadata for a single tree

Usage

atlas_info(name)

Arguments

name

Tree name without the '.nwk' extension (e.g. '"mammals"', '"birds"', '"seed_plants"'). Must be a length-1 non-'NA' character string. Use [list_trees()] to see all available names.

Value

A one-row data frame with all metadata columns from [list_trees()], or 'NULL' (with a warning) if no tree by that name exists. Also returns 'NULL' (with a diagnostic message, no warning) if the atlas metadata cannot be downloaded.

See Also

Other atlas: atlas_clear_cache(), list_trees(), load_atlas_tree()

Examples

info <- atlas_info("mammals")
if (!is.null(info)) info

List trees available in the Phylo-Species Atlas

Description

Returns a data frame describing every standardized tree in the atlas: name, study, number of tips, whether the tree is time-calibrated, plus provenance fields (year, journal, DOI, coverage) when available.

Usage

list_trees()

Value

A data frame with one row per tree, ordered by group, with columns 'name', 'group', 'study', 'ntips', 'dated', 'year', 'journal', 'doi', 'crown_ma', 'described_species', 'coverage_pct', 'data_source', 'download_url', 'methods_brief', 'notes', and 'study_full' (the long-form study citation from the provenance file). Returns 'NULL' with a single diagnostic message if the atlas metadata cannot be downloaded (e.g. no internet); never throws on network failure.

See Also

Other atlas: atlas_clear_cache(), atlas_info(), load_atlas_tree()

Examples

trees <- list_trees()
if (!is.null(trees)) {
  head(trees)
  subset(trees, dated & ntips > 1000)
}

Load a tree from the Phylo-Species Atlas

Description

Downloads a standardized Newick tree from the atlas and resolves its integer tip IDs to species names using the shared dictionary.

Usage

load_atlas_tree(name, resolve_labels = TRUE)

Arguments

name

Tree name without the '.nwk' extension (e.g. '"mammals"', '"birds"', '"seed_plants"', '"condamine_Vangidae"'). Use [list_trees()] to see all available names.

resolve_labels

If 'TRUE' (default) tip labels are replaced with standardized species names from 'dictionary.csv'. Set to 'FALSE' to keep the raw integer IDs (faster, avoids downloading the dictionary).

Value

An object of class '"phylo"' from the ape package. If 'resolve_labels = TRUE' (the default), tip labels are species names from the standardized dictionary; otherwise tip labels are integer IDs as character strings.

See Also

Other atlas: atlas_clear_cache(), atlas_info(), list_trees()

Examples

# Offline demo using a small bundled tree (does not hit the network):
demo_path <- system.file("extdata", "tree_demo.nwk", package = "phyloatlas")
tree <- ape::read.tree(demo_path)
tree


# Live atlas fetch (requires internet):
tree <- try(load_atlas_tree("mammals"), silent = TRUE)
if (!inherits(tree, "try-error")) plot(tree, show.tip.label = FALSE)

# Keep integer IDs to skip the 18 MB dictionary download:
tree <- try(load_atlas_tree("birds", resolve_labels = FALSE), silent = TRUE)