calculating allele frequencies in a vcf
1
0
Entering edit mode
3.5 years ago
erl1977 ▴ 60

Hi all,

I have a vcf file that looks like this (two lines here):

1    144135212       rs1553120241    G       A       .       .       .       AN:AC   8560:5387       8:8     256:224 336:288 32:24   170:117 32:24   18:13   20:15   344:296 288:248 9432:6100
1     144148243       rs2236566       G       T       .       .       .       AN:AC   5996:510        0:0     0:0     0:0     0:0     0:0     0:0     0:0     84:8    0:0     0:0     6080:518

This file has an aggregated allele counts in the genotype columns (AN:AC) for each population group. I am interested in adding in the allele frequency for each population, so it would be the AC/AN, and add that as a third attribute to the genotype columns. These are the only attributes in the files and no other information is present.

so a potential output would be something like this:

1     144135212       rs1553120241    G       A       .       .       .       AN:AC:AF   8560:5387:0.629       8:8:1     256:224:0.875 336:288:0.857 32:24:0.75   170:117:0.68 32:24:0.75   18:13:0.722   20:15:0.75   344:296:0.86 288:248:0.861 9432:6100:0.646
1     144148243       rs2236566       G       T       .       .       .       AN:AC:AF   5996:510:0.085        0:0:0     0:0:0     0:0:0     0:0:0     0:0:0     0:0:0     0:0:0     84:8:0.95    0:0:0     0:0:0     6080:518:0.851

Does anyone know of a way to do this some easy fashion? I can't seem to figure out if a tool such as bcftools has the ability to do it. I can probably put together some script, but I wanted to see if there was something out there already that can do this.

Thanks for any help

frequency vcf allele • 977 views
ADD COMMENT
1
Entering edit mode
3.5 years ago

Hi, can you please try my solution, here: How to use bcftools to calculate AF INFO field from AC and AN in VCF?

Kevin

ADD COMMENT

Login before adding your answer.

Traffic: 1861 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6