Learn R Programming

treedater

treedater fits a strict or relaxed molecular clock to a phylogenetic tree and estimates evolutionary rates and times of common ancestry. The calendar time of each sample must be specified (possibly with bounds of uncertainty) and the length of the sequences used to estimate the tree.

treedater uses heuristic search to optimise the TMRCAs of a phylogeny and the substitution rate. An uncorrelated relaxed molecular clock accounts for rate variation between lineages of the phylogeny which is parameterised using a Gamma-Poisson mixture model.

To cite:

Installation

You can install the latest development version from github using the devtools package:

library(devtools)
install_github( 'emvolz/treedater')

Basic usage

dater( tre, sts, s, omega0)

where

  • tre is an ape::phylo phylogeny,
  • sts is a named vector of sample times for each tip in tre
  • s is the length of the genetic sequences used to estimate tre
  • omega0 is an initial guess of the substitution rate (can be omitted)

For a detailed introduction to features available in treedater, see the vignette on analysis of Influenza H3N2: vignette('h3n2').

Command line

You can also use treedater from the command line without starting R using the tdcl script:

./tdcl -h
Usage: ./tdcl [-[-help|h] [<logical>]] [-[-treefn|t] <character>] [-[-samplefn|s] <character>] [-[-sequenceLength|l] <double>] [-[-output|o] [<character>]]

-t <file> : file name of tree in newick format  
-s  <file> : should be a comma-separated-value file with sample times in format <taxon-id,sample-time> and no header
-l <length> :  the integer length of sequences in alignment used to construct the tree 
-o <file>: name of file for saving output 

Note that you may need to modify the first line of the tdcl script with the correct path to Rscript or littler.

Copy Link

Version

Install

install.packages('treedater')

Monthly Downloads

52

Version

1.0.2

License

GPL-2

Maintainer

Erik Volz

Last Published

September 3rd, 2025

Functions in treedater (1.0.2)

plot.bootTreedater

Plots lineages through time and confidence intervals estimated by bootstrap.
gibbs_jitter

Sample node dates conditional on root time using Gibbs sampling and date prior
rootToTipRegressionPlot

Plot evolutionary distance from root to sample times and estimated internal node times and regression lines
outlierLineages

Detect lineages with unusually large evolutionary divergence under the fitted treedater model
boot

Estimate of confidence intervals of molecular clock parameters with user-supplied set of bootstrap trees
outlierTips

Detect terminal lineages with unusually large evolutionary divergence under the fitted treedater model
parboot

Estimate of confidence intervals using parametric bootstrap for molecular clock dating.
goodnessOfFitPlot

Produce a goodness of fit plot
dater

Estimate a time-scaled tree and fit a molecular clock
relaxedClockTest

Use parametric bootstrap to test if relaxed clock offers improved fit to data.
treedater-package

treedater fits a molecular clock to a phylogenetic tree and estimates evolutionary rates and times of common ancestry.
sampleYearsFromLabels

Compute a vector of numeric sample times from labels in a sequence alignment or phylogeny