Skip to content

mapDamage

The mapDamage program tracks and quantifies the DNA damage patterns in ancient DNA reads that have been mapped to a reference genome. It can also rescale the base qualities of likely damaged bases, so that they have less weight in later analyses such as genotyping.

License

Free to use and open source under the MIT License.

Available

  • Roihu-CPU: 2.2.3, via the bio-apps module.

Usage

The mapDamage program is part of the bio-apps collection on Roihu. Load the bio-apps module tree and then the mapDamage module:

module load bio-apps/v202603
module load mapdamage/2.2.3

Give mapDamage the alignments (SAM or BAM) and the reference genome the reads were mapped to:

mapDamage -i sample.bam -r reference.fasta

The results are written to a folder called results_sample (set another name with -d). It contains the misincorporation and fragment length tables, the plots Fragmisincorporation_plot.pdf and Length_plot.pdf, and the damage parameters from the Bayesian statistical estimation. The statistical estimation is the slowest step. If you only need the tables and plots, skip it with --no-stats.

To also write a BAM file with rescaled base qualities, add --rescale. The rescaled file is written to the results folder as sample.rescaled.bam, unless you name it with --rescale-out:

mapDamage -i sample.bam -r reference.fasta --rescale

For alignments to a reference with many sequences, --merge-reference-sequences tabulates all sequences together and saves memory and disk space. Run mapDamage --help to see all options.

Example batch script

The mapDamage program runs in one thread.

#!/bin/bash
#SBATCH --job-name=mapdamage
#SBATCH --account=<project>
#SBATCH --output=output_%j.txt
#SBATCH --error=errors_%j.txt
#SBATCH --partition=small
#SBATCH --time=06:00:00
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=8G

module load bio-apps/v202603
module load mapdamage/2.2.3

mapDamage -i sample.bam -r reference.fasta --rescale

Replace <project> with your CSC project (for example project_2001234).

See creating a batch job script for Roihu for more information about running batch jobs.

Support

CSC Service Desk

More information

December 2, 2026