Skip to content

bare flag identifier as the whole predicate #300

@jeromekelleher

Description

@jeromekelleher

bcftools query -i 'DB' sample.vcf.gz
-> empty (bcftools rejects bare flag as predicate)
vcztools query -i 'DB' sample.vcz.zip
-> 20 14370, 20 1110696 (the two DB=1 records)

Root cause: Identifier.eval in vcztools/bcftools_filter.py:143-147
returns the raw int array; BcftoolsFilter.evaluate then uses it
directly as the include-mask, so truthy (=1) records pass the filter.

Fix direction: in BcftoolsFilter.init reject a parse tree whose
root is a plain Identifier (no comparison / logical / filter-set
operator wrapping it). The correct bcftools form is DB=1 — callers
should be told so. Alternatively, if we want to be lenient, translate
a bare flag into =1 at parse time, but matching bcftools's
behaviour is probably the safer default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions