I have a VCF file and I am trying to tag poor variant calls based on the following criteria
'INFO/vafator_af < 0.5 || INFO/vafator_dp < 100 && INFO/vafator_ac < 50 '
where vafator_af inform us about allele frequency (Ratio of reads supporting the alternate allele), vafator_ac: Count of reads supporting the alternate allele and vafator_dp:Count of reads covering the position of the variant.
The idea is to check for all three conditions and if any of it is violated then tag the call as POOR_CALLS
However, the variant given below with vafator_af=0.98413;vafator_ac=62;vafator_n=0;vafator_dp=63
PASS the filter. But this violates the condition INFO/vafator_dp < 100 && INFO/vafator_ac < 50
and therefore should tag variant as POOR_CALLS
.
vafator \
--input-vcf ${vcf} \
--output-vcf ${sid}.${caller}.vaf.vcf \
--bam vafator ${bam.toRealPath()} --mapping-quality 0 --base-call-quality 0
bgzip -c ${sid}.${caller}.vaf.vcf > ${sid}.${caller}.vaf.vcf.gz
tabix -p vcf ${sid}.${caller}.vaf.vcf.gz
## Bad variant calls Tagging
bcftools view -Ob ${sid}.${caller}.vaf.vcf.gz | \
bcftools filter --exclude 'INFO/vafator_af < 0.5 || INFO/vafator_dp < 100 && INFO/vafator_ac < 50 ' \
--soft-filter POOR_CALLS --output-type v - | bcftools norm -d both - > ${sid}.${caller}.vaf.annot.vcf
bgzip -c ${sid}.${caller}.vaf.annot.vcf > ${sid}.${caller}.vaf.annot.vcf.gz
tabix -p vcf ${sid}.${caller}.vaf.annot.vcf.gz
bcftools index ${sid}.${caller}.vaf.annot.vcf.gz
MN908947.3 14408 . C T 2314.04 PASS AC=1;AF=1;AN=1;BaseQRankSum=1.89;DP=73;FS=3.889;MLEAC=1;MLEAF=1;MQ=60;MQRankSum=0;QD=32.59;ReadPosRankSum=1.041;SOR=0.896;OLD_CLUMPED=MN908947.3|14408|C|T|1;vafator_af=0.98413;vafator_ac=62;vafator_n=0;vafator_dp=63;vafator_eaf=0.5;vafator_pu=1;vafator_pw=1;vafator_k=4;vafator_bq=11,37;vafator_mq=60,60;vafator_pos=100,69;vafator_rsmq=0;vafator_rsmq_pv=1;vafator_rsbq=1.595;vafator_rsbq_pv=0.11076;vafator_rspos=-0.962;vafator_rspos_pv=0.33586 GT:AD:AF:DP:GQ:PL 1:1,70:0.986:71:99:2324,0
MN908947.3 15240 . C T 1318.04 POOR_CALLS AC=1;AF=1;AN=1;DP=41;FS=0;MLEAC=1;MLEAF=1;MQ=60;QD=32.95;SOR=1.788;OLD_CLUMPED=MN908947.3|15240|C|T|1;vafator_af=1;vafator_ac=36;vafator_n=0;vafator_dp=36;vafator_eaf=0.5;vafator_pu=1;vafator_pw=1;vafator_k=3;vafator_bq=0,37;vafator_mq=0,60;vafator_pos=0,32 GT:AD:AF:DP:GQ:PL 1:0,40:1:40:99:1328,0
Not tested but couldn't it be a problem of precedence of the operators '&&' and '||' . Try to add parenthesis in your
--exclude
testdo you want
or