#plain-text #k-mer #genome #bio

bin+lib matchtigs

Different algorithms for computing small and minimum plain text representations of kmer sets

23 stable releases

2.1.6 Oct 25, 2023
2.1.5 Jun 27, 2023
1.7.0 May 2, 2023
1.5.5 Dec 8, 2022
1.0.0 Dec 2, 2021

#81 in Compression

26 downloads per month

Custom license

3.5K SLoC

Matchtigs & Eulertigs: minimum plain text representation of kmer sets - with and without repetitions

Version Downloads Docs

Anaconda-Server Badge Anaconda-Server Badge

This is an implementation of different algorithms for computing small and minimum plain text representations of kmer sets. The algorithms expect unitigs as an input, which can e.g. be computed with GGCAT or BCALM2.

If you wish to compute matchtigs or Eulertigs from arbitrary input without computing unitigs yourself first, consider using GGCAT. Its readme mentions the required flags.


  • Compute matchtigs and greedy matchtigs with multiple threads
  • Compute Eulertigs
  • Compute pathtigs (heuristical Eulertigs similar to ProphAsm)
  • Both fasta and GFA format supported, as well as gzip compression if the files end in .gz
  • The annotations in a fasta file output by GGCAT (use -e flag) or BCALM2 (no flag required) can be used to speed up loading (use --bcalm-in instead of --fasta-in)
  • Output (ASCII-) bitvectors of duplicate kmers for applications that require unique kmers


The matchtigs tool can be installed with the following methods. Out of the box, it implements all algorithms but the optimal matchtig algorithm. This is because the optimal matchtig algorithm uses the commercial software blossom V, which is freely available for researchers, but cannot be publicly redistributed. For all practical purposes, we recommend using greedy matchtigs, as they are a lot more efficient to compute, and have very similar cumulative length and string count as matchtigs (see the matchtigs publication linked below).

Installation via conda/mamba

Install matchtigs with

mamba install -c conda-forge -c bioconda matchtigs

Installation via cargo


Rust >= 1.70.0, best installed via rustup.


Install matchtigs with

cargo install matchtigs


Note: Computing minimum matchtigs requires O(|V|^2) memory and is often not feasible in practice. Use greedy matchtigs instead, which are near-optimal.

Computing matchtigs and greedy matchtigs from a fasta file and saving them as GFA (without topology):

matchtigs --fa-in unitigs.fa --matchtigs-gfa-out matchtigs.gfa --greedytigs-gfa-out greedy-matchtigs.gfa

Computing Eulertigs from a GFA file and saving them as both GFA (without topology) and fasta:

matchtigs --fa-in unitigs.fa --eulertigs-gfa-out eulertigs.gfa --eulertigs-fa-out eulertigs.fa

Note: when computing unitigs with GGCAT or BCALM2, it is much faster to use --bcalm-in:

matchtigs --bcalm-in unitigs.fa --eulertigs-gfa-out eulertigs.gfa --eulertigs-fa-out eulertigs.fa

Use the --help option to get an overview of available options.

matchtigs --help


matchtigs (Genome Biology)

Schmidt, S., Khan, S., Alanko, J., Pibiri, G. E., and Tomescu, A. I., Matchtigs: minimum plain text representation of k-mer sets. Genome Biology 24, 136 (2023). 10.1186/s13059-023-02968-z.

Eulertigs (WABI 2022 best paper award)

Schmidt, S. and Alanko, J., Eulertigs: minimum plain text representation of k-mer sets without repetitions in linear time. WABI 2022. 10.4230/LIPIcs.WABI.2022.2.


~495K SLoC