  Comparing allele frequencies among populations that differ in environment has
long been a tool for detecting loci involved in local adaptation. However, such
analyses are complicated by an imperfect knowledge of population allele
frequencies and neutral correlations of allele frequencies among populations
due to shared population history and gene flow. Here we develop a set of
methods to robustly test for unusual allele frequency patterns, and
correlations between environmental variables and allele frequencies while
accounting for these complications based on a Bayesian model previously
implemented in the software Bayenv. Using this model, we calculate a set of
`standardized allele frequencies' that allows investigators to apply tests of
their choice to multiple populations, while accounting for sampling and
covariance due to population history. We illustrate this first by showing that
these standardized frequencies can be used to calculate powerful tests to
detect non-parametric correlations with environmental variables, which are also
less prone to spurious results due to outlier populations. We then demonstrate
how these standardized allele frequencies can be used to construct a test to
detect SNPs that deviate strongly from neutral population structure. This test
is conceptually related to FST but should be more powerful as we account for
population history. We also extend the model to next-generation sequencing of
population pools, which is a cost-efficient way to estimate population allele
frequencies, but it implies an additional level of sampling noise. The utility
of these methods is demonstrated in simulations and by re-analyzing human SNP
data from the HGDP populations. An implementation of our method will be
available from http://gcbias.org.
