snp_fst: Fixation index (Fst)

View source: R/Fst.R

snp_fstR Documentation

Fixation index (Fst)

Description

Fixation index (Fst), either per variant, or genome-wide

Usage

snp_fst(list_df_af, min_maf = 0, overall = FALSE)

Arguments

list_df_af

List of data frames with ⁠$af⁠ (allele frequency per variant) and ⁠$N⁠ (sample size per variant). Typically, the outputs of bed_MAF(). Each new data frame of the list should correspond to a different population.

min_maf

Minimum MAF threshold (for the average of populations) to be included in the final results. Default is 0 (remove monomorphic variants).

overall

Whether to compute Fst genome-wide (TRUE) or per variant (FALSE, the default).

Value

If overall, then one value, otherwise a value for each variant with missing values for the variants not passing min_maf. This should be equivalent to using '--fst --within' in PLINK.

References

Weir, B. S., & Cockerham, C. C. (1984). Estimating F-statistics for the analysis of population structure. Evolution, 1358-1370.

Examples

bedfile <- system.file("extdata", "example.bed", package = "bigsnpr")
obj.bed <- bed(bedfile)

pop <- rep(1:3, c(143, 167, 207))
ind_pop <- split(seq_along(pop), pop)
list_df_af <- lapply(ind_pop, function(ind) bed_MAF(obj.bed, ind.row = ind))

snp_fst(list_df_af)
snp_fst(list_df_af[c(1, 2)], overall = TRUE)
snp_fst(list_df_af[c(1, 3)], overall = TRUE)
snp_fst(list_df_af[c(3, 2)], overall = TRUE)


bigsnpr documentation built on Sept. 30, 2024, 9:18 a.m.