Prepare a phylogenetic tree — prepare_tree (original) (raw)

Import a phylogenetic tree and then conduct a series of optional standardisation steps. Optionally, if output_format is not NULL, species names from both the tree and the species argument will first be standardised using map_species.

prepare_tree(
  tree_source = "timetree",
  species = NULL,
  output_format = "scientific_name_formatted",
  run_map_species = c(TRUE, TRUE),
  method = c("homologene", "gprofiler", "babelgene"),
  force_ultrametric = TRUE,
  age_max = NULL,
  show_plot = TRUE,
  save_dir = tools::R_user_dir("orthogene", which = "cache"),
  verbose = TRUE,
  ...
)

Arguments

tree_source

Can be one of the following:

species

Species names to subset the tree by (after standardise_species step).

output_format

Which column to return.

run_map_species

Whether to first standardise species names withmap_species.

method

R package to use for gene mapping:

force_ultrametric

Whether to force the tree to be ultrametric (i.e. make all tips the same date) using force.ultrametric.

age_max

Rescale the edges of the tree into units of millions of years (MY) instead than evolutionary rates (e.g. dN/dS ratios). Only used if age_max, the max number , is numeric. Times are computed usingmakeChronosCalib and chronos.

show_plot

Show a basic plot of the resulting tree.

save_dir

Directory to cache full tree in. Set to NULL to avoid using cache.

verbose

Print messages.

...

Additional arguments passed to makeChronosCalib.

Value

A filtered tree of class "phylo" (with standardised species names).

Examples

if(require("ape")){
 species <- c("human","chimp","mouse")
 tr <- orthogene::prepare_tree(species = species)
} 
#> Importing tree from: TimeTree2022
#> Importing cached tree.
#> Standardising tip labels.
#> Mapping 3 species from `species`.
#> Mapping 3 species from tree.
#> --
#> 0/3 (0%) tips dropped from tree due to inability to standardise names with `map_species`.
#> --
#> 0/3 (0%) tips dropped from tree according to overlap with selected `species`.