Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Command-line tool for simulating predictive datasets from MrBayes' output.

Project description

Build-Status PyPI-Status License DOI-URI

predsim is a simple command-line tool for simulating predictive datasets from MrBayes output files. Datasets can be simulated under the GTR+G+I substitution model or any nested variant available in MrBayes (JC69, HKY85 etc.). The script uses Seq-Gen for simulating the DNA-sequences and builds on the third-party library DendroPy.

The code has been tested with Python 2.7 and 3.6.

Source repository:


  • Python (version 2.7 or 3.x)
  • The Python library DendroPy (version 4.0 or higher)
  • The command-line tool Seq-Gen

An easy way to get Python working on your computer is to install the free Anaconda distribution.


For most users, the easiest way is probably to install the latest version hosted on PyPI:

$ pip install predsim

The project is hosted at <> and can also be installed using git:

$ git clone
$ cd predsim
$ python install

You may consider installing predsim and its required Python packages within a virtual environment in order to avoid cluttering your system’s Python path.


predsim --help
usage: predsim [-h] [-V] [-l N] [-g N] [-s N] [-n N] [-p FILE]
               [--seeds-file FILE] [--commands-file FILE]
               pfile tfile [outfile]

A command-line utility that reads posterior output of MrBayes and simulates
predictive datasets with Seq-Gen.

positional arguments:
  pfile                 path to a MrBayes p-file
  tfile                 path to a MrBayes t-file
  outfile               path to output file (default: <stdout>)

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -l N, --length N      sequence lenght (default: 1000)
  -g N, --gamma-cats N  number of gamma rate categories (default: continuous)
  -s N, --skip N        number of records (trees) to skip at the beginning of
                        the sample (default: 0)
  -n N, --num-records N
                        number of records (trees) to use in the simulation
  -p FILE, --seqgen-path FILE
                        path to a Seq-Gen executable (default: "seq-gen")
  --seeds-file FILE
                        path to file with seed numbers to pass to Seq-Gen
  --commands-file FILE  path to output file with used Seq-Gen commands
  • It is strongly recommended that you use the -commands-file option to check the commands run by Seq-Gen.
  • Depending on your Python version, you may need to specify the full path to your Seq-Gen executable by using the -p option.

Running the tests

Testing is carried out with pytest:

$ pytest

Test coverage can be calculated with using the following commands:

$ coverage run -m pytest
$ coverage report -m

The code follow style conventions in PEP8, which can be checked with pycodestyle:

$ pycodestyle


predsim is distributed under the MIT license.


If you use results produced with this package in a scientific publication, please just mention the package name in the text and cite the Zenodo DOI of this project:


You can select a citation style from the dropdown menu in the “Cite as” section on the Zenodo page.

predsim relies on other software that also should be cited. Below are suggested citations for Seq-Gen and DendroPy, respectively:

  • Rambaut A, Grassly NC. 1997. Seq-Gen: an application for the Monte Carlo simulation of DNA sequence evolution along phylogenetic trees. Comput. Appl. Biosci. 13:235–238.
  • Sukumaran J, Holder MT. 2010. DendroPy: a Python library for phylogenetic computing. Bioinformatics 26:1569–1571.


Markus Englund,

Project details

Release history Release notifications

This version
History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
predsim-0.2.1-py3-none-any.whl (6.8 kB) Copy SHA256 hash SHA256 Wheel py3 May 19, 2018
predsim-0.2.1.tar.gz (8.5 kB) Copy SHA256 hash SHA256 Source None May 19, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page