Skip to content

Uptade sage vcf header check - #24

Merged
qclayssen merged 5 commits into
release/0.3.0from
uptade-SAGE-vcf-header-check
Nov 24, 2025
Merged

qclayssen merged 5 commits into
release/0.3.0from
uptade-SAGE-vcf-header-check

Conversation

@qclayssen

Copy link
Copy Markdown
Collaborator

Asses issue #4

@qclayssen qclayssen self-assigned this Nov 11, 2025
@qclayssen qclayssen added the bug Something isn't working label Nov 11, 2025
@qclayssen
qclayssen requested a review from scwatts November 11, 2025 05:33
@qclayssen

Copy link
Copy Markdown
Collaborator Author

Will fix python test in #16

@qclayssen
qclayssen merged commit 6a93f6b into release/0.3.0 Nov 24, 2025
@qclayssen
qclayssen deleted the uptade-SAGE-vcf-header-check branch January 16, 2026 03:41
qclayssen added a commit that referenced this pull request Jul 13, 2026
rescue.py's annotate_existing_sage_calls called
util.check_annotation_headers(info_field_map_sage, input_fp) — but
input_fp is the DRAGEN VCF being annotated, not the SAGE VCF the check
is meant to validate. Introduced in PR #24 (commit 6a93f6b, 2025-11-24),
implementing a TODO that explicitly asked to check headers against the
SAGE fp. Because check_annotation_headers silently skips any field
absent from its target VCF, and the DRAGEN VCF has none of the SAGE_*
fields, the check ran but validated nothing. Not on main.

Also adds first-ever test coverage for rescue.py and for
util.check_annotation_headers, which had none:

- tests/test_util.py: TestCheckAnnotationHeaders — matching description
  passes, mismatched description exits, field absent from target VCF is
  skipped.
- tests/test_smlv_somatic_rescue.py (new): regression test proving the
  header check now reads sage_vcf_fp. Regression-proofed: against the
  pre-fix code the test fails (not with a clean assertion failure, but
  a downstream KeyError from FORMAT/AD access — proving the check
  silently passed and execution continued straight past it).

