This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Allele frequency calculation for genotype dosage value

Hello, i have a data set with the dosage data (between 0-2) from a couple million SNPs, i would like to get the MAF for each SNP. I saw somewhere (not that reliable place) that you can get it just doing:

SNP1 <- c(0.03, 0.05, 1.95, 1.21, 0.09)

MAFSNP1 <- sum(SNP1) / (2*length(SNP1))

i compared this "MAF" from my dataset with the 1000 genome one, and it match.

Do you know if this is the good way to get the MAF in dosage data? do you know a paper or book giving the formula? thanks a lot !

plink dosage r impute

a couple million SNPs

Why not use plink to calculate the frequency? It would be a lot faster than R.

1 answer

Almost, you need to add this, since you are calculating the alternate allele frequency, not the minor one:

MAFSNP1 = ifelse(MAFSNP1 > 0.5, 1-MAFSNP1, MAFSNP1)

Yes, you right. I didn't put it for make the post shorter. Do you know a source where i can confirm my formula? the package gwasurvivr uses almost the same thing:

MAFSNP1 <- mean(SNP1, na.rm=T) * 0.5

Log in to answer this question.