CoverM

Overview

CoverM aims to be a configurable, easy to use and fast DNA read coverage and relative abundance calculator focused on metagenomics applications.

CoverM calculates coverage of genomes/MAGs coverm genome or individual contigs coverm contig. Calculating coverage by read mapping, its input can either be BAM files sorted by reference, or raw reads and reference genomes in various formats.

Version 0.7.0 and 0.8.0 is installed on the CSF.

However, we recommend installing your own local copy in conda environemtn which will install some of the optional packages that our central install doesn’t support. See below for the simple instructions on how to install CoverM in your own CSF3 conda env.

Restrictions on use

CoverM is made available under GPL3+. There are no access restrictions on the CSF but all usage must adhere to that license.

Installing your own CoverM Conda Environment (Recommended)

By installing a copy of CoverM in a local conda environment (in your home directory) you’ll have a more up-to-date version than our central install, and will have all of the necessary and optional bioinf tools called by CoverM.

Please run the following commands on the login node:

module purge
module load apps/binapps/conda/miniforge3/25.9.1

# Create a conda environment named coverm (or whatever name you want - but make a note of it)
conda create -n coverm

Proceed ([y]/n)? y

# Activate the env
conda activate coverm

# Now install coverm into your env (will get the latest release)
conda install coverm

Proceed ([y]/n)? y

# Test
coverm -h

# Deactivate the env to return to your normal login node setup
conda deactivate

When running the application, you should use the following commands in your jobscript:

module purge
module load apps/binapps/conda/miniforge3/25.9.1
conda activate coverm
coverm COMMAND-LINE-FLAGS

See below for complete examples.

Using the centrally installed version

We recommend that you use the Conda Environment method (above) (the centrally installed version may be an old version.)

However, should you wish to use the centrally installed version, load one of the following modulefiles:

module load apps/binapps/coverm/0.8.0
module load apps/binapps/coverm/0.7.0
  #
  # Both of these modulefiles will load automatically the following modulefiles:
  module load apps/gcc/samtools/1.9
  module load apps/binapps/minimap2/2.24
  module load apps/binapps/bwa-mem2/2.2.1
  module load apps/binapps/dashing/1.0.3
  module load apps/gcc/fastani/1.3
  #
  # For version 0.8.0 an additional dependency module is required which is automatically loaded too:
  module load apps/rust/strobealign/0.18.0

# Additionally, you may want to load the following tools manually, if you want CoverM to use them:
module load apps/binapps/skani/0.3.2
module load apps/binapps/rammap/1.1.1

Running the application

Please do not run CoverM on the login node. Jobs should be submitted to the compute nodes via batch.

Serial batch job submission

Ensure that your input files are in the directory from which you wish to run your job.

Create a batch submission script (which will load the modulefile in the jobscript) in the same directory, for example:

#!/bin/bash --login
#SBATCH -p serial        # Partition - run on the nodes dedicated to serial jobs
#SBATCH -n 1             # Number of cores (optional for serial - it's always 1)
#SBATCH -t 4-0           # Job wallclock. Max permitted is 7-0 (7 days, 0 hours)

module purge

# If using your own conda env install:
module load apps/binapps/conda/miniforge3/25.9.1
conda activate coverm

# Or, if using the central install (not recommended)
module load apps/binapps/coverm/0.8.0

coverm genome <GENOME_DESCRIPTION> <MAPPING_INPUT> ..

Submit the jobscript using:

sbatch scriptname

where scriptname is the name of your jobscript.

Parallel batch job submission

Ensure that your input files are in the directory from which you wish to run your job.

Create a batch submission script (which will load the modulefile in the jobscript) in the same directory, for example:

#!/bin/bash --login
#SBATCH -p multicore     # Partition - run on the AMD 168-core nodes dedicated to parallel jobs
#SBATCH -n 8             # Number of cores (can be 2--168)
#SBATCH -t 4-0           # Job wallclock. Max permitted is 7-0 (7 days, 0 hours)

module purge

# If using your own conda env install:
module load apps/binapps/conda/miniforge3/25.9.1
conda activate coverm

# Or, if using the central install (not recommended)
module load apps/binapps/coverm/0.8.0

# $SLURM_NTASKS is set to the number specified on the -n line above
coverm genome -t $SLURM_NTASKS <GENOME_DESCRIPTION> <MAPPING_INPUT> ..

Submit the jobscript using:

sbatch scriptname

where scriptname is the name of your jobscript.

Interactive use

The following is an example of running CoverM interactively at the command-line, on a compute node. It is NOT permitted to run CoverM processing on the login nodes. You MUST use an interactive job.

You should first do the Conda Environment Install of CoverM (see above).

The following commands are taken from the CoverM Demo on their github site.

# On the login node, start with a clean env, then start a (0 days) 1 hour interactive job
# using 8 cores of the AMD 168-core node:
module purge
srun -p interactive -n 8 -t 0-1 --pty bash

# You will now be on a compute node with 8 cores assigned to your job.
# Activate your coverm conda environment
module load apps/binapps/conda/miniforge3/25.9.1
conda activate coverm

# Node go to scratch and download the demo data
mkdir ~/scratch/coverm_demo 
cd ~/scratch/coverm_demo

# Download files
wget https://raw.githubusercontent.com/wwood/CoverM/refs/heads/main/demo/sample_1.1.fq.gz
wget https://raw.githubusercontent.com/wwood/CoverM/refs/heads/main/demo/sample_1.2.fq.gz
wget https://raw.githubusercontent.com/wwood/CoverM/refs/heads/main/demo/genome_1.fna
wget https://raw.githubusercontent.com/wwood/CoverM/refs/heads/main/demo/genome_2.fna
wget https://raw.githubusercontent.com/wwood/CoverM/refs/heads/main/demo/genome_3.fna
wget https://raw.githubusercontent.com/wwood/CoverM/refs/heads/main/demo/genome_4.fna
wget https://raw.githubusercontent.com/wwood/CoverM/refs/heads/main/demo/genome_5.fna
wget https://raw.githubusercontent.com/wwood/CoverM/refs/heads/main/demo/genome_6.fna
wget https://raw.githubusercontent.com/wwood/CoverM/refs/heads/main/demo/genome_7.fna
wget https://raw.githubusercontent.com/wwood/CoverM/refs/heads/main/demo/genome_8.fna

# Next, we can actually run CoverM. We use --coupled to specify the paired-end reads,
# and --genome-fasta-files to specify the genomes. We also specify the number of threads
# to use with -t, and the metrics we want to calculate with -m. We will calculate the mean
# coverage, relative abundance, and covered fraction for each genome in the sample.
# The output will be written to output_coverm.tsv.

coverm genome \
  --coupled sample_1.1.fq.gz sample_1.2.fq.gz \
  --genome-fasta-files \
    genome_1.fna genome_2.fna genome_3.fna genome_4.fna \
    genome_5.fna genome_6.fna genome_7.fna genome_8.fna \
  -t $SLURM_NTASKS \
  -m mean relative_abundance covered_fraction \
  -o output_coverm.tsv

# Check the results - see https://github.com/wwood/CoverM#demo
cat output_coverm.tsv

# Terminate your interactive job, returning to the login node
exit

Further info

Updates

None.

Last modified on July 27, 2026 at 9:52 am by George Leaver