This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to calculate MAF from vcf files ? (SNPVersity from maizeGDB)

Hi!

I'm using curently SNPs datasets (.vcf) download from SNPVersity 2.0. I tried to calculate the MAF to select SNPs not to rare for a genotyping design. I'm using the package vcfR. Everything is fine except for maf(). It returns only NA.

maf(vcf, element = 2)
              nAllele NA Count Frequency
chr1_10071575      NA NA    NA        NA
chr1_10071587      NA NA    NA        NA
chr1_10071622      NA NA    NA        NA
chr1_10071633      NA NA    NA        NA
chr1_10071653      NA NA    NA        NA
chr1_10071822      NA NA    NA        NA
chr1_10071825      NA NA    NA        NA
chr1_10071826      NA NA    NA        NA
chr1_10071904      NA NA    NA        NA
chr1_10072180      NA NA    NA        NA
chr1_10072242      NA NA    NA        NA

Do you think it is because the dataset simply doesn't allows this or I made a mistake?

Thanks for your reply!

snps vcf maf cfr

1 answer

if the INFO/AF field is not already in the VCF:

bcftools +fill-tags in.bcf -Ob -o out.bcf -- -t AF

Log in to answer this question.