Skip to content

Add --contamination_resource for GetPileupSummaries - #2367

Merged
FriederikeHanssen merged 6 commits into
devfrom
contamination-resource
Nov 4, 2026
Merged

FriederikeHanssen merged 6 commits into
devfrom
contamination-resource

Conversation

@FriederikeHanssen

Copy link
Copy Markdown
Contributor

Closes #959

GATK GetPileupSummaries loads every site of its --variant VCF within each interval into memory. Sarek passed it --germline_resource, which on GATK.GRCh38 is the full af-only gnomAD file. This makes the step slow and causes Java out-of-memory errors, in particular with --no_intervals. GATK recommends a small set of common biallelic SNPs for this step, such as small_exac_common_3.

Changes

  • Add --contamination_resource and --contamination_resource_tbi, used only by GetPileupSummaries in VCF_VARIANT_FILTERING_MUTECT2 (Mutect2 and Parabricks MutectCaller). Mutect2, Parabricks MutectCaller and Sentieon TNscope keep using --germline_resource.
  • Without --contamination_resource, GetPileupSummaries falls back to --germline_resource, so existing runs and snapshots are unchanged.
  • Contamination estimation now runs when either resource is set (germline_resource_provided is renamed to contamination_resource_provided in the local subworkflows).
  • Generate the index with TABIX_CONTAMINATION_RESOURCE when --contamination_resource_tbi is missing, published under reference/contamination_resource with --save_reference.
  • Schema entries, a usage section on providing a contamination resource, and output docs.
  • New nf-test scenario (paired Mutect2) with hapmap_3.pop_stratified_chr21.vcf.gz from test-datasets as contamination resource, without index. It has 19,760 biallelic SNPs with AF, a stand-in for small_exac_common_3.

Not in this PR

  • iGenomes defaults: small_exac_common_3 is not in the ngi-igenomes bucket for GRCh38 or GRCh37. Once the AWS iGenomes maintainers add small_exac_common_3.hg38.vcf.gz and the b37 small_exac_common_3.vcf from gs://gatk-best-practices, contamination_resource can be set for GATK.GRCh38 and GATK.GRCh37 in conf/igenomes.config.
  • The existing warning for Mutect2 without --germline_resource still says contamination estimation is skipped, which is not true when only --contamination_resource is given. Changing it would rewrite the warning snapshots of unrelated tests.

Testing

Run locally with NXF_VER=25.10.4 nf-test ... --profile +docker --verbose:

  • variant_calling_mutect2.nf.test new scenario --germline_resource --contamination_resource somatic: passed, snapshot added. GetPileupSummaries ran with --variant hapmap_3.pop_stratified_chr21.vcf.gz.
  • variant_calling_mutect2.nf.test --germline_resource somatic: passed with the existing snapshot (fallback to gnomAD).

The full suite runs in CI.

PR checklist

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • Make sure your code lints (nf-core pipelines lint).
  • Usage Documentation in docs/usage.md is updated.
  • Output Documentation in docs/output.md is updated.
  • CHANGELOG.md is updated.

🤖 Generated with Claude Code

FriederikeHanssen and others added 2 commits November 3, 2026 19:02
GetPileupSummaries loads every site of its variant VCF within each interval
into memory, so feeding it the full af-only gnomAD germline resource is slow
and runs out of Java heap, in particular with --no_intervals. GATK recommends
a small set of common biallelic SNPs such as small_exac_common_3 instead.

Add --contamination_resource and --contamination_resource_tbi, used only by
GetPileupSummaries after Mutect2 and Parabricks MutectCaller. Without them
GetPileupSummaries falls back to --germline_resource, so existing runs are
unchanged. The index is generated when missing.

Closes #959

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

nf-core pipelines lint overall result: Passed ✅ ⚠️

Posted for pipeline commit a9b66b6

+| ✅ 242 tests passed       |+
#| ❔  15 tests were ignored |#
!| ❗   7 tests had warnings |!
Details

❗ Test warnings:

  • pipeline_todos - TODO string in base.config: Check the defaults for all processes
  • pipeline_todos - TODO string in main.nf: Optionally add in-text citation tools to this list.
  • pipeline_todos - TODO string in main.nf: Optionally add bibliographic entries to this list.
  • pipeline_todos - TODO string in main.nf: Only uncomment below if logic in toolCitationText/toolBibliographyText has been filled!
  • schema_lint - Input mimetype is missing or empty
  • schema_description - No description provided in schema for parameter: markduplicates_pixel_distance
  • schema_description - No description provided in schema for parameter: gatk_pcr_indel_model

