Skip to content

Add opt-in Bismark combined-index alignment (--combined_index)#616

Open
FelixKrueger wants to merge 11 commits into
nf-core:devfrom
FelixKrueger:feat/combined-index-alignment
Open

Add opt-in Bismark combined-index alignment (--combined_index)#616
FelixKrueger wants to merge 11 commits into
nf-core:devfrom
FelixKrueger:feat/combined-index-alignment

Conversation

@FelixKrueger

Copy link
Copy Markdown
Contributor

Description

Follow-up to #614, implementing the alignment-mode modernization discussed in #615.

Adds an opt-in --combined_index parameter (default false) that runs Bismark 3.1.0's combined CT+GA index alignment instead of the classic per-strand + --multicore model:

  • Directional/PBAT → --combined_index; non-directional → --combined_index --combined_index_sequential.
  • Parallelised with Bowtie 2/HISAT2 threads (-p) instead of the fork-based --multicore (combined mode rejects --multicore).
  • A one-time combined reference is built during genome prep (bismark_genome_preparation --combined_genome).
  • Applies to the bismark and bismark_hisat aligners.

Default behaviour is unchanged--combined_index is off by default, so existing runs (including AWS iGenomes / pre-built indexes) are byte-identical to before. Combined-index results are concordance-gated (not byte-identical) to the classic model, so this is intentionally opt-in per the #615 discussion; a future default-flip is deferred until combined indexes can be pre-hosted (e.g. nf-core/references).

Changes

  • params.combined_index + nextflow_schema.json entry + a docs/usage.md section.
  • conf/modules/bismark_align.config: inject the per-library combined flags (gated).
  • conf/modules/bismark_genomepreparation.config: build the combined reference with --combined_genome (gated).
  • bismark/align module: use -p (Bowtie 2/HISAT2 threads) in combined mode instead of --multicore. Tracked as an nf-core modules patch (modules/nf-core/bismark/align/bismark-align.diff); the classic --multicore path is unchanged.
  • Launch-time warnings for incompatible combinations (non-bismark aligner, --local_alignment, or a pre-built --bismark_index).
  • New tests/combined_index.nf.test — directional, non-directional, PBAT and HISAT2 scenarios, plus a loud-fail case.

Compatibility note

Pre-built indexes (AWS iGenomes --genome, or a --bismark_index that lacks a Bisulfite_Genome/Combined/ directory) are not compatible with --combined_index and fail with a clear "build it with --combined_genome" message. This is documented, and since the option is off by default, no existing workflow is affected.

Testing

Verified with nf-test -profile test,docker (bismark 3.1.0 container):

  • The 4 combined-index scenarios (directional, non-directional, PBAT, HISAT2) and the loud-fail case all pass; each combined scenario asserts the built Bisulfite_Genome/Combined/* reference is present, confirming combined mode actually engaged.
  • The default suite passes against the existing snapshots with no --update, confirming the classic per-strand path remains byte-identical.

PE combined-index is not exercised here (the pipeline test data is single-end).

Closes #615.

Adds params.combined_index (default false). When enabled and methylseq builds
the index, genome prep builds the combined CT+GA reference (--combined_genome)
and alignment uses --combined_index (directional/PBAT) or
--combined_index --combined_index_sequential (non-directional), driven by
Bowtie 2/HISAT2 -p instead of --multicore (combined mode rejects --multicore).
Default off => the classic per-strand path is unchanged (byte-identical).

- modules/nf-core/bismark/align: add -p when --combined_index present; the
  classic --multicore heuristic is untouched
- conf/modules/bismark_genomepreparation.config: --combined_genome (gated)
- conf/modules/bismark_align.config: per-library combined flags
- nextflow.config + nextflow_schema.json: combined_index param
- tests/combined_index.nf.test: new (snapshot pending native-Docker run)

Concordance-gated (not byte-identical) vs the classic model for all library
types. Requires an index built with --combined_genome; pre-built/iGenomes
indexes are not compatible.
Generated on oxy via nf-test -profile test,docker (bismark 3.1.0 container),
NXF_SYNTAX_PARSER=v1. Both scenarios PASSED (directional 112s, non-directional
43s). The default suite (tests/default.nf.test) passed against the EXISTING
snapshots with no --update, confirming the classic per-strand path is
byte-identical (combined-only -p never fires on the default path).
The combined-index -p resource-model change to the vendored bismark/align
module is now recorded as modules/nf-core/bismark/align/bismark-align.diff
(patch key added to modules.json), so `nf-core pipelines lint` no longer
flags it as out-of-sync and a future `nf-core modules update` won't silently
revert it. Resolves the code-review HIGH finding. (Delivery is local-patch;
the change can be upstreamed to nf-core/modules later and the patch dropped.)
…age)

Addresses the verify-phase coverage gaps:
- save_reference + assert the built Bisulfite_Genome/Combined/BS_combined.*
  is published -> proves combined mode actually engaged (not a silent classic
  fall-through; workflow.success alone can't distinguish the two).
- Add PBAT and bismark_hisat combined scenarios (were untested).
- Add a loud-fail test: combined_index + a pre-built index lacking the combined
  reference must fail (verified it emits Bismark's '--combined_genome' guidance).

Verified on oxy (docker, bismark 3.1.0): all 5 tests PASS; the 4 success
scenarios also pass deterministically against the regenerated snapshot with no
--update (concordance-gated but reproducible). PE combined not exercised (SE test data).
…sh (nf-core#615)

Verify-phase follow-ups (non-blocking recommendations from the dual code review):
- docs/usage.md: add a 'Combined-index alignment' section (what it does, the
  concordance-gated caveat, the iGenomes/pre-built-index incompatibility).
- Launch-time warnings in validateInputParameters(): combined_index with a
  non-bismark aligner / with --local_alignment / with a pre-built --bismark_index.
- nextflow_schema.json: note combined_index is bismark-aligners-only.
- Anchor the aligner guard (/^bismark/) in the align + genomeprep configs.
- Match the combined-index base flag precisely in the module (--combined_index
  not followed by _), so it can't substring-match the _sequential/_parallel
  variants; patch (.diff) updated + reverse-apply-verified against the module.
@FelixKrueger
FelixKrueger requested a review from a team as a code owner July 18, 2026 16:32
@FelixKrueger
FelixKrueger requested a review from sateeshperi July 18, 2026 16:32
@nf-core-bot

Copy link
Copy Markdown
Member

Warning

Newer version of the nf-core template is available.

Your pipeline is using an old version of the nf-core template: 3.5.1.
Please update your pipeline to the latest version.

For more documentation on how to update your pipeline, please see the nf-core documentation and Synchronisation documentation.

`nf-core modules patch` rewrote modules.json with expanded single-element
arrays; prettier (CI's 3.6.2) wants them collapsed. Reformatted with prettier;
no semantic change (the bismark/align patch key is retained).
The combined_index.nf.test snapshot was frozen with Trim Galore 0.6.10 before
nf-core#617 (TG 2.3.0) landed on dev. Regenerated on Nextflow 25.04.0 + docker; all 5
scenarios pass (directional, non-directional, PBAT, HISAT2, loud-fail).
…re#606 merge)

nf-core#606 (template v4.0.2, multiqc 1.32->1.34) landed on dev and was merged into this
branch, re-staling the combined_index snapshot. Regenerated on Nextflow 25.04.0 +
docker against the merged modules (multiqc 1.34 + Trim Galore 2.3.0); all 5
scenarios pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants