Learn R Programming

gaston (version 1.2)

set.hwe: Hardy-Weinberg Equilibrium

Description

Return 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

Value

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

Details

Two tests of Hardy-Weinberg Equilibrium are proposed:
  • ifmethod = "chisquare", the good old Chi-square test
  • ifmethod = "exact", Haldane's exact test (see Wigginton et al)

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

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

set.stats

Examples

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

# Compute statistics
x <- set.stats(x)

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

Run the code above in your browser using DataLab