Getting started with ∂a∂i for Windows Users
Learn how to install ∂a∂i under a Windows environment
Note: This post was written before the Windows Subsystem for Linux (WSL) was released. I now highly recommend Windows users interested in dadi (or bioinformatics of any kind) use Anaconda via the WSL instead of trying to work with Windows natively. See here for a guide on how to set this up for yourself!
∂a∂i is a powerful and flexible population genetics model-fitting package for Python 2.X written by Ryan Gutenkunst. It is a popular tool used in population and evolutionary genetics research for evaluating the fit of demographic models to DNA polymorphism data.
∂a∂i is slightly unusual that it is a Python package rather than a standalone piece of software. This makes using ∂a∂i an interactive process, particularly if one uses a dynamic coding platform such a Jupyter notebook.
∂a∂i also has extremely handy functions that allow you to call the program ms by Richard Hudson via Python in order to simulate data. So ms and a working Python 2.7 (32 bit) installation are both prerequisites, which in turn have other prerequisites.
I normally use Mac OS and/or a Linux computing cluster for my day-to-day scientific computing. However, I recently installed ∂a∂i and all its dependencies from scratch on my Windows 10 PC. It was bit of a saga, and I wanted to share the exact steps I took, so as to ease the process for others.
Things that need to be installed (if you don’t have them already):
- Anaconda 2.7 (32 Bit version)
- The gcc compiler
Install Anaconda 2.7 (32 bit)
Anaconda is a pre-packaged version of Python maintained by Continuum Analytics. It includes a number of useful scientific packages, utilities, and a package manager in a single installation.
Uninstall any previous versions of Anaconda + restart Windows.
Install using the 32 bit Anaconda installer available here.
Install Cygwin + gcc compiler
ms requires compilation from source. If you do not have a compiler installed, installing Cygwin will allow you to quickly install the gcc compiler. Cygwin also gives access to many Linux-like utilities.
To install Cygwin, Follow Steps 1 & 2 here.
After installing Cygwin, move the setup-x86_64.exe file you used to install Cygwin to the folder where you chose install Cygwin. Navigate to that folder in a command prompt. To install gcc, type:
setup-x86_64.exe -q -P wget -P gcc-g++ -P make -P diffutils -P libmpfr-devel -P libgmp-devel -P libmpc-devel
Add the cygwin64/bin folder to your system path.
Install Richard Hudson’s ms
Download and extract the zipped version of ms from the ms website.
Navigate to the folder where you extracted ms, and run:
gcc -o ms ms.c streec.c rand1.c -lm
Add the folder containing ms.exe (the ms folder) to your system path.
Install the latest version of ∂a∂i
Go here: https://bitbucket.org/gutenkunstlab/dadi/downloads/ and choose “download repository” (not the .exe).
Extract the contents to a folder (anywhere).
Navigate to the extraction folder in a command prompt. Then type:
python setup.py install
Scan the output of this command for errors. Depending on the state of your system, you may need to install Visual Studio 9.0 C++ (follow the URL given in error message).
Run the ∂a∂i example analysis
To confirm your installation works, run the example analysis provided in the repository you downloaded.
Copy the “example/YRI_CEU” folder from the extracted repository to a new folder (anywhere).
Open the Jupyter application.
In the file browser tab Jupyter opens, navigate to the newly created YRI_CEU folder and Create a new Python 2 notebook. This will open a new tab with a Python 2 notebook.
Open the ‘YRI_CEU.py’ script from the Jupyter file browser. This will open the script in a separate browser tab.
Copy, paste and run (logically-selected) chunks of code from the .py to your new Python 2 notebook.
Check for error messages + troubleshoot if necessary.
If the gods have smiled on you, you should now how a functioning installation of ∂a∂i. Before diving into an analysis, I highly recommend the following references by Ryan Gutenkunst et al.: