bcftools expression string exact match
1
1
Entering edit mode
4.6 years ago
roalva1 ▴ 90

Hello, If I execute this in bcftools 1.10.2

clinvar.vcf.gz is https://ftp.ncbi.nlm.nih.gov/pub/clinvar/vcf_GRCh37/clinvar.vcf.gz

bcftools query -i "CLNREVSTAT='criteria_provided,_conflicting_interpretations'"  -f '%CLNREVSTAT\n' clinvar.vcf.gz | sort -u
I get this results:
criteria_provided,_conflicting_interpretations
criteria_provided,_multiple_submitters,_no_conflicts
criteria_provided,_single_submitter

I was expecting to get only criteria_provided,_conflicting_interpretations. Is there anything that I don't understand.

Many thanks

bcftools • 1.7k views
ADD COMMENT
2
Entering edit mode
4.6 years ago

I supect it's invoked as an OR operator. Can you please try

"CLNREVSTAT='criteria_provided' &&  CLNREVSTAT='_conflicting_interpretations' "
ADD COMMENT
1
Entering edit mode

see the "Notes" section here https://samtools.github.io/bcftools/bcftools.html#expressions

Comma in strings is interpreted as a separator and when multiple values are compared, the OR logic is used.

Seems like this applies to both the value used in the expression and to the contents of the field you are querying.

In one of my cases, I wanted to filter on an INFO tag like TAG=val1,val3,val4 (a field with comma-separated string values), and include variants with certain values but exclude variants with other values. Since you cannot use both -i and -e simultaneously I ended up just | piping the output of the first into the second one ; bcfools filter -i 'TAG="val1,val2"' input.vcf | bcftools filter -e 'TAG="val3,val4"'

ADD REPLY
0
Entering edit mode

Yes it seems so,

also I execute this:

 bcftools query -i "CLNSIG='Pathogenic'"  -f '%CLNSIG\n' clinvar.vcf.gz | sort -u
The result is
Pathogenic
Pathogenic,_Affects
Pathogenic,_association
Pathogenic,_association,_protective
Pathogenic,_drug_response
Pathogenic,_drug_response,_other
Pathogenic,_other
Pathogenic,_protective
Pathogenic,_risk_factor

I think it is applying the OR also to the results. This is not my desire behavior :(

Thanks for the answer

ADD REPLY

Login before adding your answer.

Traffic: 1618 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6