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

Substring matching for variant IDs to aid in filtering records with multiple IDs? #2190

Closed
rajwanir opened this issue May 22, 2024 · 1 comment

Comments

@rajwanir
Copy link

Hello,

I have a vcf file that has some variants assigned multiple IDs. For example:

chr11_KI270721v1_random 78026 c11_pos2000643;rs72849239 G A .PASS . GT:GQ 0/0:5 ./.:. 0/0:4 ./.:. ./.:. ./.:. ./.:../.:. ./.:. ./.:.

I wish to query this vcf with a file containing snp ids. This works fine except that variants with multiple identifiers are not included in the output. To illustrate the issue:

  1. A 'testid' file with c11_pos2000643.outputs nothing with the following command:
    bcftools query -f"%POS" -i'ID=@testid' merged.vcf.gz

  2. No output with direct ID equal comparision:
    bcftools query -f"%POS" -i'ID=="c11_pos2000643"' merged.vcf.gz

  3. This works and returns the position:
    bcftools query -f"%POS" -i'ID~"c11_pos2000643"' merged.vcf.gz

Essentially, is it possible to use similarity/subset operator ~ with a snp list? If not, how I may be able to query the records with multiple IDs?

I am working with Bcftools version 1.20

Thank you.

@pd3 pd3 closed this as completed in 62142f3 May 27, 2024
@pd3
Copy link
Member

pd3 commented May 27, 2024

This is now fixed and all possibilities should work as intuitively expected, please try it out

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

No branches or pull requests

2 participants