fst: Calculate the pairwise Fst statistic

Description Usage Arguments Format Details Examples

View source: R/fst.R

Description

Given a allele_count matrix, it computes the Fst statistic and its bootstrap replications between all pairs of population using several methods.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
fst_methods

fst(ac, method = fst_methods, snpwise = FALSE)

bootstrap_fst(
  ac,
  method = fst_methods,
  boots = 100L,
  block = 10L,
  as_matrix = FALSE
)

Arguments

ac

allele count matrix for which to compute Fst.

method

fst estimator method. Using reich as default.

snpwise

a boolean scalar idicating if should return a the statistic for each variant (when TRUE) or the summary (when FALSE).

boots

number of bootstrap replicates to perform

block

statistic blocking size

as_matrix

if TRUE, then return a matrix whith bootstrap interations as rows and pairwise comparisons as columns.

Format

An object of class character of length 5.

Details

The estimator methods include Reich et al. (2019) (reich), Weir & Cockerham (1984) (weir_cockerham or wc), Hudson et al. (1992) (hudson) and Wright (1951) (wright). These methods use different approaches to estimate Fst. The Wright method is a biased estimator and can be affected by different populations sizes, Hudson and Reich methods are unbiased fast and tend to present reliable results on large variant sizes, but limited precision snpwise. In other hand, Weir & Cockerham method is the most common estimator (implemented by tools such as plink, vcftools, and scikit-allele) and uses a population size correction to reduce bias, but is a little slower than the other methods.

Please note that Reich method requires population sizes larger than 2 ( more than one diploid individual).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
c <- matrix(sample(1:10, 250, replace = TRUE), ncol = 10, nrow = 25)
n <- matrix(10, ncol = 10, nrow = 25)
ac <- allele_count(c, n)
## Summarized Fst
fst(ac)
fst(ac, "wc")
## Snpwise Fst
fst(ac, snpwise = TRUE)
fst(ac, "wc", snpwise = TRUE)

## bootstrap fst
bootstrap_fst(ac)

andremrsantos/htspop documentation built on May 14, 2020, 11:40 a.m.