knitr::opts_chunk$set( warning = FALSE, message = FALSE, collapse = TRUE, comment = "#>", fig.path = "man/figures/" )
phylodiv
: Phylogenetic Biodiversity Query Tools
Development version from GitHub
if (!require("remotes")) install.packages("remotes") remotes::install_github("ropensci/phylodiv")
BiocManager::install("ggtree")
library('phylodiv')
# given a tree tree # read the tree pd_read() # collect all higher taxonomic information from those names pd_taxa() # compose a phylogeny based query pd_query() # send the query to a biodiversity backend, e.g., GBIF pd_biodiv() # visualize results pd_viz()
library(ape) heli <- c("Helianthus agrestis", "Helianthus angustifolius", "Helianthus annuus", "Helianthus deserticola", "Helianthus divaricatus", "Helianthus eggertii", "Helianthus gracilentus", "Helianthus hirsutus", "Helianthus inexpectatus", "Helianthus laciniatus", "Helianthus maximiliani", "Helianthus nuttallii", "Helianthus occidentalis", "Helianthus paradoxus", "Helianthus pauciflorus", "Helianthus petiolaris", "Helianthus porteri", "Helianthus verticillatus", "Helianthus winteri") tree <- rcoal(length(heli)) (tree$tip.label <- heli)
(res <- pd_read(tree))
The PhyloDiv object
class(res) names(res)
(res <- pd_taxa(res)) res$trees
res <- pd_query(res, c("Helianthus agrestis", "Helianthus angustifolius", "Helianthus petiolaris")) res$query
(res <- pd_biodiv(res, type = 'facet', by = "country"))
pd_vis(res, type = "facet")
pd_meta() # print to cosole file <- tempfile() pd_meta(file = file) # save to file jsonlite::fromJSON(file)
general questions - how do people interact with phylogenies in R? that is how to they most often refer to nodes/tips? - what about the use case of comparing 1 or more phylogenies against one another? -
pd_read: - make sure to handle any local or remote tree, and many R tree objects
pd_taxa: - add option to use taxizedb to handle large data problems better - is there a way to programatically label upstream nodes after collecting taxonomic hierarchies?
pd_query: - this is the most slippery problem - two major approaches: taxonomic or phylogenetic - taxonomic e.g., if user wants specific names (e.g., i want species A, B, and C) - phylogenetic e.g., if user wants to see clade A compared to clade B - what to do if a user wants higher node in the tree for which we don't know the name? - are there tools to guess these names? - possibly just error with message telling user to name that node?
pd_biodiv options include (assuming using GBIF):
- get all occurrences (via rgbif::occ_data()
), slowish; need caching mechanism
- get just count data (via rgbif::occ_data()
, but just get counts), fast; probably no need for caching mechanism
- GBIF downloads (via rgbif::occ_download()
), slowish, but only option to "get all the data"; need caching mechanism
pd_vis options include: - base plots, plain ol maps - GBIF maps API, rasters: - with base plots, static maps - with leaflet, interactive maps - do we support maps of occurences matched against a phylogeny? or is that not needed? - perhaps other R packages can be leveraged here
phylodiv
in R doing citation(package = 'phylodiv')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.