Skip to content

About

Fast genome comparison with Mash, from assemblies or reads: distance matrix, UPGMA/NJ/ME trees with bootstrap support, and interactive PCoA

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

genome_comparator logo

genome_comparator

Tests Release PyPI Coverage Python 3.10–3.14 License Documentation DOI

Quickly compare and visualize distances between genomes, from assemblies (fasta) or reads (fastq), using Mash. Produces a distance matrix, trees (UPGMA, neighbour joining, minimum evolution) with optional bootstrap support, and an interactive PCoA plot.

Neighbour joining tree of 22 Listeria genomes with bootstrap support values PCoA of 22 Listeria genomes coloured by species
22 public Listeria genomes from the tutorial: 3 seconds, or under 2 minutes with 100 bootstrap replicates.

Features

  • Assemblies or reads: fasta or fastq (gzipped or not), paired-end reads combined per sample.
  • Fast and scalable: thousands of genomes; sketches are computed in parallel, and adding genomes to an existing run only sketches them and measures their distances.
  • Trees: UPGMA, neighbour joining and minimum evolution, with optional bootstrap support.
  • Clusters at any distance thresholds, e.g. species (~95% ANI) or near-identical strains.
  • iTOL annotations: colour strips for the metadata and clusters, to drag and drop on the trees.
  • Interactive PCoA with metadata on hover and colourblind-friendly colouring by any metadata column.
  • Safe by default: ambiguous sample names and unreadable files are reported, never silently merged or ignored.

How it works

flowchart LR
    A[fasta / fastq files] -->|mash sketch| B[one sketch per sample]
    B -->|mash triangle| C[pairwise distance matrix]
    C --> D[UPGMA / NJ / ME trees]
    C --> E[PCoA plot]
    B -. re-sketch with other hash seeds .-> F[bootstrap replicates]
    F -. support values .-> D
Loading

Installation

With pip. Mash is not available from PyPI: install it separately (e.g. conda install -c bioconda mash).

pip install genome-comparator

Or from source, in a conda environment that includes Mash:

git clone https://github.com/duceppemo/genome_comparator
cd genome_comparator
conda env create -f environment.yml
conda activate genome_comparator
pip install --no-deps .

Quick start

genome-comparator -i /input/folder/ -o /output/folder/ --nj --pcoa

New to the tool? Follow the tutorial: it downloads 22 public genomes and walks through every output in a few minutes.

Documentation

The wiki covers usage and options, output files, interpreting the results, bootstrap support, performance, related tools, troubleshooting and the FAQ.

Citing

If you use genome_comparator, please cite it and Mash, which computes the distances:

Duceppe M-O. genome_comparator: fast comparison and visualization of genome distances with Mash. Zenodo. https://doi.org/10.5281/zenodo.22920856

This DOI always points to the latest version; each release also has its own DOI, listed on Zenodo. GitHub's "Cite this repository" button gives the same citation in APA and BibTeX formats.

Ondov BD, Treangen TJ, Melsted P, Mallonee AB, Bergman NH, Koren S, Phillippy AM. Mash: fast genome and metagenome distance estimation using MinHash. Genome Biology 17, 132 (2016). https://doi.org/10.1186/s13059-016-0997-x

Contributing

Bug reports, questions and pull requests are welcome: see CONTRIBUTING.md.

Author

Marc-Olivier Duceppe, Canadian Food Inspection Agency (CFIA): marc-olivier.duceppe@inspection.gc.ca

License

MIT

About

Fast genome comparison with Mash, from assemblies or reads: distance matrix, UPGMA/NJ/ME trees with bootstrap support, and interactive PCoA

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages