gatk icon indicating copy to clipboard operation
gatk copied to clipboard

VariantFiltration failed

Open Wasya-the-Wolf opened this issue 1 year ago • 2 comments

Hello, I was trying to hard-filter the vcf files outputed by GATK HaplotypeCaller, and I want to keep variants that meet the following condition: depth (QD) < 2.0 || FisherStrand (FS) > 60.0 || root mean square mapping quality (MQ) < 40.0 || mapping quality rank sum test(MQRankSum) <−12.5 || ReadPosRankSum <−8.0. Here is my code:

for i in *.vcf.gz; do samplename=${i##*/}; sample=${samplename%%.*}; $gatk VariantFiltration -V $i --filter-expression "QD < 2.0" --filter-name "QD2" --filter-expression "FS > 60.0" --filter-name "FS60" --filter-expression "MQ < 40.0" --filter-name "MQ40" --filter-expression "MQRankSum < -12.5" --filter-name "MQRankSum-12.5" --filter-expression "ReadPosRankSum < -8.0" --filter-name "ReadPosRankSum-8" -O ../../hardFilter/snp/${sample}.hardfil.snp.vcf.gz ; done But I met some warings: 17:37:07.563 WARN JexlEngine - ![0,9]: 'MQRankSum < -12.5;' undefined variable MQRankSum 17:37:07.564 WARN JexlEngine - ![0,14]: 'ReadPosRankSum < -8.0;' undefined variable ReadPosRankSum 17:37:07.564 WARN JexlEngine - ![0,9]: 'MQRankSum < -12.5;' undefined variable MQRankSum 17:37:07.564 WARN JexlEngine - ![0,14]: 'ReadPosRankSum < -8.0;' undefined variable ReadPosRankSum 17:37:07.564 WARN JexlEngine - ![0,9]: 'MQRankSum < -12.5;' undefined variable MQRankSum 17:37:07.564 WARN JexlEngine - ![0,14]: 'ReadPosRankSum < -8.0;' undefined variable ReadPosRankSum It seems that the "MQRankSum" and "ReadPosRankSum" were not defined. Then I checked the filtered vcf, and the filter is seemed not working, many variations that do not satisfy the expression are also determined as pass: 屏幕截图 2024-08-27 181728 I hope to receive your help.

Wasya-the-Wolf avatar Aug 27 '24 10:08 Wasya-the-Wolf

Those warning messages are totally fine. Not all variant contexts contain those 2 annotations therefore they are not counted against those sites but other parameters are counted. The results also shows that your filtering is working and variants are marked as expected.

gokalpcelik avatar Aug 27 '24 10:08 gokalpcelik

Those warning messages are totally fine. Not all variant contexts contain those 2 annotations therefore they are not counted against those sites but other parameters are counted. The results also shows that your filtering is working and variants are marked as expected.

Thank you very much!

Wasya-the-Wolf avatar Aug 27 '24 11:08 Wasya-the-Wolf