Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query variant filtering #82

Merged
merged 4 commits into from
Sep 30, 2024
Merged

Conversation

Will-Tyler
Copy link
Contributor

@Will-Tyler Will-Tyler commented Sep 25, 2024

Overview

This pull request adds support for variant-site filtering in the vcztools query CLI. These changes mimic the filtering expression behavior in bcftools.

This pull request partially addresses #73. I reuse Python components added in #49 to implement these changes.

I also included some small gitignore updates in this pull request.

Testing

I added some unit and validation tests. The query.py coverage was reported as 100%. I'm happy to add more tests if desired.

Usage

vcztools query -f "%POS\n" vcz_test_cache/sample.vcf.vcz -i "POS=112"
112

References

Copy link
Contributor

@tomwhite tomwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks @Will-Tyler!

Just so I'm clear, this works by pulling down the chunks and evaluating for each variant before printout, right? So, if we only printed one site of the VCF we still download and decode all the chunks, and not exit until the entire dataset had been traversed?

If so, there's some performance optimisations we should consider (or at least discuss and reject) where we first pull down the chunks needed to create the variant mask, and then pass the variant mask to the bit that reads chunks. I think we're doing something like this for the region query already?

@jeromekelleher
Copy link
Contributor

Just to be clear, I think we should merge this PR, but open an issue to discuss the performance implications of the implementation.

@tomwhite tomwhite merged commit e039823 into sgkit-dev:main Sep 30, 2024
11 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.

3 participants