Skip to content

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

Description

@rajwanir

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions