treetime_examples icon indicating copy to clipboard operation
treetime_examples copied to clipboard

A collection of documented examples using TreeTime

Collections of examples of phylogenetic analysis with TreeTime

There are three different ways of using TreeTime:

  1. as a python module as part of python scripts and programs
  2. via a set of command-line tools
  3. via the webserver at treetime.ch.

The documentation of TreeTime is now hosted on readthedocs: readthedocs

Molecular clock phylogeny of 200 NA sequences of influenza A H3N2

Command line usage

The general pattern to use TreeTime to infer timetrees via the command line is

treetime --tree mytree.nwk --aln mysequences.fasta --dates metadata.csv

In addition, there are number of subcommands for related tasks. Please see the following pages that explain usage for different cases:

TreeTime in python scripts

A minimal script to run TreeTime would look something like this

from treetime import TreeTime
from treetime.utils import parse_dates

dates=parse_dates('metadata.csv')
tt=TreeTime(tree='mytree.nwk', aln='mysequences.fasta', dates=dates)
tt.run(root='best')

More detailed examples can be found in the following set of scripts:

  • rerooting and timetree inference
  • ancestral sequence reconstruction
  • relaxed clock models
  • an analysis of 2014-2016 Ebola virus sequences