Genetic distance calculation

Fast pairwise distance estimation

For a limited number of evolutionary models a fast implementation is available.

Computing genetic distances using the Alignment object

Abbreviations listed from available_distances() can be used as values for the distance_matrix(calc=<abbreviation>).

Using the distance calculator directly

The distance calculation object can provide more information. For instance, the standard errors.

Likelihood based pairwise distance estimation

The standard cogent3 likelihood function can also be used to estimate distances. Because these require numerical optimisation they can be significantly slower than the fast estimation approach above.

The following will use the F81 nucleotide substitution model and perform numerical optimisation.

Get the names of sequences with max pairwise distance

Given a DistanceMatrix object, finding the sequences that have the maximum pairwise distance is achieved through the max_pair method.

To find the maximum distance, index the DistanceMatrix with the result of max_pair.

Get the names of sequences with min pairwise distance

Given a DistanceMatrix object, finding the sequences that have the minimum pairwise distance is achieved through the min_pair method.

Note

As the distance between a sequence and itself is zero, and this is not informative, min_pair will return the smallest distance not on the diagonal.

To find the minimum distance, index the DistanceMatrix with the result of min_pair.