Read blocked f2 statistics from disk

f2_from_precomp(
  dir,
  inds = NULL,
  pops = NULL,
  pops2 = NULL,
  afprod = FALSE,
  fst = FALSE,
  return_array = TRUE,
  apply_corr = TRUE,
  remove_na = TRUE,
  verbose = TRUE
)

Arguments

dir

Directory with precomputed f2 statistics, or precomputed individual pair data

inds

Individuals for which data should be read. Defaults to all individuals, which may require a lot of memory.

pops

Populations for which data should be read. Defaults to all populations, which may require a lot of memory.

pops2

Optional second vector of populations. Useful if a f4 statistics of a few against many populations should be computed. pops2 should not be specified in other cases, as most functions depend on f2-statistics for all population pairs in pops.

afprod

Return negative average allele frequency products instead of f2 estimates. This will result in more precise f4-statistics when the original data had large amounts of missingness, and should be used in that case for qpdstat and qpadm. It can also be used for outgroup f3-statistics with a fixed outgroup (for example for qpgraph); values will be shifted by a constant amount compared to regular f3-statistics. This shift affects the fit of a graph only by small amounts, possibly less than bias in regular f3-statistics introduced by large amounts of missing data. This option is currently ineffective when reading data extracted with extract_counts.

return_array

Return a 3d array (default). If false, a data frame will be returned.

apply_corr

Subtract the f2 correction factor. Setting this to FALSE can occasionally be useful

remove_na

Remove blocks with missing values

verbose

Print progress updates

Value

A 3d array of f2 statistics

Examples

if (FALSE) {
dir = 'my/f2/dir/'
f2_blocks = f2_from_precomp(dir, pops = c('pop1', 'pop2', 'pop3'))
}