Comparison of Phylogenetic Trees Using Quartet and Split Measures

Calculates the number of four-taxon subtrees consistent with a pair of cladograms, calculating the symmetric quartet distance of Bandelt & Dress (1986), Reconstructing the shape of a tree from observed dissimilarity data, Advances in Applied Mathematics, 7, 309-343 , and using the tqDist algorithm of Sand et al. (2014), tqDist: a library for computing the quartet and triplet distances between binary or general trees, Bioinformatics, 30, 2079–2080 for pairs of binary trees.

Project Status: Inactive. Build Status codecov CRAN Status Badge CRAN Downloads DOI

Quartet is an R package that calculates the Quartet distance between two trees: a measure of their similarity based on the number of shared four-taxon subtrees.

The package uses the tqDist algorithm. Unlike many other implementations, it distinguishes between quartets that are contradicted by one tree, and quartets that are simply absent due to a lack of resolution (i.e. the presence of polytomies). Quartet makes this distinction in both the quartet metric (function QuartetStatus) and the partition metric (i.e. Robinson-Foulds distance; function SplitStatus).

Using the package

Install and load the library from CRAN as follows:


If you're feeling brave, you can install the development version thus:

if(!require(devtools)) install.packages("devtools")

You will need Rtools installed in order to build the development version from source.


  • Brodal G.S., Fagerberg R., Pedersen C.N.S. 2004. Computing the quartet distance between evolutionary trees in time O(n log n). Algorithmica. 38:377–395.

  • Estabrook G.F., McMorris F.R., Meacham C.A. 1985. Comparison of undirected phylogenetic trees based on subtrees of four evolutionary units. Syst. Zool. 34:193–200.

  • Robinson D.F., Foulds L.R. 1981. Comparison of phylogenetic trees. Math. Biosci. 53:131–147.

  • Sand A., Holt M.K., Johansen J., Brodal G.S., Mailund T., Pedersen C.N.S. 2014. tqDist: a library for computing the quartet and triplet distances between binary or general trees. Bioinformatics. 30:2079–2080.

  • Smith, M.R. (2019) Bayesian and parsimony approaches reconstruct informative trees from simulated morphological datasets. Biol. Lett. 15:20180632.

  • Steel, M. and Penny, D. Distributions of tree comparison metrics: some new results. Syst. Biol. (1993) 42 (2): 126-141.


Quartet v1.0.2


  • Force R 3.5.0-style random number generation in examples, to ensure backward compatibility.
  • Add caterpillar trees to sq_trees, to illustrate issues with partition-based distance metrics.

Quartet v1.0.1


  • Improved portability of C++ code.

Quartet v1.0.0

New features

  • Add functions to generate ternary plots from tree similarity measures.


  • Use tqDist for all quartet calculations.
  • Remove single "splits" from splits objects.
  • Simplify installation via github_install.
  • Add missing details to documentation.


  • Function SimilarityMetrics now takes the output of QuartetStatus(trees), rather than a list of trees.
  • Function SplitStatus now returns output using the same column headers as QuartetStatus
  • Column N added to QuartetStatus output.
  • Function names changed, to become more precise:
    • QuartetMetricsSimilarityMetrics
    • MatchingSplitsSplitStatus
    • MatchingQuartetsQuartetStatus
    • ChoicesAllQuartets

SlowQuartet v0.2.0


  • Add MatchingSplits function to calculate number of splits contradicted / unresolved.
  • Add vignettes to document when the quartet metric may be preferable to other tree distance metrics.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.2.2 by Martin R. Smith, a year ago,

Report a bug at

Browse source code at

Authors: Martin R. Smith [aut, cre, cph] , Andreas Sand [ant] , Gerth Stølting Brodal [ant] , Rolf Fagerberg [ant] , Thomas Mailund [ant] , Christian N. S. Pedersen [ant] , Jens Johansen [ant] , Morten K. Holt [ant]

Documentation:   PDF Manual  

GPL (>= 2) license

Imports ape, Rdpack, Ternary, TreeTools, viridisLite

Suggests bookdown, knitr, phangorn, Rcpp, rmarkdown, testthat, usethis, vdiffr

Linking to Rcpp

System requirements: C++11

Suggested by CongreveLamsdell2016, TreeDist, TreeSearch.

See at CRAN