Illumina 5-Base
Illumina 5-Base (the “5-Base DNA Prep”) is the chemical inverse of bisulfite. The
enzyme converts 5-methylcytosine to thymine and leaves unmethylated cytosine intact,
so the library keeps its full complexity and the raw reads align to the unconverted
genome with a standard aligner. Bismark then calls methylation at inverted polarity: a
read T at a genomic C is methylated (Z), a read C is unmethylated (z).
The mode is opt-in behind --illumina_5base and is paired-end only (the 5-Base
library is paired-end and directional; single-end input is rejected at startup). Since 3.5.0
it aligns with bwa-mem3 only; the minimap2, Bowtie 2 and HISAT2 engines
of 3.3.0 and 3.4.0 are gone (see why).
For TAPS libraries, which also convert methylated C to T, use --taps:
the same calling path with bwa-mem3 in its TAPS mode.
Stability contract
Section titled “Stability contract”5-Base is not byte-identical to anything: Perl Bismark has no 5-Base path, so there is
no byte-for-byte oracle. It is instead concordance-gated, the same contract as the
--rammap and --combined_index paths:
- Supported in GA (since 3.0.0):
--illumina_5base(core),--five_base_duplex,--five_base_consensus,--five_base_consensus_from_bam,--five_base_deconvolution. Each is validated against Illumina DRAGEN on the real NA12878 demo at full depth (524M pairs), with the bwa-mem3 engine (the only engine since 3.5.0), by the metric appropriate to what it produces: core by per-CpG concordance with DRAGEN’s (deduplicated, full-depth) CX report (deduplicated, iso-DRAGEN) — r 0.995 over 55.6M CpGs (0.999 at cov>=10), 99.7% call-agreement at cov>=10 (99.5% at cov>=1); deconvolution by variant precision/recall vs DRAGEN’s germline VCF — 94.0% / 96.9%; duplex / consensus (per-molecule collapse — DRAGEN builds a duplex-consensus methylation track only for UMI/enrichment kits, so there is no WGS consensus-CX to correlate against) by per-strand mean-methylation agreement with DRAGEN (duplex own-strand 49.5% vs 49.7%; consensus 49.9% vs 50.1% on each strand). All four are additionally held to a reproducible lambda/pUC19 spike-in gate that runs in CI with no proprietary data. With minimap2 (the default engine before 3.5.0) the full-depth core figures were r 0.991 (0.998 at cov>=10) and 98.8% (99.3%); both engines are compared on lane 1 of NA12878 and HG002 invalidation/VALIDATION_REAL_DATA.md. - Preview:
--five_base_umi_qname(duplex UMI taken from the read name). It works and is exercised on real data, but is not yet held to the same gated contract. - Unchanged: the faithful bisulfite / EM-seq suite is byte-frozen. Every legacy
methylation call still reduces to the exact Perl v0.25.1 output (the
perl-oracleCI gate stays green); turning 5-Base on never perturbs a bisulfite run.
Because it is concordance-gated rather than byte-identical, every 5-Base path is opt-in and
never silent: an unsupported combination (single-end, --non_directional, --pbat,
--combined_index, --ambiguous, --ambig_bam) is rejected loudly rather than silently degraded.
--unmapped writes the pairs that gave no usable proper pair (a mate unmapped, or the mates on one
strand, on two contigs or pointing apart), exactly as they appear in the input; pairs with several
alignments stay in the BAM, and pairs at a chromosome end go to neither.
CpG-dense methylated regions
Section titled “CpG-dense methylated regions”5-Base reads align to the unconverted genome, so to an ordinary aligner each methylated CpG (read
T, genome C) is a mismatch. A read from a CpG-dense, heavily methylated region can carry enough
of them that it no longer aligns, while the same fragment unmethylated aligns normally, so
methylated reads are lost there selectively. This is what the minimap2 and Bowtie 2 engines of
3.3.0 and 3.4.0 did (HISAT2 was not measured).
On the NA12878 and HG002 demo data, compared with a methylation-invariant alignment of the same reads and with DRAGEN, those engines gave:
- CpGs in sparse and moderate CpG density (up to about 9 CpGs per 151 bp, around 85% of CpGs) are unaffected.
- Partly methylated CpGs at 15 or more CpGs per 151 bp read 6–11 points low.
- The densest, most methylated CpGs (15 or more per 151 bp, ≥80% methylated) keep only 40–50% of the expected coverage, and 20–35% of them get no coverage at all.
- Global CpG methylation (the report’s “% CpG methylated”) reads about 1–1.6 points low.
The regions affected are methylated CpG islands: imprinted regions, CpG islands on the inactive X, and hypermethylated islands in cancer or cfDNA samples. Their genome-wide concordance with DRAGEN still held: these regions are too small a share of all CpGs to show up in it.
This is why 5-Base aligns with bwa-mem3 only. bwa-mem3’s
methylation-aware mode does not count a read T at a genomic C as a mismatch. On lane 1 of the
same two samples it keeps 1.01–1.03× DRAGEN’s depth in the densest, most methylated CpGs (minimap2:
0.49–0.50×), and 2.4–3.0% of them get no coverage (minimap2: 27–29%).
Running it
Section titled “Running it”Directional, paired-end, against the unconverted genome, with bwa-mem3
(methylation-aware). It needs its index, built once with bismark prepare --bwamem3 <genome>
(about 1 h and 104 GB of RAM for GRCh38), or one given as --five_base_index, and stops before
aligning if the index or the bwa-mem3 binary is missing. --bwamem3 is optional. Outputs are
named <sample>_bismark_bwamem3_pe.bam.
--minimap2, --bowtie2, --hisat2, --rammap, their --path_to_* folders and the
minimap2, Bowtie 2 and HISAT2 tuning options stop a 5-Base run before anything is read or
written. A 3.3.0 or 3.4.0 command line that used them (including --minimap2, the default before
3.5.0) needs them dropped and the bwa-mem3 index built once. Pipelines that pass
--illumina_5base through extra arguments, such as the nf-core bismark/align module’s
ext.args, need the bwa-mem3 index in the genome folder or --five_base_index.
--genome needs the genome FASTA, the reference the methylation calls are made against, and
the Bwamem3_Index/ folder bismark prepare --bwamem3 writes into it (unless
--five_base_index is given). No path here reads the bisulfite-converted indexes, so the
bisulfite genome preparation is not needed.
--five_base_index is checked before the run starts, so a missing or incomplete index fails
immediately rather than part-way through alignment. A Bowtie 2 or HISAT2 index given there
(also one found under $BOWTIE2_INDEXES / $HISAT2_INDEXES) is named as such.
# once per genome: the bwa-mem3 methylation index (writes /path/to/GRCh38/Bwamem3_Index/)bismark prepare --bwamem3 /path/to/GRCh38
# core: align with bwa-mem3 + inverted-polarity methylation callsbismark --illumina_5base --genome /path/to/GRCh38 -1 R1.fastq.gz -2 R2.fastq.gzEngines before 3.5.0
Section titled “Engines before 3.5.0”3.3.0 and 3.4.0 also aligned 5-Base reads with minimap2 (their default), Bowtie 2 and HISAT2. They were compared on the first 100M read pairs of the NA12878 demo (Sample8, 100 ng; 98.1M pairs after trimming), each scored per CpG against DRAGEN’s CX report. Pearson r uses the 400,760 CpGs that every engine and DRAGEN cover at cov ≥ 10; the CpG column counts each engine’s own CpGs at cov ≥ 10 in both it and DRAGEN.
| Engine | Mapping efficiency | Pearson r vs DRAGEN | CpGs at cov ≥ 10 | Peak memory |
|---|---|---|---|---|
| minimap2 | 95.2% | 0.9646 | 817,312 | 15.5 GiB |
Bowtie 2 (-X 800, its 5-Base default) |
94.5% | 0.9643 | 822,432 | 8.4 GiB |
Bowtie 2 -X 500 |
87.9% | 0.9631 | 554,655 | 8.4 GiB |
Bowtie 2 --local -X 500 |
91.2% | 0.9635 | 580,613 | 8.4 GiB |
| HISAT2 | 91.3% | 0.9631 | 664,790 | 8.3 GiB |
This depth is about 5× per strand, so cov ≥ 10 is the high-coverage tail and r is lower than the full-depth figure in the stability contract. A 500 bp insert cap costs Bowtie 2 about 7 points of mapping efficiency and a third of its well-covered CpGs on this library; at its 800 bp default (minimap2’s own limit) it is level with minimap2. On HG002 the 800 bp default raised mapping from 90.5% to 94.5% and CpGs at cov ≥ 10 by 30%. minimap2 used about twice the peak memory. The engine comparison covers one 5-Base WGS gDNA library (NA12878), and the Bowtie 2 insert-cap result was repeated on a second (HG002); short-fragment libraries such as cfDNA were not tested.
bwa-mem3 is not in this table. It was compared with minimap2 on lane 1 of NA12878 and HG002
(66M and 82M pairs, the same Bismark binary, scored against DRAGEN the same way): Pearson r
0.929 vs 0.920 and 0.949 vs 0.944 on the CpGs both engines and DRAGEN cover at cov ≥ 10,
12–15% more CpGs at cov ≥ 10, mapping efficiency 96.7% vs 93.7% and 93.7% vs 90.9%, and
mean CpG methylation within 0.2 points of DRAGEN (minimap2: 0.9–1.3 points low). On one lane
with the deconvolution, duplex and consensus modes on, the largest process peaked at
26.4–26.5 GiB at 24 threads (minimap2: 17.5–20.3 GiB). The full
comparison is in validation/VALIDATION_REAL_DATA.md.
The emitted BAM is standard Bismark convention (XM/XR/XG), so the extractor,
bismark2bedGraph, coverage2cytosine, and the reports consume it unchanged.
bwa-mem3 (--bwamem3)
Section titled “bwa-mem3 (--bwamem3)”bwa-mem3 (0.16.0 or later) has a methylation-aware 5-Base mode
(mem --meth=5base) that does not penalise a read T at a genomic C, so methylated reads
from CpG-dense regions align as well as unmethylated ones (see the
CpG-dense methylated regions). bwa-mem3 only places the
reads; Bismark makes the methylation calls.
It is the only 5-Base engine since 3.5.0. It costs more than the engines before it (see Engines before 3.5.0):
| bwa-mem3 | |
|---|---|
| Index | bismark prepare --bwamem3 <genome> (or bwa-mem3 index --meth --meth-only genome.fa with bwa-mem3 0.18.0+, --meth alone before): about 1 h and about 104 GB RAM for GRCh38 |
| Index on disk | about 23 GB for GRCh38: the 7 files bismark prepare --bwamem3 keeps, and all that bwa-mem3 0.18.0’s --meth-only writes. A plain bwa-mem3 index --meth also writes genome.fa.bwt.2bit.64 (10.4 GB), and 0.16.0/0.17.0 also genome.fa.meth.fa (6.3 GB); both can be deleted. Rebuilding into an existing prefix with 0.18.0 needs --force |
| Alignment memory | bwa-mem3 0.16.0’s own RSS (about 28 GiB at 32 threads; it grows with threads, and without -p all CPUs are used) plus about 3.2 GB for Bismark’s copy of the genome; a full-depth run with the duplex, consensus and deconvolution modes needed more (see Advanced modes) |
| Runtime | about 38–39 min per 95–98M pairs at 32 threads (bwa-mem3 0.16.0 alone) |
bismark prepare --bwamem3 <genome> writes the index to <genome>/Bwamem3_Index/, keeping
only the 7 files bwa-mem3 reads, and the aligner uses it when --five_base_index is not given.
--five_base_index also takes such a folder from another genome folder built from the same FASTA.
Genome preparation rejects, before indexing, sequence lines with spaces, tabs, other whitespace or non-ASCII bytes, lines starting with + or @, empty contigs and CR-only line ends, all of which bwa-mem3 reads differently from Bismark; LF and CRLF files are fine.
For an index built by hand, pass the FASTA path it was built from as --five_base_index, and
keep it out of the top level of the --genome folder, so its files are not mistaken for genome
FASTA. Build either from the same FASTA as the --genome folder: Bismark compares the index’s
contig names and lengths with the genome folder before it starts, and the engine’s @SQ lines
again at run time, and stops on any difference. The index is loaded once per mate-pair file pair.
An index built by nf-core’s bwamem3/index module or given to nf-core/methylseq as
--bwamem3_index works as it is.
Bismark fixes every bwa-mem3 option that affects placement (--meth-scoring neutral --meth-context all --meth-seed-prune=spec30), because bwa-mem3’s defaults have changed
between releases, and it ignores $BWAMEM3_METH_SEED_PRUNE. The Bowtie 2 and minimap2
tuning options and --local are rejected. -p N sets bwa-mem3’s threads; otherwise
--multicore N does when N is greater than one, and with neither (or --multicore 1) Bismark
uses the available logical CPUs. Input order is preserved. Versions before 0.16.0 are rejected; 0.16.0, 0.17.0 and 0.18.0 are validated, and other
versions run with a warning. The BAM records the bwa-mem3 version and command line in a
@PG ID:bwa-mem3 line, and the report states the version.
Bismark keeps proper pairs at any MAPQ; about 5% of bwa-mem3’s records have MAPQ 0. MAPQ is the
engine’s own score, so a MAPQ filter (including --five_base_min_mapq) does not keep the same
reads as on a minimap2 run before 3.5.0. Dovetailed
pairs are kept too, but bases that run past the mate’s 5’ end are adapter read-through rather than genome, so they are not called; the report counts them as
“Dovetail overhang bases not called”. Pairs whose mates point
apart are rejected, and the report counts them under “Proper pairs rejected” and as pairs with
no alignment.
With --five_base_umi_len N, the first N bases of each mate are never called, including bases
the engine aligned rather than soft-clipped. The UMI and overhang masks apply to
the core calls (XM, and everything the extractor reads) and to --five_base_duplex,
--five_base_consensus and --five_base_deconvolution, which find the masked read ends in the
mk:B:I tag (bases masked at the 5’ and 3’ end of the read). A BAM written by an earlier
version has no mk tag, so --five_base_consensus_from_bam still counts those bases in it.
Before Bismark validates a newer bwa-mem3, the per-CpG comparison with a validated version is re-run on 1M read pairs; until then, other versions run with the warning above.
Advanced modes
Section titled “Advanced modes”Real 5-Base libraries carry a dual UMI in the read name and sequence each molecule as two strand-partner read pairs. These modes use that structure:
--five_base_deconvolutionseparates a genuineC>T/G>Agenetic variant from 5mC using both strands (DRAGEN’s rule: methylation moves only one strand, a variant moves both). Writes a per-CpG report; variant CpGs are excluded from the methylation totals.--five_base_duplexgroups the two strands of each molecule into a duplex family (keyed on the fragment span plus the canonical dual UMI) and reconciles the 5mC signal per molecule.--five_base_consensuscollapses each duplex family to one consensus record per molecule, scoring both strands of every CpG.--five_base_consensus_from_bamre-runs the duplex-consensus collapse over one or more already-aligned 5-Base BAMs (same output as--five_base_consensus, skipping re-alignment).--five_base_umi_qname(preview) takes the duplex UMI from the read name (the real Illumina form,A+Bwith the partner swapped) instead of an inline read prefix.--five_base_emit_multiplicity {duplex|simplex|both}selects which consensus families are emitted (see below).duplexis the default.
With bwa-mem3 at 24 threads, a run with --five_base_deconvolution --five_base_duplex --five_base_consensus peaked at 118.5 GiB on NA12878 at full depth (524M pairs), and at
26.4–26.5 GiB on one lane of NA12878 or HG002 (66M or 82M pairs). These are the largest single
process as GNU time reports it; which of the three modes needs the extra memory was not measured.
# duplex consensus from the real dual-UMI in the read namebismark --illumina_5base --five_base_umi_qname --five_base_consensus \ --genome /path/to/GRCh38 -1 R1.fastq.gz -2 R2.fastq.gzSimplex molecules: --five_base_emit_multiplicity
Section titled “Simplex molecules: --five_base_emit_multiplicity”A duplex family needs the molecule to be seen from both strands. Molecules seen from one
strand only are counted and, by default, discarded — on shallow input such as cfDNA that is
most of the library. --five_base_emit_multiplicity mirrors DRAGEN’s
--umi-emit-multiplicity:
| Mode | Emits |
|---|---|
duplex (default) |
<out>.5base_consensus.bam — duplex families, two records each |
simplex |
<out>.5base_simplex.bam — single-strand families, one record each. No duplex BAM |
both |
both files |
A simplex family still contains every PCR copy of its strand, so the collapse deduplicates
and error-corrects; only the cross-strand check is missing. In simplex and both modes every
consensus record carries mx:i (2 = duplex, 1 = simplex — unrelated to the XM call
string), so the two classes stay distinguishable even after a samtools merge. Each record is
emitted on its molecule’s own strand: the opposite-strand record would report calls for a
strand that was never sequenced.
The run reports how many single-strand families were found and their read-count distribution
(a family can hold a single read: --five_base_min_mapq filters per record, so one mate of a
pair can be dropped while the other survives).
Interop: --five_base_bisulfite_bam (for wgbs_tools / UXM)
Section titled “Interop: --five_base_bisulfite_bam (for wgbs_tools / UXM)”Some downstream tools read methylation out of the BAM’s SEQ rather than out of XM. The
clearest example is wgbs_tools — its bam2pat
compares the read base at each CpG against the reference (C/G = methylated, T/A = not),
which is why it needs a genome. 5-Base SEQ holds the raw read and 5-Base chemistry is the
inverse of bisulfite, so those tools produce systematically inverted calls on 5-Base data —
not noisy, inverted.
--five_base_bisulfite_bam re-encodes an existing 5-Base BAM into bisulfite convention: at
each called cytosine the base becomes what bisulfite chemistry would have produced, taken from
the XM tag Bismark already wrote. It needs no genome and no re-alignment, and XM is left
untouched — so the output is still readable by Bismark’s own extractor, and bam2pat --ds_test
(which does read XM) keeps working.
# re-encode, then sort + index: bam2pat REFUSES a BAM that is not SO:coordinatebismark --illumina_5base --five_base_bisulfite_bam sample_pe.bamsamtools sort -o sample_pe.bisulfite.sorted.bam sample_pe.bisulfite.bamsamtools index sample_pe.bisulfite.sorted.bamwgbstools bam2pat --genome hg38 sample_pe.bisulfite.sorted.bamThe genome you aligned against must use the same chromosome naming as your
wgbstools init_genome (so chr1, not 1). A total mismatch fails early and loudly; a
partial one silently drops the contigs that do not match.
The run reports a flip rate, which is exactly 1.000 for 5-Base input and 0.000 for
bisulfite input, because every called position necessarily changes under inversion. Anything in
between means the input is mixed or partly converted, and the run fails rather than writing a
file that is half one convention and half the other. Running the converter on an ordinary
bisulfite BAM is therefore a no-op by construction, and that identity is a CI gate.
Validation
Section titled “Validation”The concordance evidence (per-CpG Pearson r and call-agreement vs DRAGEN, and the
deconvolution precision/recall vs DRAGEN’s germline VCF) and a reproducible runbook live in
the repository at validation/VALIDATION_REAL_DATA.md, with the
validation/concordance.py harness. The deterministic floor (lambda unmethylated control
reads near 0%, pUC19 CpG-methylated control reads high) is locked by the
five_base_controls_* gates that run in CI.