Simulating the coalescent with Biopython and fastsimcoal

While there is a native Python coalescent simulator called CoaSim, this is a very old application that does not run on modern Python versions. As such, if you want to do coalescent simulations with Python, Biopython offers a wrapper to fastsimcoal and the older simcoal.

Here, we will generate some configuration files for fastsimcoal with the demographic and genomic information. We will also run the coalescent simulator from Python.

Getting ready

You will need to obtain fastsimcoal from http://cmpg.unibe.ch/software/fastsimcoal2/. If you are using the Docker image, this is taken care of for you.

If you are using notebooks, this content is in 04_PopSim/Coalescent.ipynb.

How to do it…

Take a look ...

Get Bioinformatics with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.