Computing f2 statistics for populations consisting of many individuals can be slow and require a lot of memory. To speed this up, this function groups individuals into populations, computes allele counts and products of pairwise allele counts with all individuals and groups, and writes the data to disk. f2 statistics for a combination of grouped and ungrouped precomputed data can then be read using f2_from_precomp, replacing individual IDs of the grouped samples with the new group labels. All groupings are listed in {dir}/groups/{groupname}.rds

group_samples(dir, inds, pops, overwrite = FALSE, verbose = TRUE)

Arguments

dir

Directory with precomputed individual pair data

inds

Individuals to group

pops

Group names, either length 1, or same length as inds

overwrite

Overwrite existing files in outdir

verbose

print progress updates

See also

Examples

if (FALSE) {
dir = 'my/f2/dir/'
inds = c('ind1', 'ind2', 'ind3', 'ind4', 'ind5')
pops = c('pop_A', 'pop_A', 'pop_A', 'pop_B', 'pop_B')
group_samples(dir, inds, pops)
}