Updates TESTING.md (rescue.py, get_annotations_vcf,
collect_pcgr_annotation_data, collect_cpsr_annotation_data coverage rows
were stale from earlier quick tasks) and CHANGELOG.md.
qclayssen added a commit that referenced this pull request Jul 22, 2026
* Add option for sash sigrap individual process input to cancer report (#11)

* add params input for sigrap tools

* Hypermutation Handling in PCGR (#9)

* Feature/pcgr v2.2.1 (#10)

* fix merge duplication and imports

* bump pcgr version

* bump gpgr version

* change print to logging

* add argument chunck size

* fix version software pcgr container

* add logging and filter fonction to read value and replace placeholder

* fix indentation

* read gz tsv from pcgr

* change PCGR_CLINVAR_CLASSIFICATION

* Change pcgr header check

* tyo

* typo

* add missing variable pcgr_output_dir

* Pcgr v2.2.5 (#22)



* update "HIGH_INF_POS" to "HIGH_I_I_POS" in VCF header for latest pcgr version

* update constant for pcgr 2.2.5

* Uptade sage vcf header check (#24)

* change sage vcf header to match 2024 version

* move check function

* add check in rescue for sage vcf

* change for consistencency with pcgr

* add missing HMF_HOTSPOT constant

* Fix quotation

* Fix test

* remove PCGR html report from chunk (hypermutated) to reduce memory use

* change remove pcgr parallelisation of chunks, and fix pcgr internal parallelisation because OOM hypermutated samples

* free disk worker

* remove exception to stop at fail process

* make thread you by pcgr constant, so in case of OOM, on the retry don't use more core and so more memory

* Fix silent command failures by integrating error handling into execute_command. Fixes #26 - Commands now fail immediately instead of continuing silently

* Extract PCGR errors from log files

* Update bolt/workflows/other/cancer_report.py

Co-authored-by: Copilot <[email protected]>

* Update bolt/common/pcgr.py

Co-authored-by: Copilot <[email protected]>

* Apply suggestions from code review

Co-authored-by: Copilot <[email protected]>

* fix typo

* remove duplicate fonction

* fix typo

* add check pcgr_hotspot_present value

* add is_hypermutated flag to variant counts process JSON

* update PCGR_TIERS_FILTERING

* Fix PCGR hypermutated filtering, add exhaustive tests

Corrects the tier ordering logic and filtering in hypermutated sample handling to ensure NONCODING variants are dropped before TIER_1, preventing excessive variant counts. Refines error handling, improves logging and VCF writing, and clarifies filter traceability. Adds comprehensive unit and integration tests to verify all edge cases in tiered variant selection and CSQ parsing.

Relates to improved reliability for high-mutation samples.

* add back source comment

* DEV: install r-gpgr from input-sigrap-data branch for is_hypermutated testing

Revert to conda pin r-gpgr ==2.3.0 before final release.

* Add tests for split_vcf chunking and document PCGR 500k handling

- TestSplitVcf: verify split_vcf correctly chunks VCFs above MAX_SOMATIC_VARIANTS
- Document PCGR 500k as a hard software limit (not OOM) in CLAUDE.md
- Document known failure mode when tiered filtering cannot cap count (sash #52)

* Fix positional arg shift in run_somatic_chunk → run_somatic call

run_somatic has pcgr_threads between threads and pcgr_conda. The call
in run_somatic_chunk used positional args and skipped pcgr_threads,
causing pcgr_conda ('pcgr') to land in pcgr_threads → ValueError.

Switch to keyword args matching the non-chunked call in annotate.py.
Add regression test that mocks run_somatic and asserts pcgr_conda,
pcgrr_conda, and threads are received at the correct parameters.

* fix hypermutated tag

* Add tests for is_hypermutated dragen count fix

Covers count_variant_process: dragen vs filter_pass threshold,
SAGE_NOVEL exclusion, and annotation filter exclusion.

* Separate stdout/stderr streams in execute_command

Uses select() to multiplex both pipes in one thread, preventing
pipe buffer deadlock and routing stderr to WARNING level.

* Pin r-gpgr ==2.3.0 in Dockerfile.gpgr

Includes hypermutated flag fix (reads is_hypermutated from bolt JSON)
and SNVs display cleanup.

* fix doc and missing file closure

* add test

* change .with_suffix :
Path.with_suffix() only replaces the last suffix  everything after the final dot. The caller passes a path ending in .pass

* chore: untrack local-only files

* update CHANGELOG for 0.3.0 release

* bump version to 0.3.1 and update changelog

* ci: add smoke tests to catch image startup failures before push

* fix missing  build and pcgr docker file

* Fix remove unused package and log pcgr limit

* fix: tabix-index VCF chunks after split_vcf so PCGR can read them

* test: assert split_vcf chunks have .tbi index (regression for PCGR v2.2.5 tabix check)

* fix: bump r-gpgr to 2.3.1 in gpgr Docker image

* fix: skip bcftools merge for single PCGR VCF chunk (bolt #26)

run_somatic_chunk -> merging_pcgr_files unconditionally called
util.merge_vcf_files, which shells out to `bcftools merge`. That
command requires 2+ inputs, so a sample whose variants fit in a
single chunk (no splitting needed) produced a bcftools merge
Usage error instead of a valid annotated VCF.

Guard on len(pcgr_vcf_files) == 1: copy the single chunk's VCF
directly to the expected merged-output path and tabix-index it,
matching the indexed .vcf.gz contract that merge_vcf_files
normally produces. Two or more chunks still go through the
existing bcftools merge -> sort -> index path unchanged.

* style: address Stephen's review comments (bolt #35)

- Remove stray blank first line in bolt/common/pcgr.py
- Reword comment in report.py to reference MAX_SOMATIC_VARIANTS constant
  instead of hardcoded '500,000' value

* docs: document MAX_SOMATIC_VARIANTS rationale (bolt #35)

Explain why the threshold is 450k (not 500k): PCGR's hard cap is 500k,
the 50k margin avoids edge-case overflows during tiered filtering.
Notes this was an oral team decision with no written Slack thread.

Addresses Stephen's review comment on constants.py:7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant