How to update main ExAC VCF with non-psych and non-TCGA versions using vcfanno

08 January 2016
Brent Pedersen

ExAC originally released a VCF that contained the aggregate data for all samples. It has INFO fields for AFR, AMR, EAS, FIN, NFE, OTH, and SAS populations along with the combined Adj count. Recently, two additional VCF’s that contain only non pyschiatric and only non TCGA samples have been released.

Here, we will use vcfanno to decorate the original VCF with the alternate counts, chromosome counts, number of hets, number of hom alts, and allele frequencies of all populations from each of the two additional VCFs. Since the original VCF contains only allele counts, we will also use vcfanno to calculate the allele frequency for the original, full population. Finally, we’ll calculate the maximum allele frequency from all populations as that is very useful for filtering.

Creating a conf file can be cumbersome, but in this case, it’s simple, if repetitive. As such we write a script to create a block like this:


And a similar one for nonTCGA. In vcfanno, [[postannotation]] sections occur after any [[annotation]] sections and operate on the fields that are then in the INFO of the query. Given multiple [[postannotation]] sections, they will operate in the order that they appear in the file so later sections have access to fields created by earlier sections.

With that in mind, we create a section like this:

fields=["nonpsych_AC_NFE", "nonpsych_AN_NFE"]

for each population and for the original superset as well as for nonpsych, nonTCGA. The script to create all this automatically is here

Then we have a final section that calculates the maximum allele frequency among all populations:

fields=["af_AFR", "af_AMR", "af_EAS", "af_FIN", "af_NFE", "af_OTH", "af_SAS", "nonTCGA_af_AFR", "nonTCGA_af_AMR", "nonTCGA_af_EAS", "nonTCGA_af_FIN", "nonTCGA_af_NFE", "nonTCGA_af_OTH", "nonTCGA_af_SAS", "nonpysch_af_AFR", "nonpysch_af_AMR", "nonpysch_af_EAS", "nonpysch_af_FIN", "nonpysch_af_NFE", "nonpysch_af_OTH", "nonpysch_af_SAS"]

The entire conf file is here.

Then, the vcfanno command is very simple:

vcfanno -p 8 exac_combine.conf ExAC.r0.3.sites.vep.tidy.vcf.gz | bgzip -c > ExAC.r0.3.all.tidy.vcf.gz

This runs in about 15 minutes (10K variants / second) on good server with fast disk.