Skip to content

fix(write): raise clear ValueError when variant/track sample intersection is empty#226

Merged
d-laub merged 1 commit into
mainfrom
fix/issue-225-empty-sample-intersection
Jun 14, 2026
Merged

fix(write): raise clear ValueError when variant/track sample intersection is empty#226
d-laub merged 1 commit into
mainfrom
fix/issue-225-empty-sample-intersection

Conversation

@d-laub

@d-laub d-laub commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Fixes #225.

Summary

  • Added a guard in gvl.write after samples.sort() that raises a clear ValueError when the variant/track sample intersection is empty, before entering _write_from_svar
  • Added a regression test in test_write_atomic.py using a VCF + BigWigs with intentionally disjoint sample IDs

Before / After

Before: opaque crash deep in _write_from_svar / Ragged.from_offsets:

ValueError: Length of layout 0 does not match size of first dimension 229

After:

ValueError: No samples remain after intersecting variant samples with track samples.
Check that sample IDs match across variants and tracks.

Test plan

  • pytest tests/unit/dataset/test_write_atomic.py::test_empty_sample_intersection_raises_clear_error — new regression test, passes
  • pytest tests/unit/dataset/test_write_atomic.py — all 8 tests pass

🤖 Generated with Claude Code

…tion is empty (#225)

Before this fix, an empty intersection produced an opaque array-geometry
crash deep in _write_from_svar / Ragged.from_offsets. Now a guard after
samples.sort() raises an actionable message before entering the write path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@d-laub d-laub merged commit 0437083 into main Jun 14, 2026
7 checks passed
@d-laub d-laub deleted the fix/issue-225-empty-sample-intersection branch June 14, 2026 06:47
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.

gvl.write with SparseVar + tracks crashes with opaque ValueError when sample intersection is empty

1 participant