Calculate pairwise distances between sequences

Section author: Gavin Huttley

An example of how to calculate the pairwise distances for a set of sequences.

Import a substitution model (or create your own)

Load my alignment

Create a pairwise distances object with your alignment and substitution model and run it.

Note that pairwise distances can be distributed for computation across multiple CPU’s. In this case, when statistics (like distances) are requested only the master CPU returns data.

We’ll write a phylip formatted distance matrix.

We’ll also save the distances to file in Python’s pickle format.