broadinstitute / gatk

Official code repository for GATK versions 4 and up
https://software.broadinstitute.org/gatk
Other
1.71k stars 594 forks source link

VariantFiltration failed #8964

Open Wasya-the-Wolf opened 2 months ago

Wasya-the-Wolf commented 2 months ago

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.

gokalpcelik commented 2 months ago

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.

Wasya-the-Wolf commented 2 months ago

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!