❔ Tests ignored:

✅ Tests passed:

Run details

  • nf-core/tools version 4.2.1
  • Run at 2026-11-04 14:26:45

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

❌ nf-test failed with latest Nextflow version

Note

Tests with Nextflow's latest version failed but it will not cause a CI workflow failure.
Please check if the failure is expected with newer (edge-)releases of Nextflow or if it needs fixing.

  • ❌ docker | latest-everything | Shard 3/15

See the full run for details.

FriederikeHanssen and others added 2 commits November 3, 2026 20:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FriederikeHanssen added a commit that referenced this pull request Nov 3, 2026
…error

The warning is superseded by --contamination_resource (#2367): it would
fire for runs that no longer read the germline resource and pointed to
the wrong fix. Reuse intervalsParam() for the --intervals false check and
revert the Parabricks MutectCaller snapshots to dev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FriederikeHanssen added a commit that referenced this pull request Nov 4, 2026
Closes #2131.

In #2131, a WES run passed both `--intervals GRCh38_exome.bed` and
`--no_intervals`. `--no_intervals` silently dropped the exome BED, so
`GetPileupSummaries` fell back to `--intervals
af-only-gnomad.hg38.vcf.gz`. htsjdk turns every site of that VCF into a
CRAM query interval and runs out of Java heap at ~20 GB. More memory
does not fix this.

This PR makes `validateInputParameters()` fail when `--no_intervals` is
combined with a user-provided `--intervals` file, which `--no_intervals`
would never read. Intervals from `--genome` and `--intervals false`
(#2364) are still allowed. The `--intervals false` case reuses
`intervalsParam()` from #2364.

The memory problem of running `GetPileupSummaries` on the full germline
resource is handled by `--contamination_resource` in #2367, so this PR
no longer adds a warning for it.

Other changes:

- The `--tools` help said Mutect2 "cannot be combined" with
`--no_intervals`, which is not true. That line is removed.
- Several variant calling tests set both `intervals` and `no_intervals`.
The ignored `intervals` is removed, so outputs are unchanged.
- New failure test in `intervals.nf.test` for the error.

Checked with `-preview`: the error fires for a user BED, and
`--no_intervals --tools mutect2` with only `--genome` intervals runs
without it.

## PR checklist

- [x] This comment contains a description of changes (with reason).
- [x] If you've fixed a bug or added code that should be tested, add
tests!
- [x] Make sure your code lints (`nf-core pipelines lint`).
- [ ] Ensure the test suite passes (`nextflow run . -profile test,docker
--outdir <OUTDIR>`).
- [ ] Check for unexpected warnings in debug mode (`nextflow run .
-profile debug,test,docker --outdir <OUTDIR>`).
- [x] `CHANGELOG.md` is updated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	CHANGELOG.md
#	docs/output.md
#	subworkflows/local/bam_variant_calling_mutect2/main.nf
#	subworkflows/local/bam_variant_calling_parabricks_mutectcaller/main.nf
#	subworkflows/local/prepare_genome/main.nf
@FriederikeHanssen
FriederikeHanssen merged commit d55c1b0 into dev Nov 4, 2026
97 of 101 checks passed
@FriederikeHanssen FriederikeHanssen mentioned this pull request Nov 4, 2026
2 tasks done
FriederikeHanssen added a commit that referenced this pull request Nov 5, 2026
Corrects the `dev - unreleased` section of the CHANGELOG. Each entry was
checked against its PR.

- **To the developer section:**
- #2345 template update (Developer > Changed, like earlier template
updates).
- #2349 subworkflow refactoring (Developer > Changed). The PR describes
this as "Refactoring (no change in outputs)".
- #2277 `-stub` duplicate emission fix (Developer > Fixed), reworded and
linked to #2280.
- **Kept as user-facing:** the #2349 `MUTECT2_PAIRED` → `MUTECT2`
rename, because custom configs that select `withName: 'MUTECT2_PAIRED'`
need updating.
- **#2339 (Parabricks 4.8.0):** moved out of 3.11.0, since it was merged
after the release. Its `pull/XXXX` link is fixed, and Parabricks 4.7.1 →
4.8.0 is added to the module dependency table.
- **Parameters table:** adds `--force_call_alleles`,
`--force_call_alleles_tbi` (#2365), `--contamination_resource` and
`--contamination_resource_tbi` (#2367).

## PR checklist

- [x] This comment contains a description of changes (with reason).
- [x] `CHANGELOG.md` is updated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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