Skip to main content

Forward-time population genetic simulation in Python

Project description

This is the README for fwdpy11, which is a Python package for forward-time population genetic simulation. It uses fwdpp as its C++ back-end.

Build status

Master:

https://travis-ci.org/molpopgen/fwdpy11.svg?branch=master

Development:

https://travis-ci.org/molpopgen/fwdpy11.svg?branch=dev

Manual

Latest/master:

https://readthedocs.org/projects/fwdpy11/badge/?version=latest

Development branch:

https://readthedocs.org/projects/fwdpy11/badge/?version=dev

Features

  • Picklable population objects

  • Parallel computation via multiprocessing or concurrent.futures.

  • Custom temporal samplers to analyze populations during a simulation may be written in pure Python.

Dependencies

The following must be present on your system:

  • GSL. This is a C library. It is available via conda. fwdpy11 requires version 2.2 or greater.

  • pybind11. This should be installed conda as appropriate for your system, or via your system’s package manager or manually. See note below.

  • cmake. This should be installed by conda or your favorite package manager.

fwdpy11 also uses fwdpp, which is included as a submodule.

License

GPLv3 or later (See COPYING)

Suppored Python version

fwdpy11 is written for Python 3. We will not modify the package to be compatible with Python 2.7.

git submodule init
git submodule update
python setup.py build_ext -i
python -m unittest discover tests

Installation

Using pip on OS X and Linux (or pip3 as appropriate for your system):

pip install --upgrade fwdpy11

If you prefer a pip install on OS X using GCC instead of clang:

pip install --upgrade fwdpy11 --install-option=--gcc

You may or may not need to prefix the above with

CC=gcc CXX=g++

depending on whether or not your user’s $PATH is set up to override Xcode’s symlink of gcc to clang.

Caution

We use the GitHub “release” mechanism to make stable versions available. However, GitHub releases to not include the sub-modules, meaning that the releases themselves cannot be used for installation. (A related irony is that the Zenodo DOI for the releases are somewhat meaningless.)

To install a specific release:

  1. Use pip (see above). This is the recommended approach if you do not use conda.

  2. Install from bioconda. This is the recommended approach.

  3. Clone the repo, checkout the release, and update submodules:

git clone http://github.com/molpopgen/fwdpy11
cd fwdpy11
git submodule init
git submodule update

The latter method is probably the least appealing.

We have a strict policy of putting releases on PyPi and bioconda. If there is a release on PyPi but not on bioconda, then that is because we identified a bug and pushed a new release before the bioconda build happend. It happens. That’s life.

Enabling debugging symbols in the C++ code

python setup.py build_ext -i --debug

Debug mode disables all compiler optimizations, allows C-like assertions, and generated debug symbols.

Enabling assertions in the C++ code

The fwdpp library code uses C’s assert macros in several places. These are disabled by default. However, it can be useful to enable them when hacking the code. To do so, you must manually set your compiler flags with cmake:

cmake . -DCMAKE_CXX_FLAGS="-UNDEBUG -O2 -g"

When compiling this way, fwdpy11 makes some extra checks that will throw RuntimeError if they fail. The fwdpp back end also makes extra checks. If those fail, abort will be called, which will crash the Python interpreter. Thus, compiling with this option is a “serious debugging mode only” option.

Bioconda

fwdpy11 is available through bioconda for Linux and for OS X:

conda install -c bioconda fwdpy11

The OS X build is built using gcc.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

fwdpy11-0.2.0.tar.gz (351.9 kB view hashes)

Uploaded Source

Supported by

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