Repository navigation
Fix/52 pcgr skip high variant count - #32
Conversation
When select_pcgr_variants cannot bring the PASS count below MAX_SOMATIC_VARIANTS via tiered filtering it raises RuntimeError, aborting the entire report step. This left sash with no usable SMLV_SOMATIC_REPORT output for samples with very high variant counts (e.g. L2100242 with 595,416 PASS variants — high CNA complexity, not a true hypermutator). Catch the RuntimeError, log a warning, and skip prepare_vcf_somatic and run_somatic. Non-PCGR outputs (bcftools stats, AF distributions, variant counts) continue to publish. Companion sash change marks the PCGR emits as optional. Refs: umccr/sash#52
Add three tests: - select_pcgr_variants raises RuntimeError when all SAGE_HOTSPOT variants (RETAIN_FIELDS) make tiered filtering impossible - entry() skips prepare_vcf_somatic + run_somatic when the RuntimeError is caught (core of the sash #52 fix) - entry() calls run_somatic normally when count is within the limit (regression guard)
PCGR writes PCGR_MUTATION_HOTSPOT=. (Type=String placeholder) on every non-hotspot variant. cyvcf2 returns the string '.' which Python evaluates as truthy, so any(variant.INFO.get(e) ...) always returned True — ALL variants were treated as retained, variants_sorted stayed empty, and select_pcgr_variants raised RuntimeError for any sample with >450k PASS variants (sash #52 root cause). Fix: exclude '.' alongside None so only genuinely set String/Flag fields trigger retention. Adds regression test with PCGR_MUTATION_HOTSPOT=. fixture to prevent silent recurrence.
There was a problem hiding this comment.
Pull request overview
This PR addresses sash issue #52 by preventing PCGR processing from breaking hypermutated samples when tiered filtering cannot reduce PASS variants below MAX_SOMATIC_VARIANTS, and by fixing retained-variant detection for PCGR_MUTATION_HOTSPOT when PCGR writes a dot (.) placeholder value.
Changes:
- Catch
RuntimeErrorfromselect_pcgr_variants()inentry()and skip PCGR entirely when the variant cap cannot be resolved. - Fix retained-variant detection so
INFOstring placeholder'.'does not cause false retention during tiered filtering. - Add/extend tests covering the dot-placeholder hotspot bug, the “all retained variants” overflow case, and the “skip PCGR on overflow” CLI behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/test_pcgr_hypermutated.py |
Adds regression and integration tests for PCGR trimming/retention edge cases and ensures entry() skips PCGR when trimming cannot reduce counts. |
bolt/workflows/smlv_somatic/report.py |
Implements skip-on-unresolvable-overflow behavior in entry() and fixes retained-variant detection to ignore '.' placeholder values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
scwatts
left a comment
There was a problem hiding this comment.
Any information on testing done or plans to test would be great!
Testing context is in umccr/sash#52 or something about something else |
Graceful PCGR skip when variant count exceeds MAX_SOMATIC_VARIANTS (sash #52, bolt PR #32). Fixes dot-placeholder PCGR_MUTATION_HOTSPOT retention false positive. Approved by scwatts (2026-06-05), all CI green.
|
Testing summary (responding to @scwatts): Unit tests (added in this PR,
Real-world trigger (L2100242, PDAC cohort): End-to-end gap: |
- Remove duplicate PR #32 entries that appeared in both 0.3.1 and 0.3.2 - Add test documentation for all new test classes introduced in 0.3.1/0.3.2 - Restore logger.info calls in merge_vcf_files that were removed during cleanup
See sash issue