# creating population AF from set of individuals in 1000 genomes population?

What's the recommended way to create population-level Allele Frequency variant entries from a set of individuals (vcfs?) in the 1000 genomes (or similar) project?

For example, given the IBS individuals in the 1000 Genomes project:

http://www.internationalgenome.org/data-portal/population/IBS

I would like to create an IBS .vcf.gz that contains an IBS population-level AF entry for each of the variants present.

Any ideas on how to achieve this?

EDIT: this is related to my earlier question on how to create the most complete file for population allele frequencies, here: what is the most complete vcf file of population allele frequencies that can be built/downloaded from public datasets?

I have seen that there is an Allele Frequency Calculator tool in EnsEMBL, which is at least available with GRCh37:

http://www.internationalgenome.org/allele-frequency-calculator-documentation

http://grch37.ensembl.org/Homo_sapiens/Tools/AlleleFrequency?db=core

There are also instructions on how to do this genome-wide using vcftools:

vcf-subset -c ~/1000g/IBS.samples.list ~/1000g/ALL.chr1.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz | fill-an-ac | bgzip -c > ~/1000g/IBS.chr1.20130502.vcf.gz


This seems to be generating correct files, and the AF can be calculated with a tool that combines AC and AN values, such as it is described here:

https://www.biostars.org/p/123468/

Any other ideas / warnings / pitfalls of the approach?

• Are you looking to get this genome-wide? Or are you only interested in particular regions/variants? Jun 25, 2019 at 7:52
• Hi @Emily_Ensembl looking to do this genome-wide for as many populations as possible. I see there are 25-30 available in EnsEMBL from the 1000 genomes project. Jun 25, 2019 at 13:22

bcftools has a plugin called fill-tags which should do the job for you easily, without having to mess around with lots of complicated bash scripting.

You could do something along the lines of this, presuming you have a .vcf file with all the IBS individuals in it:

bcftools +fill-tags in.vcf.gz -Oz -o out.vcf.gz


This will give each position in the .vcf file new INFO tags, one of which will be allele-frequency.

You can then pull off the frequency for a particular variant (CHR:POS) by:

bcftools query -t CHR:POS -f'%CHROM\t%POS\t%AF\n' out.vcf.gz

• I will check it out. Thanks Jul 2, 2019 at 9:34