Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

bwameth.py

bwameth.py is a Python script written by Brent Pedersen that implements bisulfite sequencing (BS-Seq) alignment using the in-silico three-letter genome approach. It converts all cytosines to thymines in both the reference and the reads (C-to-T on the forward strand, G-to-A on the reverse), aligns the converted sequences with bwa-mem (or optionally bwa-mem2), and then recovers the original read sequence from the aligner’s tag output to tabulate methylation. bwameth.py supports single-end and paired-end reads from the directional bisulfite protocol and is published at https://arxiv.org/abs/1401.1129.

When you’d use it

Use bwameth.py when you need a battle-tested, community-supported bisulfite aligner that runs on top of the standard bwa-mem or bwa-mem2 you have already installed, and when you prefer a Python wrapper over a self-contained binary. It also remains the reference for downstream tabulation tools such as MethylDackel and SNP callers such as biscuit that expect the bwameth.py output format. For the actual methylation tabulation and variant calling steps, bwameth.py’s author recommends those dedicated tools rather than the tabulation utilities bundled with the original script.

How it relates to bwa-mem3

bwa-mem3 mem --meth is a single-binary alignment pipeline that, in its default collapsed mode, reproduces bwameth.py’s read placement (it is a placement drop-in, not a byte-for-byte clone). The key difference is where it scores: where bwameth.py converts both reads and reference to 3-letter space and aligns there, bwa-mem3 uses the 3-letter projection only to find seeds, then extends and scores against the original 4-letter reference. That enables a second, opt-in mode — --meth-scoring genomic — which keeps real C/T and G/A variants as mismatches (truthful NM/MD), something a collapsed-space aligner cannot do.

It rewrites the @SQ headers to consolidate the per-strand contig pairs back to canonical chromosome names, emits Bismark-compatible XR:Z / XG:Z / XM:Z auxiliary tags, and writes a @PG ID:bwa-mem3-meth header. The bwameth.py-style chimera QC heuristic is available via --chimera-qc (off by default — Bismark behavior). The Methylation Reference documents the full implementation, including the two --meth-scoring modes, the Bismark tags, and the --set-as-failed / --chimera-qc flags.

Note — external c2t interop was removed

Because scoring runs on the original bases, bwa-mem3 mem --meth can no longer consume pre-converted reads or a .bwameth.c2t reference. Pass raw FASTQ and the original ref.fa prefix; see Migrating from bwameth.py c2t.


See also: Methylation Reference: Overview · Quick start: methylation alignment · Best Practices — Methylation defaults · Migrating from bwameth.py c2t