calc_basic_snp_stats: Calculate basic SNP statistics

calc_basic_snp_statsR Documentation

Calculate basic SNP statistics

Description

Automatically calculate most basic statistics from snpRdata. Calculates maf, pi, ho, he, pairwise Fst, Fis, HWE divergence, finds private alleles, and uses Gaussian smoothing to produce per-window averages of all of these.

Usage

calc_basic_snp_stats(
  x,
  facets = NULL,
  fst.method = "WC",
  sigma = NULL,
  step = NULL,
  par = FALSE,
  nk = TRUE
)

Arguments

x

snpRdata object.

facets

character. Categorical metadata variables by which to break up analysis. See Facets_in_snpR for more details.

fst.method

character, default "WC". Defines the FST estimator to use. Options:

  • WC: Weir and Cockerham (1984).

  • Weir: Weir (1990)

  • Hohenlohe: Hohenlohe et al (2010), identical to the STACKS package.

  • Genepop: Rousset (2008), uses the genepop package.

sigma

numeric. Designates the width of windows in kilobases. Full window size is 6*sigma.

step

numeric or NULL, default NULL. Designates the number of kilobases between each window centroid. If NULL, windows are centered on each SNP.

par

numeric or FALSE, default FALSE. If numeric, the number of cores to use for parallel processing.

nk

logical, default TRUE. If TRUE, weights SNP contribution to window averages by the number of observations at those SNPs.

Details

The data can be broken up categorically by sample or SNP metadata, as described in Facets_in_snpR. Note that Fst and private allele calculations require a sample specific contrast (the pairwise part of pairwise Fst), and thus will not be calculated unless a facet with a sample meta data variable included is specified. The other stats, in contrast, are snp-specific and thus ignore any snp meta data variables included in facets. Providing NULL or "all" to the facets argument works as described in Facets_in_snpR.

Value

A snpRdata object with all of the described statistics merged into the appropriate sockets.

Author(s)

William Hemstrom

See Also

calc_single_stats calc_pairwise_fst calc_smoothed_averages

Examples

x <- calc_basic_snp_stats(stickSNPs, "pop")
get.snpR.stats(x, "pop", stats = "single") # view basic stats
get.snpR.stats(x, "pop", stats = "fst") # view fst



hemstrow/snpR documentation built on March 20, 2024, 7:03 a.m.