Skip to content

Vcf api fixes - #432

Merged
jeromekelleher merged 3 commits into
sgkit-dev:mainfrom
jeromekelleher:vcf-api-fixes
Jun 7, 2026
Merged

Vcf api fixes#432
jeromekelleher merged 3 commits into
sgkit-dev:mainfrom
jeromekelleher:vcf-api-fixes

Conversation

@jeromekelleher

Copy link
Copy Markdown
Member

No description provided.

The drop_genotypes keyword on write_vcf / VcfWriter was redundant:
bcftools view -G semantics (omitting the FORMAT field and all sample
columns from both header and records) are produced entirely by clearing
the reader's sample selection with reader.set_samples([]), which the CLI
already does for -G.

With samples cleared, the flag had no effect on the header (driven by
sample count) or records (write_chunk forces gt=None when num_samples
== 0), and its phased-genotype branch was already dead code. Its only
standalone effect was emitting malformed VCF (GT stripped but sample
columns retained).

Drop the parameter from write_vcf and VcfWriter and simplify
write_chunk. The CLI keeps the -G/--drop-genotypes flag and its
validations; only the redundant plumbing into write_vcf is removed.
set_samples([]) is now the documented, tested way to drop genotypes.
Previously a fill_tags tag with no corresponding virtual field for the
store was silently dropped. write_vcf / VcfWriter now raise ValueError
listing the unknown tag(s) and the tags available for the store, so a
direct API caller gets immediate feedback instead of a silently
unfilled INFO field. The CLI keeps its own --fill-tags validator; this
makes the writer self-defending for non-CLI callers.
@jeromekelleher
jeromekelleher merged commit 0a07bf6 into sgkit-dev:main Jun 7, 2026
13 checks passed
@jeromekelleher
jeromekelleher deleted the vcf-api-fixes branch June 7, 2026 15:32
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