knitr::opts_chunk$set( collapse = TRUE, comment = "# >" ) library("datelife") data("opentree_chronograms") runtime <- attr(opentree_chronograms, "running_time") # for provisional testing: start_time <- Sys.time() Sys.sleep(10) end_time <- Sys.time() runtime <- end_time - start_time
datelife
is an R package for obtaining information on time of divergence of taxa
from expert sources (i.e., peer-reviewed published research). It is also a service
for time scaling phylogenetic trees. It leverages on chronograms already available
on Open Tree of Life Database and on existing dating and analyzing tools to rapidly
generate de-novo hypothesis of time divergence of taxa.
First, install datelife
into your computer. You can install the stable version of the package from cran
install.packages("datelife")
or the development version from github
devtools::install_github("phylotastic/datelife")
Now load the package into the R workspace.
library("datelife") # devtools::load_all("~/Desktop/datelife/")
The main goal of datelife
is to search chronograms from published peer reviewed
studies (from now on source chronograms) available for a set of taxa of interest. This task is performed with the datelife_search()
function. Taxa of interest are accepted
as scientific names, either as a single character vector, as tip labels in a phylo
object or as a character string in newick format. In any case, upper and lower case are ignored.
mamms <- datelife_search(input = c("Felis catus", "Delphinus delphus", "Homo sapiens", "Elephas maximus"))
You can plot all source chronograms on screen with the function plot_phylo_all()
or save them into a pdf or png file with the argument write
:
plot_phylo_all(mamms, write = "pdf", file = "mamms_phyloall")
# out.width="0.3\\linewidth" ff <- paste(file.path("mamms_phyloall", dir("mamms_phyloall"))) knitr::include_graphics(ff) # {width=65%}
Source chronograms come from Open Tree of Life tree store, this means that uncertainty from original studies is not yet available.
Explain the datelife object. It is composed by three elements. datelifeQuery datelifeResults datelifeSummary
You can get all trees in newick format. Chronogram search is performed at the species level. This means that source chronograms with subspecies are collapsed to present one exemplar per species.
# show how chronogram cache is constructed, do not eval, show one message example
Source chronograms are cached in the package as a data object called opentree_chronograms
. This object is updated every two months approximately. If you want to manually update the object or save it as an object in your own computer, you can do:
update_datelife_cache <- function(file = "opentree_chronograms.RData")
The update will take approximately r paste(as.character(round(runtime, digits = 2)), attr(runtime, "units"))
.
Chronograms are downloaded from OToL and processed in various ways to be suitable for datelife
use.
Tip labels are standardized to Opentree of Life Taxonomy.
Tips that cannot be automatically standardised are left alone as original.
As of now, the percentage of standardised names is as follows:
# knitr::kable(table(unlist((sapply(opentree_chronograms$trees, "[", "mapped")))))
For now, taxon names must be provided as scientific names. Common name searches are not yet implemented. Scientific names can be anything from species binomials to higher-taxon names. Subspecies names will not be considered.
You can use the datelife_query function first to check that your names are accepted. If you are unsure about the spelling or synonyms, you can use arguments use_tnrs
and approximate_match
.
# datelife query function make_datelife_query(c("cat", "dog")) make_datelife_query(c("Felix", "Caniss"), use_tnrs = TRUE) make_datelife_query(c("Felis", "Canis"), get_spp_from_taxon = TRUE)
If higher-taxon names are provided, you can use option get_spp_from_taxon = TRUE, which is also a service of rphylotatsic that gets all species within a higher taxon. If you choose this option, all species within the higher-taxon names provided will be included in the search.
# datelife query function
You can summarize all source chronograms found by DateLife with the median method.
You can also summarize source chronograms with a supertree approach. In here we have implemented SDM method.
Within DateLife, we have also wrapped the OToL scaling service available from http://141.211.236.35:10999.
See also the Time Tree of Life web for getting time of divergence of a pair of taxa or a synthetic chronogram of lineages within a single taxon.
Alternatively, new chronograms can be generated using available information as secondary calibrations.
# ```r
The datelife manuscript is still being written.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.