fwdpp

fwdpp is a C++ template library for implementing efficient forward-time population genetic simulations

Home
Library overview
Reference manual
Google Group
Example programs

View the Project on GitHub

The fwdpp home page

This is the homepage for fwdpp, which is a C++ template library for implementing forward-time population-genetic simulations.

What does fwdpp do?

fwdpp provides the high-level abstractions for data types and algorithms that are needed to implement forward-time population-genetic simulations. The abstractions are implemented using modern C++ template programming methods defined by the C++11 language standard.

The goal of fwdpp is to define fundamental concepts in a generic way, such that different models may be implemented via minimal changes in code. For example, data types have specific minimal API requirements, meaning that custom diploid, gamete, and/or mutation types may be easily implemented for your particular modeling needs. Likewise, functions to generate new mutations, deterimine recombination breakpoints, etc., have simple minimum requirements. In combination, custom data types + custom functions work together to generate specific models at compile time.

The compile-time polymorphism described in the preceding paragraph can be further augmented using C++’s support for object-oriented programming. By constructing custom base types for both types and for functions (yes, C++ allows this!), one can also have run-time polymorphism, meaning that different models can be selected based on a command-line interface, for example.

For more information, see the overview of library features.

fwdpy11

The combination of compile- and run-time polymorphism is used in our Python package, fwdpy11, which uses fwdpp as its back-end.

Using fwdpp to develop software.

You can use fwdpp to develop several different types of applications. The simplest type would be a command-line application. The examples in the GitHub repo for this project are all command-line applications. However, complex command-line programs quickly get unwieldy to implement and also to use. It is useful to be able to run simulations in an interpreted environment such as Python or R. Using Python, there are several possible options:

The main difference between boost.python/pybind11 and Cython is that the former provide a “C++-first” perspective on writing Python extension modules. That is, you can write your Python module in idiomatic C++. However, that does not provide the most “Pythonic” experience for the folks using your package. Cython, on the other hand, is Python-first, which causes some frustrations when wrapping C++ code, but ultimately leads to a more extensible package and a Pythonic experience.

It is also possible to use fwdpp from R via the excellent Rcpp package.

Citation

If you use fwdpp for yor research, either to develop simulations or you use the example programs, please cite the following manuscript:

Here it is in Bibtex format:

@ARTICLE{Thornton2014-hx,
  title       = "A C++ template library for efficient forward-time population
                 genetic simulation of large populations",
  author      = "Thornton, Kevin R",
  affiliation = "Department of Ecology and Evolutionary Biology, University of
                 California, Irvine, California 92697",
  abstract    = "fwdpp is a C++ library of routines intended to facilitate the
                 development of forward-time simulations under arbitrary
                 mutation and fitness models. The library design provides a
                 combination of speed, low memory overhead, and modeling
                 flexibility not currently available from other forward
                 simulation tools. The library is particularly useful when the
                 simulation of large populations is required, as programs
                 implemented using the library are much more efficient than
                 other available forward simulation programs.",
  journal     = "Genetics",
  volume      =  198,
  number      =  1,
  pages       = "157--166",
  month       =  sep,
  year        =  2014,
  keywords    = "population genetics; quantitative genetics; simulation",
  language    = "en"
}

Applications of fwdpp

The library has been used for the following software projects:

Publications (that we are aware of…) using fwdpp

Early applications of fwdpp

Early version of the code that eventually became fwdpp were used in the following publications: