Skip to content
naulon

No retraction, correction or concern found when last checked on Oct 17, 2026.

CoverM: read alignment statistics for metagenomics

Samuel T N Aroney, Rhys J P Newell, Jakob N Nissen and 3 more

Bioinformatics · 2025 · CC BY

doi:10.1093/bioinformatics/btaf147

Abstract

Summary. Genome-centric analysis of metagenomic samples is a powerful method for understanding the function of microbial communities. Calculating read coverage is a central part of analysis, enabling differential coverage binning for recovery of genomes and estimation of microbial community composition. Coverage is determined by processing read alignments to reference sequences of either contigs or genomes. Per-reference coverage is typically calculated in an ad-hoc manner, with each software package providing its own implementation and specific definition of coverage. Here we present a unified software package CoverM which calculates several coverage statistics for contigs and genomes in an ergonomic and flexible manner. It uses “Mosdepth arrays” for computational efficiency and avoids unnecessary I/O overhead by calculating coverage statistics from streamed read alignment results.

Availability and implementation. CoverM is free software available at https://github.com/wwood/coverm. CoverM is implemented in Rust, with Python (https://github.com/apcamargo/pycoverm) and Julia (https://github.com/JuliaBinaryWrappers/CoverM_jll.jl) interfaces.

Full text

From PubMed Central, U.S. National Library of Medicine, as current on Oct 19, 2026. Paragraph numbers are ours, so an answer can point at one.

1 Introduction

Microbial communities significantly impact the health of our planet and ourselves personally. Through the advent of genome-centric metagenomics, it has become possible to recover complete or near-complete genomes from these populations through deep sequencing of community DNA. Piecing together sequencing reads into metagenome assembled genomes (MAGs) has become increasingly common and high-throughput, with recovery of tens to hundreds of thousands of genomes from a diverse array of environments.

A key step in MAG recovery is binning, where assembled contigs are partitioned into groups representing putative genomes. Commonly, contig abundances across samples are calculated based on alignments of reads to contigs. Contigs with similar abundances across many samples are likely to be from the same genome, enabling improved, sequence-agnostic genome recovery (differential coverage binning). However, the specific algorithms metagenomic binning tools use to derive coverage statistics from read alignments [BAM files] vary substantially. For instance, some use the number of aligned reads divided by contig length. Others calculate a coverage based on the number of reads aligned to each reference position, taking the mean or trimmed mean across all bases in a contig. Still others find approximate coverage using a k-mer counting approach eschewing the alignment step altogether for faster calculation.

The backend data structure used for coverage calculation can also vary. Notably, “Mosdepth arrays” were shown to be two times faster than naive methods for exact calculation of mean coverage. Mosdepth arrays record the change in the number of mapped segments at each position, such that coverage at a given position can be calculated by summing all preceding values.

Recovered MAGs can be used to estimate the community composition by aligning reads to their contigs and calculating coverage statistics across the genome. For example, calculating the mean coverage for a genome is achieved by summing the number of aligning bases across all contigs in a genome and dividing by their total length. Researchers may also opt to apply filters to prevent genomes being deemed present (i.e. having non-zero coverage) on the basis of a small number of positions having aligned reads.

Despite the differences between per-contig and per-genome coverage statistics, they are conceptually similar enough to motivate a single tool that calculates both. Here, we present CoverM, which uses Mosdepth arrays to efficiently calculate a number of per-contig and per-genome coverage statistics.

2 Software implementation

CoverM is a software tool for calculating coverage statistics of contigs or genomes with reads derived from metagenomes or microbial isolates (Fig. 1). It is written in the Rust programming language, relying on independent tools for genome dereplication and read alignment. It makes substantial use of rust-htslib, which provides Rust bindings to HTSlib for parsing intermediate alignment (BAM) files.

CoverM can be compiled locally using the standard cargo method in the Rust ecosystem, by downloading the source code from the repository directly or by downloading a version statically compiled with musl libc from https://github.com/wwood/coverm/releases. Apart from the standard command line version, Python and Julia interfaces to CoverM are also available.

The inputs to CoverM are metagenomic reads (or precalculated BAM files) and reference sequences: either contigs or genomes. Since aligning against multiple near-identical reference genomes can distort read alignments, CoverM uses Galah to dereplicate input genomes, interpreting ANI calculated by skani, FastANI, or Dashing.

Next, the reads are aligned to the reference sequences using Strobealign, Minimap2, or BWA. Spurious alignments can be filtered on the basis of identity, alignment length, or percent of the read aligned. Paired reads can be filtered independently or together with their mate. The filtered alignments are then processed using Mosdepth arrays to calculate a range of coverage statistics (Table 1). The coverage of a genome is aggregated by considering all bases in the genome together. As an additional filtering step, to account for off-target alignment in conserved regions, by default CoverM requires that at least 10% of a genome’s length is covered by at least one read before assigning non-zero coverage.

The default per-genome coverage statistic is relative abundance of each genome [Equation (1)]. The relative abundance of a genome is an estimate of the proportion of the cells in a given sample belonging to the species with that genome. Assuming no bias in DNA extraction, sequencing or read alignment, the ratio of genome copies in a sample is equal to the ratio of their mean coverages. One complication is that in many metagenomes the reference database is incomplete, so many reads remain unaligned. To account for this, the fraction of reads that are unaligned is used to scale the relative abundances of each genome.

In Equation (1), is the estimated relative abundance of the lineage as a percentage, is the calculated mean coverage of that lineage, is the sum of the mean coverage of all genomes, is the number of reads aligning to any genome, and is the total number of reads in the sequencing library. Implicitly, this formula assumes that (i) the average genome size of community members is the same between genomes in the reference set and those that are missing, and (ii) species with reference genomes are roughly complete and uncontaminated.

3 Conclusion

CoverM provides an efficient calculation method for several coverage metrics applicable to contig-based (metagenomic binning) and genome-based (community profiling) tasks. The implementation is flexible, with >50 arguments and options for controlling input/output formats, alignment, filtering, dereplication, and coverage metric.

Conflict of interest: None declared.

References 26

  1. 1.

    Albertsen M, Hugenholtz P, Skarshewski A et al Genome sequences of rare, uncultured bacteria obtained by differential coverage binning of multiple metagenomes. Nat Biotechnol 2013;31:533–8.

    Not in our library10.1038/nbt.2579

  2. 2.
  3. 3.

    Aroney STN, Camargo AP, Tyson GW et al Galah: More scalable dereplication for metagenome assembled genomes. Zenodo 2024., software: not peer reviewed.

    Not in our library10.5281/zenodo.10526086

  4. 4.

    Baker DN, Langmead B. Dashing: fast and accurate genomic distances with HyperLogLog. Genome Biol 2019;20:265.

    Not in our library10.1186/s13059-019-1875-0

  5. 5.
  6. 6.

    Castro JC, Rodriguez-R LM, Harvey WT et al imGLAD: accurate detection and quantification of target organisms in metagenomes. PeerJ 2018;6:e5882.

    Not in our library10.7717/peerj.5882

  7. 7.
  8. 8.
  9. 9.
  10. 10.

    Köster J. Rust-Bio: a fast and safe bioinformatics library. Bioinformatics 2016;32:444–6.

    Not in our library10.1093/bioinformatics/btv573

  11. 11.

    Li H. Aligning sequence reads, clone sequences and assembly contigs with BWA-MEM. arXiv, arXiv13033997 Q-Bio. 2013, preprint: not peer reviewed.

    Not in our library

  12. 12.

    Li H. Minimap2: pairwise alignment for nucleotide sequences. Bioinformatics 2018;34:3094–100.

    Not in our library10.1093/bioinformatics/bty191

  13. 13.

    Li B, Ruotti V, Stewart RM et al RNA-Seq gene expression estimation with read mapping uncertainty. Bioinformatics 2010;26:493–500.

    Not in our library10.1093/bioinformatics/btp692

  14. 14.

    Mortazavi A, Williams BA, McCue K et al Mapping and quantifying mammalian transcriptomes by RNA-Seq. Nat Methods 2008;5:621–8.

    Not in our library10.1038/nmeth.1226

  15. 15.

    Nishimura Y, Yoshizawa S. The OceanDNA MAG catalog contains over 50,000 prokaryotic genomes originated from various marine environments. Sci. Data 2022;9:305.

    Not in our library10.1038/s41597-022-01392-5

  16. 16.

    Nissen JN, Johansen J, Allesøe RL et al Improved metagenome binning and assembly using deep variational autoencoders. Nat Biotechnol 2021;39:555–60.

    Not in our library10.1038/s41587-020-00777-4

  17. 17.
  18. 18.
  19. 19.
  20. 20.

    Pedersen BS, Quinlan AR. Mosdepth: quick coverage calculation for genomes and exomes. Bioinformatics 2018;34:867–8.

    Not in our library10.1093/bioinformatics/btx699

  21. 21.

    Sahlin K. Strobealign: flexible seed size enables ultra-fast and accurate read alignment. Genome Biol 2022;23:260.

    Not in our library10.1186/s13059-022-02831-7

  22. 22.

    Schmidt TSB, Fullam A, Ferretti P et al SPIRE: a searchable, planetary-scale mIcrobiome REsource. Nucleic Acids Res 2024;52:D777–D783.

    Not in our library10.1093/nar/gkad943

  23. 23.

    Shaw J, Yu YW. Fairy: fast approximate coverage for multi-sample metagenomic binning. Microbiome 2024;12:151.

    Not in our library10.1186/s40168-024-01861-6

  24. 24.
  25. 25.

    Sun Z, Huang S, Zhang M et al Challenges in benchmarking metagenomic profilers. Nat Methods 2021;18:618–26.

    Not in our library10.1038/s41592-021-01141-3

  26. 26.

Reads

Read by people on this page

None yet.

Checked or read by AI through naulon

None yet.

A person counts once a day per paper. We keep no cookie and no address: a reader is a hash that changes every day. Any month under five reads shows no number.

Are you an author?

Is this your paper?

Claim it to add your note and be paid when agents cite it. Free.