HWExactStats | R Documentation |
HWExactStats
is a function for the computation of Exact p-values
for a large set of bi-allelic markers (typically SNPs).
HWExactStats(X, x.linked = FALSE, plinkcode = TRUE, midp = FALSE,...)
X |
A matrix with genotype counts, one row per marker. |
x.linked |
Logical indicating whether the markers are autosomal ( |
plinkcode |
Logical indicating whether to use faster C++ code from the PLINK software. |
midp |
Logical indicating whether to use the mid p-value for the C++ code or not |
... |
extra arguments that are passed on to |
Matrix X
should strictly comply with the following format. For
an autosomal dataset is should contain the 3 genotype counts in order
(AA,AB,BB). For an X-chromosomal dataset it should contain the 5
genotype counts in order (A,B,AA,AB,BB) where A and B are the male
counts and AA, AB and BB the female counts.
Argument plinkcode=TRUE
(the default) will use C++ code for faster calculation (functions SNPHWE2
and
SNPHWEX
) with larger datasets. The C++ code was generously shared by Christopher
Chang, and the same code is used in the program
PLINK (2.0).
A vector of p-values
Jan Graffelman jan.graffelman@upc.edu (R code) and Christopher Chang chrchang523@gmail.com (C++ code)
Graffelman, J. and Weir, B.S. (2016) Testing for Hardy-Weinberg equilibrium at bi-allelic genetic markers on the X chromosome. Heredity 116(6) pp. 558–568. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1038/hdy.2016.20")}
Purcell et al. (2007) PLINK: A Toolset for Whole-Genome Association and Population-Based Linkage Analysis. American Journal of Human Genetics 81(3) pp. 559–575.
HWExact
#
# Autosomal example
#
set.seed(123)
X <- HWData(1000,100)
monom <- (X[,2]==0 & X[,1]==0) | (X[,2]==0 & X[,3]==0)
X <- X[!monom,] # exclude monomorphics
Exact.pvalues <- HWExactStats(X,x.linked=FALSE)
#
# X-chromosomal example
#
X <- HWData(1000,100,n.males=50,nA=75,x.linked=TRUE)
Exact.pvalues <- HWExactStats(X,x.linked=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.