Skip to content

Feature/pcgr v2.2.1 - #10

Merged
qclayssen merged 26 commits into
release/0.3.0from
feature/pcgr_v2.2.1
Sep 2, 2025
Merged

qclayssen merged 26 commits into
release/0.3.0from
feature/pcgr_v2.2.1

Conversation

@qclayssen

@qclayssen qclayssen commented Aug 19, 2025 •

Copy link
Copy Markdown
Collaborator

Update Bolt to work with pcgr v2.2.1

link with sash PR#17

@qclayssen
qclayssen requested review from pdiakumis and scwatts August 26, 2025 06:13
@qclayssen qclayssen self-assigned this Aug 26, 2025
@qclayssen qclayssen added the enhancement New feature or request label Aug 26, 2025
@qclayssen
qclayssen marked this pull request as ready for review August 26, 2025 06:14
Comment thread bolt/common/constants.py Resolved
Comment thread bolt/common/pcgr.py Outdated
import re
import shutil
import tempfile
import gzip # added import

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove inline comment, and preferably order alphabetically!

Comment thread bolt/common/pcgr.py Resolved
Comment thread bolt/common/pcgr.py Resolved
@scwatts

scwatts commented Aug 28, 2025

Copy link
Copy Markdown
Member

Nice work!

I'm seeing a test failure, any thoughts what might be causing that?

Run python3 -m unittest discover tests/ --buffer
.F............
======================================================================
FAIL: test_clinical_potential_rescue_general (test_smlv_somatic_filter.TestSmlvSomaticFilter)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/bolt/bolt/tests/test_smlv_somatic_filter.py", line 204, in test_clinical_potential_rescue_general
    assert not record.FILTER
AssertionError

@qclayssen

Copy link
Copy Markdown
Collaborator Author

Nice work!

I'm seeing a test failure, any thoughts what might be causing that?

Run python3 -m unittest discover tests/ --buffer
.F............
======================================================================
FAIL: test_clinical_potential_rescue_general (test_smlv_somatic_filter.TestSmlvSomaticFilter)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/bolt/bolt/tests/test_smlv_somatic_filter.py", line 204, in test_clinical_potential_rescue_general
    assert not record.FILTER
AssertionError

I added Filter column in the final TSV, because it uses in gpgr for breakend pairing, see gprg issue. And this test specifically, it's not in there. i'm removing this test

@scwatts

scwatts commented Aug 28, 2025

Copy link
Copy Markdown
Member

The idea of this specific test is to simulate variants that were going to be filtered but are saved by what I've called 'clinical potential' rescue. This means that the output variants should have FILTER cleared / emptied and INFO containing the appropriate rescue flag

Since the conditions for the 'clinical potential' rescue has changed in this PR (i.e. removal of COSMIC and ICGC-PCAWG conditionals) the existing test variants that relied on those criteria failed. I've updated the test to align with the new conditions for this rescue

@scwatts scwatts left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good to me!

@qclayssen
qclayssen merged commit 033bcf8 into release/0.3.0 Sep 2, 2025
qclayssen added a commit that referenced this pull request Sep 15, 2025
@qclayssen qclayssen mentioned this pull request Sep 15, 2025
qclayssen added a commit that referenced this pull request Oct 2, 2025
qclayssen added a commit that referenced this pull request Oct 2, 2025
@qclayssen
qclayssen deleted the feature/pcgr_v2.2.1 branch January 16, 2026 03:41
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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants