Loci involved in local adaptation can potentially be identified by an unusual correlation between allele frequencies and important ecological variables, or by extreme allele frequency differences between geographic regions. However, such comparisons are complicated by differences in sample sizes and the neutral correlation of allele frequencies across populations due to shared history and gene flow. To overcome these difficulties, we have developed a Bayesian method that estimates the empirical pattern of covariance in allele frequencies between populations from a set of markers, and then uses this as a null model for a test at individual SNPs. I developed this method in collaboration with David Witonsky, Anna Di Rienzo and Jonathan Pritchard. The method is described in a paper in Genetics.
The method was further developed by Torsten Günther and myself, as described in this Genetics article. The newest version of the method is called Bayenv 2, and it maintains the full functionality of the original Bayenv.
The code is maintained by Torsten here. The tarballs/zips of the executable, example datasets, and a manual are given there.
When using bayenv please make sure that you have recently downloaded the program, to avoid old bugs. Please email Torsten (firstname.lastname@example.org) for the code, or for versions compiled for other types of machine.