This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Snp Frequency In Complete Genomics Data

I am trying to analyze SNP frequency in 69 complete genomics data for example:

2951574 chr2 85624896 85624897 snp C G dbsnp.132:rs113793303 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 01 00 00 00 00 01 00 01 00 00 00 01 01 00 00 00

So I took from 11-79 column and counted frequencies of 00, 01/10 and 11 with a python script. So the frequency for C will be (numberof00 + numberof01/2 + numberof10/2)/69 =64/69 = 0.94 Is it correct?

python

2 answers

Yeah the frequencies looks right. But you could really just add up the number of 0's and 1's. Something like this:

data = line.strip().split()
alleleA = data[5]
alleleB = data[6]
#it looks like your allele information starts at column 9?
alleleString = ''.join(data[8:])
ACount = float(alleleString.count('0'))
BCount = float(alleleString.count('1'))
print alleleA + ' frequency: ' + str(ACount / len(alleleString))
print alleleB + ' frequency: ' + str(BCount / len(alleleString))

Thanks, I was counting 01, 10, 11, 00 separately!

You could give a look to the command --get-INFO <string> from the package vcftools.

Substituting the population in the <string> field, you can retrieve the frequencies for the ALTERNATE allele in the specified population. For example, for Europeans, substitute it for EUR_AF, and so on...

Its very straightforward! ;)

Log in to answer this question.