Thanks this looks great, is there a way to specify which individuals in the vcf file I want to include in the calculation?
Cheers
Hello Everyone,
I have a VCF with multiple individuals from multiple populations and I would like to get a summary of the allele frequency spectrum for each population. I know that VCFtools has some nice options for outputting allele frequencies. However my data is from non-model organisms and I think using the reference/derived alleles for calculating allele frequencies is resulting in some serious biases.
So I am looking for two possible solutions:
Any comments or ideas are much appreciated. Thank you in advance!
Best
Rubal
This can easily be accomplished via VCFlib
If the end goal is association testing have a look at GPAT: https://github.com/jewmanchue/vcflib/wiki
EDIT:
GPAT++ now supports population summary statistics: https://github.com/jewmanchue/vcflib/wiki/Basic-population-statistics-with-GPAT
First command catches the allele frequency in the INFO field. If there is more than one alternative allele the site is skipped. The second command folds the allele frequency.
perl -lane '$_ =~ /AF=(.*?);/;if($1 !~ /,/){print $1}' your.vcf | perl -lane '$z = $_; if($z > 0.5){$z = 1 - $z} print $z'
If you have an out group it will take a little more scripting and thought. For example the out group might not always contain the ancestral allele.
Thanks this looks great, is there a way to specify which individuals in the vcf file I want to include in the calculation?
Cheers
Log in to answer this question.