Skip to content

fix: skip bcftools merge for single PCGR VCF chunk (#26) - #36

Merged
qclayssen merged 1 commit into
release/0.3.0from
bolt-26-single-chunk-merge-guard
Jul 22, 2026
Merged

qclayssen merged 1 commit into
release/0.3.0from
bolt-26-single-chunk-merge-guard

Conversation

@qclayssen

Copy link
Copy Markdown
Collaborator

Summary

  • merging_pcgr_files() (bolt/common/pcgr.py) called bcftools merge unconditionally on the chunked PCGR VCF outputs. bcftools merge requires 2+ input files — when a sample's variants fit in a single PCGR chunk (no splitting needed), this produced a bcftools merge usage error instead of a valid annotated VCF.
  • Adds a guard: with exactly 1 chunk, copy it directly to the expected merged-output path and tabix-index it, matching the indexed .vcf.gz contract merge_vcf_files normally produces. 2+ chunks are unaffected.

Closes #26.

Test plan

  • New tests: test_single_chunk_skips_bcftools_merge, test_multiple_chunks_still_merge (tests/test_pcgr_hypermutated.py)
  • python -m pytest tests/test_pcgr_hypermutated.py -v — 35 passed
  • python -m unittest discover tests/ --buffer — 49 tests, OK

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.
@qclayssen
qclayssen force-pushed the bolt-26-single-chunk-merge-guard branch from a26d2ff to faebfd8 Compare July 16, 2026 00:49
@qclayssen
qclayssen merged commit 2456ab7 into release/0.3.0 Jul 22, 2026
8 checks passed
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.

1 participant