bioRxivBioinformaticsPreprint
MBASR: Workflow-simplified ancestral state reconstruction of discrete traits with MrBayes in the R environment
Abstract
Ancestral state reconstruction (ASR) is a critical tool in comparative biology. Given a phylogenetic tree and observed trait states for taxa at the trees tips, ASR aims to model ancestral trait states at the trees internal nodes. Thus, the pattern, tempo, and frequency of a characters evolution can be considered in a phylogenetic framework. Software programs that perform discrete trait ASR analyses are variably complex in terms of workflow steps, input formats, user interfaces, settings and execution commands, and the organization of output. MBASR (acronym for MrBayes Ancestral States with R) is an R language toolkit that highly automates the ASR workflow and uses the machinery of the popular phylogenetics software MrBayes. Input data files are simple, analysis can be setup and run with a single R function, and statistical output is concisely organized and immediately interpretable. Use requires minimal knowledge of the most basic R commands and no experience with the MrBayes program. The MBASR toolkit can be freely downloaded from GitHub.
- organism: non-human primate
- research focus: phylogenetics / evolution
- research focus: software / tool
- approach: Bayesian inference
- approach: statistical model
- approach: experimental assay
In-depth summary
Claude Opus 5.5 · xhigh effort · 8 Nov 2026 · from the full text of version 1 (10 Jan 2021) · CC BY 4.0
One R function runs discrete-trait ancestral state reconstruction in MrBayes 3.2.7a on a fixed tree, returning per-node state probabilities and a pie-chart tree plot from plain-text inputs.
Existing discrete-trait ASR software (BayesTraits, Mesquite, RASP, and the R packages ape and phangorn) each has its own input formats, commands, settings and output formats, so even experienced users often face a re-learning curve to set up, run and report an analysis. MBASR wraps the continuous-time Markov model in MrBayes behind a single R call, so the user needs only basic R and does not need to have used MrBayes before.
Key results
ShownA single call, MBASR(), takes a rooted Newick tree with branch lengths and a plain-text trait file, runs MrBayes, and writes a per-node state-probability table plus a PDF tree plot. A second function, replot(), redraws the figure from saved results without rerunning the analysis.
Trait file: one taxon per line, a tab, then the state (0-9 unordered, 0-5 ordered; '?' for missing; '&' for ambiguity, e.g. 1&2). MrBayes.ASR.results.txt lists node numbers, then one probability column per state, and each row sums to 1. Nodes are numbered as in ape and BayesTraits, so a 100-tip tree has its root at node 101. tree.plot.pdf is vector art with pie charts at the nodes. · Introduction; Arguments; Description; Arguments
ClaimedThe analysis holds the user's tree fixed, so the author states its outputs will more closely resemble maximum-likelihood marginal state estimates than a Bayesian posterior that includes tree uncertainty.
MrBayes proposals on topology (Tau) and branch lengths (V) are switched off. The Markov model runs with variable coding to handle ascertainment bias, and a sample is taken every 100 generations (n.samples=500 gives ngens 50000). Only generations in the top 25% of the observed log-likelihood range are kept, and probabilities are their means. No comparison with a likelihood estimate is shown. · Arguments; Arguments
SuggestedA bundled worked example reconstructs geographic landmass across living and fossil primates, using the tree and trait scores of Gunnell et al. (2018).
Figure 1 shows MBASR pie-chart output (the map and timescale were added afterwards). The author says the MBASR algorithm is very close to that study's method and settings, but the paper gives no quantitative comparison with the published reconstruction. · Conclusion; Figure legends
ClaimedVery large MCMC sample sizes are said to be probably unnecessary, because only one character evolves on a fixed phylogeny.
The author states that sample sizes of 1000, 10000 or 100000 can give nearly identical results. No runs, convergence statistics or numbers backing this are reported. · Arguments; Arguments
Methods, data and reproducibility
An R wrapper that sets up MrBayes 3.2.7a for one discrete character (ordered or unordered) on a fixed, rooted, user-supplied tree with branch lengths. It runs the serial MrBayes executable, removes burn-in by a log-likelihood filter, and summarizes state probabilities at each node as a table and a pie-chart tree plot.
- Tree and geographic-landmass trait scores for living and fossil primates from Gunnell et al. (2018), bundled with the toolkit as example data · primates (living and fossil)
- Methods & tools
- MBASR, MrBayes 3.2.7a, R, ape, phytools, FigTree
- Code
- https://github.com/stevenheritage/MBASR/releaseshttp://nbisweden.github.io/MrBayes/download.html
- Software & environment
- R with ape and phytools (loaded automatically, installed if missing). Serial MrBayes 3.2.7a executable for Windows or MacOS, renamed mb.exe or mb, placed in the 'mb' folder. Fixed folder layout (input.files, results). No package to install; one source file is loaded.
- Reproducibility gaps
- No Linux or parallel MrBayes setup is described, and the versions of R, ape and phytools are not stated. The example data ship inside the toolkit release, with no separate archive. No runtimes are reported.
Limitations (5)
- Analyses use a single fixed tree, so uncertainty in topology and branch lengths is not carried through. The author states that results will more closely resemble maximum-likelihood marginal estimates than a Bayesian posterior summarized with HPD ranges. · stated by the authors
- Choosing ordered rather than unordered coding can considerably change the reconstruction when a trait moves between non-adjacent states. · stated by the authors
- The default plot settings may not suit trees of every size. · stated by the authors
- There is no quantitative validation: outputs are not compared with other ASR tools or with the published Gunnell et al. (2018) reconstruction, and the claim that sample size barely matters is not backed by any data shown. · noted in this summary
- Burn-in is removed by a fixed rule (keep the top 25% of the log-likelihood range) and no convergence diagnostics are described. Each run handles only one trait. · noted in this summary
Read this if you want state probabilities for one discrete character at the internal nodes of a fixed tree with branch lengths, computed by MrBayes from inside R without writing MrBayes command blocks.
- Citations
- 45
Reproducibility ledger
Nobody has reported trying to reproduce this paper yet. Did you replicate an experiment or run the code? Your report saves the next lab a week.
Sign in to file a reproducibility report.
Related papers
- babette: BEAUti 2, BEAST2 and Tracer for R
Richèl J.C. Bilderbeek, Rampal S. Etienne·Methods in Ecology and EvolutionPeer-reviewed·May 27, 2018
- PastView: a user-friendly interface to explore evolutionary scenarios
F. Chevenet, G. Castel, … O. Gascuel·bioRxiv·May 27, 2019
- phytools 2.0: An updated R ecosystem for phylogenetic comparative methods (and other things)
Liam J. Revell·PeerJPeer-reviewed·Jan 5, 2024
- What is the best method for estimating ancestral states from discrete characters?
J. N. Keating·bioRxiv·Aug 31, 2023
- TreeSearch: morphological phylogenetic analysis in R
M. R. Smith·bioRxiv·Nov 8, 2021
- Reconstructing substitution histories on phylogenies, with accuracy, precision, and coverage
Jordan Douglas, Lindell D. Bromham·bioRxiv·Dec 23, 2025