Welcome to FFPopSim

C++/Python library for population genetics.

This library offers two simulation packages for population genetics: one for low-dimensional simulations (up to ~15 loci) and one for high-dimensional ones.

Each package is based on a big class that represents a population:

  • haploid_lowd for low-dimensional populations
  • haploid_highd for high-dimensional simulations

A simple example routine is the following:

#####################################
#   EXAMPLE SCRIPT                  #
#####################################
import numpy as np
import matplotlib.pyplot as plt
import FFPopSim as h

c = h.haploid_lowd(4)
c.set_allele_frequencies([0,0.3,0.6,0.9], N=1000) 
c.evolve(100)
c.plot_diversity_histogram()
plt.show()
#####################################

which evolves a population with 4 loci for 100 generations starting from fixed allele frequencies, under neutral conditions, and plots the diversity histogram afterwards.

For more usage examples, please consult the tests and examples folders.

Documentation

In addition, the underlying C++ library is documented here. Note that some objects and functions have slightly different names in C++ and Python.

Examples

Usage examples of FFPopSim can be found at the following pages.

The descriptions focus on FFPopSim and tend to ignore aesthetic aspects of the scripts such as figures, labels, et similia. This also means that glueing together the various code chunks found at those pages will not produce exactly the same figures; neither is this necessary at all, because the full source code for all examples (and more) can be found in the examples folder.

Note

examples are ordered by increasing complexity.

Indices and tables

Table Of Contents

Next topic

Requirements

This Page