Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time



BaTS (Bayesian analysis of tip significance, loosely bacronymised...) is a standalone program for the analysis of phylogenetic data. It asks the question: 'given this distribution of traits on taxa, how likely is this pattern to have arisen by chance?'. The current stable version of this package is v0.9.0 (see below).

It assumes discrete trait values, known for each taxon unambiguously. The phylogenetic relationship between the taxa must be represented as a posterior set of trees, e.g. a collection of trees assumed to correctly sample the posterior distribution of the phylogeny. Usually these will have been inferred from molecular data using BEAST or MrBayes.

The general approach is described in Parker et al. (2008) (.pdf copy).

'Befi-BaTS' is a further development of this approach. It comprises new methods (NTI/NRI, UniFrac, and PD - trait-association statistics that incorporate branch lengths as well as tree topology) and an improved user interface which should be easier to use and interpret. This is currently in alpha at v0.10.1 (see below).

This repository contains code for both.


To support our work, please cite: J Parker, A Rambaut, OG Pybus(2008) Correlating viral phenotypes with phylogeny: accounting for phylogenetic uncertainty. Infection, Genetics and Evolution 8(3):239-246 doi:10.1016/j.meegid.2007.08.001 (.pdf copy)


Requirements: This software requires Java. BaTS v0.9.0 (retroactive naming; referred to as 'Version 1' in the 2008 paper) requires J2SE / Java 1.5+. The current (v0.10.1) Befi-BaTS requires Java 1.7+.

Downloads: The current BaTS jarfile, manual and example files can be downloaded here with additional instructions and detail here.

Running BaTS: Please see the manual for details.

Help and instructions


  • Why don't my trees load?
  • The current version of BaTS is very particular about input formatting (sorry!) The analysis will fail if BaTS can't parse the information it needs from the trees file, or does so wrongly. This can occur for a variety of formatting reasons, but the top two are extra information added by BEAST (see this note) or a missing begin states;, begin trees; or [&R] tag. This last tag is used by BaTS to separate Newick tree data from tree names in the main section of the trees file. For instnce, this formatting is correct (cf. example.trees):

begin states;
1 black
2 black
3 black
4 black
5 white
6 white
7 white
8 white

begin trees;
tree STATE_1011000 = [&R] (1,2,3,4,5,6,7,8);
tree STATE_1011000 = [&R] ((1,2,3,4):1,(5,6,7,8):1);

... but this example will fail:


begin states;
1 black
2 black
3 black
4 black
5 white
6 white
7 white
8 white

begin trees;
tree STATE_1011000 = (1,2,3,4,5,6,7,8);               # ' [&] ' tag missing
tree STATE_1011000 = [&R] ((1,2,3,4):1,(5,6,7,8):1);  # Correct formatting
tree STATE_1011000 =[&R]((1,2,3,4):1,(5,6,7,8):1);    # Required whitespace absent.
  • How do I know what the 'state_0','state_1' etc in the output of the MC statistic refer to? These occur in the same order as the input states, so if your inputs were
begin states;
1 black, 
2 red, 
3 black,
4 black,
5 red, 
4 green

Where the input order (ignoring duplicates) is {black, red, green}, the input states will map to the following MC ouptut statistics:

Input state MC statistic
'black' state_0
'red' state_1
'green' state_2
... state_(n)
  • How do I report an error/request a change?
    • Please use the issue tracker here to report bugs or request changes. Please check the existing requests first, including closed ones!

About BaTS and Befi-BaTS versions:

BaTS has been under development since 2006. As a result there are multiple versions of the software, and the naming/versioning hasn't been all that consistent...

  • 'BaTS' is taken to mean the package for estimating the core topology-based trait association statistics (AI, PS and MC), reported in Parker et al. (2008).
  • 'Befi-BaTS' referred to a modification to BaTS (under intermittent development during 2007-2009) which incorporates additional statistics based on tree branch lengths (UniFrac, NTI/NRI, and PD) as well as the existing BaTS statistics. This is currently unpublished.
  • To simplify things, all previous versions have been retroactively named in (reasonably) close accordance with Semantic Versioning principles.

BaTS v0.9.0

The stable, published, topology-statistics-only version of BaTS has therefore been designated 'v0.9.0' and can be found here.

Befi-BaTS / BaTS v0.10.1

The latest development build of BaTS, a.k.a. 'Befi-BaTS' is currently at v0.10.1, and can be found here. Note that this is unpublished and can't be considered trusted/tested.


A changelog, including list of previous versions/names, can be found here, or here in .xlsx format.


Java software to analyse phylogeny-trait correlations in discrete traits, accounting for phylogenetic uncertainty via posterior sampling.








No packages published