Skip to content

tpaulson1/rotl

 
 

Repository files navigation

Build Status Build status Coverage Status CRAN RStudio mirror downloads Research software impact

An R interface to Open Tree API

rotl is an R package to interact with the Open Tree of Life data APIs. It was initially developed as part of the NESCENT/OpenTree/Arbor hackathon.

Client libraries to interact with the Open Tree of Life API also exists for Python and Ruby.

Installation

The current stable version is available from CRAN, and can be installed by typing the following at the prompt in R:

install.packages("rotl")

If you want to test the development version, you first need to install devtools.

install.packages("devtools")

Then you can install rotl using:

library(devtools)
install_github("ropensci/rotl", dependencies = TRUE, build_vignette=TRUE)

To build the vignettes with the development version, you will need to have pandoc 1.12.3 or higher installed. If you use RStudio, make sure you have v0.99 (as it comes with pandoc 1.13.1); if you don't use RStudio, you can find pandoc for your operating system here

Vignettes

There are two vignettes:

  • start by checking out the "How to use rotl?" by typing: vignette("how-to-use-rotl", package="rotl") after installing the package.

  • then explore how you can use rotl with other packages to combine your data with trees from the Open Tree of Life project by typing: vignette("data_mashups", package="rotl").

The vignettes are also available from CRAN: How to use rotl? and Data mashups

Quick start

Get a little bit of the big Open Tree tree

Taxonomic names are represented in the Open Tree by numeric identifiers, the ott_ids (Open Tree Taxonomy identifiers). To extract a portion of a tree from the Open Tree, you first need to find ott_ids for a set of names using the tnrs_match_names function:

library(rotl)
apes <- c("Pan", "Pongo", "Pan", "Gorilla", "Hylobates", "Hoolock", "Homo")
(resolved_names <- tnrs_match_names(apes))
##   search_string                        unique_name approximate_match
## 1           pan                                Pan             FALSE
## 2         pongo                              Pongo             FALSE
## 3           pan                                Pan             FALSE
## 4       gorilla                            Gorilla             FALSE
## 5     hylobates Hylobates (genus in Deuterostomia)             FALSE
## 6       hoolock                            Hoolock             FALSE
## 7          homo                               Homo             FALSE
##   ott_id is_synonym is_deprecated number_matches
## 1 417957      FALSE         FALSE              1
## 2 417949      FALSE         FALSE              1
## 3 417957      FALSE         FALSE              1
## 4 417969      FALSE         FALSE              1
## 5 166552      FALSE         FALSE              1
## 6 712902      FALSE         FALSE              1
## 7 770309      FALSE         FALSE              1

Now get the tree with just those tips:

tr <- tol_induced_subtree(ott_ids=resolved_names$ott_id)
plot(tr)

plot of chunk get_tr

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

About

Interface to Open Tree of Life API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • R 100.0%