Skip to main content

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

Project description

Build-Status Coverage-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 code is contained within a single module that can also be imported using Python’s import mechanism. It 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: https://github.com/jmenglund/predsim


Prerequisites

  • 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.

Installation

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

$ pip install predsim

The project is hosted at <https://github.com/jmenglund/predsim> and can also be installed using git:

$ git clone https://github.com/jmenglund/predsim.git
$ cd predsim
$ python setup.py 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.

Usage

$ predsim --help
usage: predsim [-h] [-V] [-l N] [-g N] [-s N] [-n N] [-o {nexus,phylip}]
               [-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
  -o {nexus,phylip}, --output-format {nexus,phylip}
                        output format (default: "nexus")
  -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.

  • If you have Python version > 3.4, 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_predsim.py

Test coverage can be calculated with Coverage.py using the following commands:

$ coverage run -m pytest test_predsim.py
$ coverage report -m predsim.py

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

$ pycodestyle predsim.py test_predsim.py setup.py

License

predsim is distributed under the MIT license.

Citing

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:

DOI-URI

You can select your preferred citation style 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:

  • 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.

Author

Markus Englund, orcid.org/0000-0003-1688-7112

Project details


Download files

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

Source Distribution

predsim-0.4.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

predsim-0.4.0-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file predsim-0.4.0.tar.gz.

File metadata

  • Download URL: predsim-0.4.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.5

File hashes

Hashes for predsim-0.4.0.tar.gz
Algorithm Hash digest
SHA256 50a9d0d62b1d76ad7e3fa20dae8b23db584d63203915a0b2c791984a846b2701
MD5 c56a11f3fa595d544e02ae979b9a978a
BLAKE2b-256 12589e1bc1fcc72e04ddab3b327daddee59bf1c85644c45d39c87faed2575bd5

See more details on using hashes here.

File details

Details for the file predsim-0.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: predsim-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.5

File hashes

Hashes for predsim-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 59fbe90b74d48c775edc0329c6a990a97f6357f21feeab7762d8b66175e8a7e1
MD5 4ce65cc87c1c714c74276a0c80b065a9
BLAKE2b-256 851800fe2cbe07258f6551e0a06a156b75cb84e7098bbbd5d3f5780a188bcd2f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page