Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tol_induced_subtree

Subtree from the Open Tree of Life


Description

Return the induced subtree on the synthetic tree that relates a list of nodes.

Usage

tol_induced_subtree(
  ott_ids = NULL,
  node_ids = NULL,
  label_format = NULL,
  file,
  ...
)

Arguments

ott_ids

Numeric vector. OTT ids indicating nodes to be used as tips in the induced tree.

node_ids

Character vector. Node ids indicating nodes to be used as tips in the induced tree.

label_format

Character. Defines the label type; one of “name”, “id”, or “name_and_id” (the default).

file

If specified, the function will write the subtree to a file in newick format.

...

additional arguments to customize the API call (see rotl for more information).

Details

Return a tree with tips corresponding to the nodes identified in the input set that is consistent with the topology of the current synthetic tree. This tree is equivalent to the minimal subtree induced on the draft tree by the set of identified nodes.

Value

If no value is specified to the file argument (default), a phylogenetic tree of class phylo.

Otherwise, the function returns invisibly a logical indicating whether the file was successfully created.

Note that the tree returned when specifying a file name with the file argument is the “raw” Newick string returned by Open Tree of Life. This string contains singleton nodes, and therefore will be different from the tree returned as a phylo object which will not contain these singleton nodes.

Examples

## Not run: 
## Result as a `phylo` object
res <- tol_induced_subtree(ott_ids = c(292466, 267845, 316878, 102710))

## Raw Newick string from Open Tree of Life
tree_file <- tempfile(fileext = ".tre")
tol_induced_subtree(ott_ids = c(292466, 267845, 316878, 102710),
                    file=tree_file)


## End(Not run)

rotl

Interface to the 'Open Tree of Life' API

v3.0.11
BSD_2_clause + file LICENSE
Authors
Francois Michonneau [aut, cre] (<https://orcid.org/0000-0002-9092-966X>), Joseph Brown [aut] (<https://orcid.org/0000-0002-3835-8062>), David Winter [aut] (<https://orcid.org/0000-0002-6165-0029>), Scott Chamberlain [rev] (<https://orcid.org/0000-0003-1444-9135>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.