# Building phylogenies

## Building A Phylogenetic Tree From Pairwise Distances

## Directly via `alignment.quick_tree()`

Both the `ArrayAlignment` and `Alignment` classes support this.

The `quick_tree()` method also supports non-parametric bootstrapping. The number of resampled alignments is specified using the `bootstrap` argument. In the following, trees are estimated from 100 resampled alignments and merged into a single consensus topology using a weighted consensus tree algorithm.

### Using the `DistanceMatrix` object

### Explicitly via `DistanceMatrix` and `cogent3.phylo.nj.nj()``

### Directly from a pairwise distance `dict`

## By Least-squares

We illustrate the phylogeny reconstruction by least-squares using the F81 substitution model. We use the advanced-stepwise addition algorithm to search tree space. Here `a` is the number of taxa to exhaustively evaluate all possible phylogenies for. Successive taxa are added to the top `k` trees (measured by the least-squares metric) and `k` trees are kept at each iteration.

Other optional arguments that can be passed to the `trex` method are: `return_all`, whether the `k` best trees at the final step are returned as a `ScoredTreeCollection` object; `order`, a series of tip names whose order defines the sequence in which tips will be added during tree building (this allows the user to randomise the input order).

## By ML

We illustrate the phylogeny reconstruction using maximum-likelihood using the F81 substitution model. We use the advanced-stepwise addition algorithm to search tree space.

previous

Genetic distance calculation

next

Evolutionary Analysis Using Likelihood