Skip to content

Latest commit

 

History

History
84 lines (56 loc) · 6.95 KB

index.md

File metadata and controls

84 lines (56 loc) · 6.95 KB

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.

fwdpy

The combination of compile- and run-time polymorphism is used in our Python package, fwdpy, 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:

  • boost.python. This is one of the oldest means of exposing C++ types to Python. The python_examples directory of the fwdpp GitHub repo contains two examples.
  • pybind11 is a relatively new project attempting to provide a modern (C++11) library to get C++ and Python to work together. It is a very nice project, and essentially replaces boost.python.
  • Cython is a static compiler for Python that allows C++ types to be exposed. This is what we use to develop fwdpy, which exposes a lot of fwdpp to Cython. Those exposed types can be re-used in other projects, or fwdpy itself can be used as a base for your project.

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. In fact, fwdpy started out as an R package, but we migrated to Cython/Python because Cython's grammar makes it easier for users to write their own custom extensions.

Citation

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

  • Thornton, K. R. (2014) A C++ template library for efficient forward-time population genetic simulation of large populations. Genetics 98:157-166 PMID: 24950894, Manuscript, Software

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:

  • fwdpy uses fwdpp to provide an environment for foward simulation in Python. This is a very large-scale project, and is where a lot of our future forward-simulation-related tools will end up.

Publications (that we are aware of...) using fwdpp

  • Sanjak, Jaleal S., Anthony D. Long, and Kevin R. Thornton. 2017. “A Model of Compound Heterozygous, Loss-of-Function Alleles Is Broadly Consistent with Observations from Complex-Disease GWAS Datasets.” PLoS Genetics 13 (1): e1006573. Paper This paper also uses fwdpy for some of the supplementary material.
  • Beissinger, Timothy M., Li Wang, Kate Crosby, Arun Durvasula, Matthew B. Hufford, and Jeffrey Ross-Ibarra. 2016. “Recent Demography Drives Changes in Linked Selection across the Maize Genome.” Nature Plants 2 (June): 16084. Paper

Early applications of fwdpp

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