Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

set.hwe

Hardy-Weinberg Equilibrium


Description

Returns an updated bed.matrix with a new variable for the p-values of an Hardy-Weinberg Equilibrium test.

Usage

set.hwe(x, method = c("chisquare", "exact"),
           verbose = getOption("gaston.verbose", TRUE))

Arguments

x

A bed.matrix

method

The method to use, either "chisquare" or "exact"

verbose

If TRUE, display information on the function actions

Details

Two tests of Hardy-Weinberg Equilibrium are proposed:

  • if method = "chisquare", the good old Chi-square test

  • if method = "exact", Haldane's exact test (see Wigginton et al)

The function set.stats will be called first if necessary.

The p-value is set to 1.0 for SNPs on chromosomes Y and MT. For SNPs on chromosomes X, currently, the test is performed using only the genotypic counts of women.

Value

A bed.matrix similar to x, with a new variable x@snps$hwe containing the p-values for each SNP.

Author(s)

Hervé Perdry and Claire Dandine-Roulland

References

Wigginton, J. E., Cutler, D. J., & Abecasis, G. R. (2005). A note on exact tests of Hardy-Weinberg equilibrium. The American Journal of Human Genetics, 76(5), 887-893

See Also

Examples

# Load data
data(LCT)
x <- as.bed.matrix(LCT.gen, LCT.fam, LCT.bim)

# Compute Hardy-Weinberg p-values
x <- set.hwe(x)
head( x@snps[,c("id","hwe")] )

gaston

Genetic Data Handling (QC, GRM, LD, PCA) & Linear Mixed Models

v1.5.7
GPL-3
Authors
Hervé Perdry [cre, aut, cph], Claire Dandine-Roulland [aut, cph], Deepak Bandyopadhyay [cph] (C++ gzstream class), Lutz Kettner [cph] (C++ gzstream class)
Initial release
2020-09-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.