Skip to content

streaming: symmetric decline for multi-value INFO/AF (streaming vs written parity) #324

Description

@d-laub

Split out of PR-B2 (#317, PR #323) final review.

For a VCF/BCF whose INFO/AF carries multiple values for a (bi-allelic) record — an ambiguous ALT→AF mapping, e.g. a Number=. AF left un-subset after a bcftools norm -m split so G>A still lists AF=0.333,0.667 — the two paths currently diverge:

  • Written (gvl.write_attach_af_column): declines to cache AF (warns), so Dataset.with_settings(min_af=…) raises the AF-missing guard.
  • Streaming (_VcfBackend.has_cached_af = header-only _declared_info_fields(("AF",))): reports AF available and reads it live, with genoray resolve_scalar returning the first value — so streaming silently filters where the written path raises.

This breaks the streaming⟺written byte-identity contract for such VCFs. It is narrow (non-standard Number=. AF) and gvl already documents a normalize-first requirement (docs/source/dataset.md caveat added in PR #323), so it was deferred, not blocking the merge.

Proposed fix: make streaming decline symmetrically — e.g. _VcfBackend.has_cached_af (or the VCF filler) detects multi-value AF and returns False so streaming raises the same guard as the written path. Add a streaming test twin of test_write_multivalue_af_writes_without_af_column.

Relates to #317, #319, PR #323.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions