Computes f2 statistics from f2 blocks of the form \(f2(A, B)\)

f2(
  data,
  pop1 = NULL,
  pop2 = NULL,
  boot = FALSE,
  sure = FALSE,
  unique_only = TRUE,
  verbose = FALSE,
  ...
)

Arguments

data

Input data in one of three forms:

  1. A 3d array of blocked f2 statistics, output of f2_from_precomp or f2_from_geno (fastest option)

  2. A directory which contains pre-computed f2-statistics

  3. The prefix of genotype files (slowest option)

pop1

One of the following four:

  1. NULL: all possible population combinations will be returned

  2. A vector of population labels. All combinations with the other pop arguments will be returned

  3. A matrix with population combinations to be tested, with one population per column and one combination per row. Other pop arguments will be ignored.

  4. the location of a file (poplistname or popfilename) which specifies the populations or population combinations to be tested. Other pop arguments will be ignored.

pop2

A vector of population labels

boot

If FALSE (the default), block-jackknife resampling will be used to compute standard errors. Otherwise, block-bootstrap resampling will be used to compute standard errors. If boot is an integer, that number will specify the number of bootstrap resamplings. If boot = TRUE, the number of bootstrap resamplings will be equal to the number of SNP blocks.

sure

The number of population combinations can get very large. This is a safety option that stops you from accidently computing all combinations if that number is large.

unique_only

If TRUE (the default), redundant combinations will be excluded

verbose

Print progress updates

...

Additional arguments passed to f2_from_geno when data is a genotype prefix

Value

f2 returns a data frame with f2 statistics

References

Patterson, N. et al. (2012) Ancient admixture in human history Genetics

Peter, B. (2016) Admixture, Population Structure, and F-Statistics Genetics

Examples

pop1 = 'Denisova.DG'
pop2 = c('Altai_Neanderthal.DG', 'Vindija.DG')
f2(example_f2_blocks, pop1, pop2)
#> # A tibble: 2 × 4
#>   pop1        pop2                   est      se
#>   <chr>       <chr>                <dbl>   <dbl>
#> 1 Denisova.DG Altai_Neanderthal.DG 0.141 0.00115
#> 2 Denisova.DG Vindija.DG           0.145 0.00115
if (FALSE) {
f2(f2_dir, pop1, pop2)
}