samtools / bcftools

This is the official development repository for BCFtools. See installation instructions and other documentation here http://samtools.github.io/bcftools/howtos/install.html
http://samtools.github.io/bcftools/
Other
649 stars 240 forks source link

MAF Filtering - difference between two approaches #2054

Closed nirav572 closed 8 months ago

nirav572 commented 9 months ago

Hi, what's the difference between the two approaches to filter for variants above a certain MAF threshold?

bcftools view -q 0.01 v/s bcftools -i 'MAF>0.01'? Also, do they compute the MAF value, or look for it in tag info?

Thank you!

alanmejiamaza commented 9 months ago

Adding something to the thread. It seems that -q 0.01:minor, excludes <=0.01 based on minor allele. the MAF<=0.01 seems to be doing something similar but in my case it doesnt exclude all MAF<=0.01,using bcftools/1.14 (conda env).

bcftools 1.18 seems to be the same, i mean: bcftools filter -i 'MAF<=0.01' test.vcf > test1.vcf bcftools query -f '%CHROM %POS %REF %ALT %AC %AN\n' vcf 1 13012 G A 2 506 1 13270 C T 2 516 1 13271 C T 2 516 1 13600 G T 4 516 1 14792 G A 4 516 1 14842 G A 4 516 1 14975 C T 2 516 1 16856 A G 1 516 1 16869 C T 1 516 1 16886 A G 1 516 1 17005 A G 5 512 1 17379 G A 3 516 1 17556 C T 3 516 1 17563 G A 3 516 1 69270 A G 346 346 1 69511 A G 502 502 1 76838 T G 1 226 1 83923 A G 0 86 1 87269 C A 2 216 1 101158 T C 130 130 1 128798 C T 48 48 1 135982 A G 408 408 1 136122 G A 2 484 1 136131 C T 1 484 1 137923 C T 1 516 1 138039 T A 3 514 1 138343 G T 1 516 1 138802 T G 3 516 1 139019 G C 1 516 1 139363 T C 2 516

pd3 commented 8 months ago

Both use the same underlying htslib's bcf_calc_ac() function which sets AC,AN from existing INFO tags or, when absent, from GT fields. They should give the same results.