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

taxonomy_subtree

Taxonomy subtree


Description

Given an ott id, return the inclusive taxonomic subtree descended from the specified taxon.

Usage

taxonomy_subtree(
  ott_id = NULL,
  output_format = c("taxa", "newick", "phylo", "raw"),
  label_format = NULL,
  file,
  ...
)

Arguments

ott_id

The ott id of the taxon of interest.

output_format

the format of the object to be returned. See the ‘Return’ section.

label_format

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

file

the file name where to save the output of the function. Ignored unless output_format is set to “phylo”.

...

additional arguments to customize the API request (see rotl package documentation).

Details

If the output of this function is exported to a file, the only possible value for the output_format argument is “newick”. If the file provided already exists, it will be silently overwritten.

Value

If the file argument is missing:

  • taxa” a list of the taxa names (species) in slot tip_label, and higher-level taxonomy (e.g., families, genera) in slot edge_label, descending from the taxa corresponding to the ott_id provided.

  • newick” a character vector containing the newick formatted string corresponding to the taxonomic subtree for the ott_id provided.

  • phylo” an object of the class phylo from the ape package.

  • raw” the direct output from the API, i.e., a list with an element named ‘newick’ that contains the subtree as a newick formatted string.

If a file argument is provided (and output_format is set to “phylo”), a logical indicating whether the file was successfully created.

Examples

## Not run: 
req <- taxonomy_subtree(ott_id=515698)
plot(taxonomy_subtree(ott_id=515698, output_format="phylo"))

## 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.