# cgMLST Tree

## About

For some species Pathogenwatch uses the cgMLST profiles generated by the inhouse cgMLST tool to build allele distance-based Neighbour Joining trees for genomes in a collection. The distances correspond to those used in the [cgMLST clustering tool](/pathogenwatch/technical-descriptions-of-analysis-tools/trees-clustering-and-context-search/cgmlst-clustering.md).

## Method

### Profile construction

For details about how cgMLST profiles are constructed in Pathogenwatch see the [cgMLST description page](/pathogenwatch/technical-descriptions-of-analysis-tools/lineage-and-genotyping/cgmlst.md). A cgMLST profile consists of a list of gene loci with one allele code or a "gap" assigned to each.

### Distance scoring

The distance is calculated by determining the number of differences over the number of positions in common (i.e. not gaps in both) between the two profiles being compared. Each profile is compared against each other to produce a matrix of distance scores.

### Tree construction

The matrix is then used to create a Neighbour Joining tree using the [FASTME software](http://www.atgc-montpellier.fr/fastme/). The resulting dendogram is mid-point rooted using [Biopython](https://biopython.org/).

## Code repository

The software can be found at <https://github.com/pathogenwatch-oss/cgmlst-tree>.

## Citations

### FASTME

Vincent Lefort, Richard Desper, Olivier Gascuel, FastME 2.0: A Comprehensive, Accurate, and Fast Distance-Based Phylogeny Inference Program, *Molecular Biology and Evolution*, Volume 32, Issue 10, October 2015, Pages 2798–2800, <https://doi.org/10.1093/molbev/msv150>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cgps.gitbook.io/pathogenwatch/technical-descriptions-of-analysis-tools/trees-clustering-and-context-search/cgmlst-tree.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
