Learn R Programming

bigsnpr (version 1.9.11)

snp_fst: Fixation index (Fst)

Description

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

Usage

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

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.

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).

References

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

Examples

Run this code
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)

Run the code above in your browser using DataLab