Learn R Programming

HardyWeinberg (version 1.6.1)

HWPerm.mult: Permutation tests fo variants with multiple alleles

Description

Function HWPerm.mult implements permutation tests for Hardy-Weinberg equilibrium for autosomal and X-chromosomal variants.

Usage

HWPerm.mult(x, y = NULL, nperm = 17000, eps = 0, verbose = TRUE, ...)

Arguments

x

vector or triangular matrix with male genotype counts

y

vector or triangular matrix with female genotype counts

nperm

number of permutations (17.000 by default)

eps

a tolerance that can be set for comparing probabilities in order to include tied outcomes

verbose

print output or not

addtional arguments

Value

pofthesample

probability of the observed sample

pseudodist

probabilities of simulated samples

pval

p-value

Details

This function approximates exact test probabilities for joint tests for HWE and equality of allele frequencies for variants with multiple alleles. For purely bi-allelic variant HWPerm can be used which allows for more statistics than just probabilities.

If argument y is not specified, gender is considered irrelevant, and x contains total genotype counts. If x and y are specified, x should contain male genotype counts and y female genotype counts. x and y can be vectors if the variant is bi-allelic, but are assumed lower triangular if there are more than two alleles. x is still a vector if there are multiple alleles but the variant is X-chromosomal. See the examples given below.

References

Graffelman, J. and Weir, B.S. (2017) Multi-allelic exact tests for Hardy-Weinberg equilibrium that account for gender. doi: 10.1101/172874 bioRxiv preprint

See Also

HWPerm

Examples

Run this code
# NOT RUN {
#
# bi-allelic autosomal
#

x1 <- c(AA=298,AB=489,BB=213)
# }
# NOT RUN {
out <- HWPerm.mult(x1)
# }
# NOT RUN {
#
# bi-allelic X-chromosomal
#

x2.m <- c(A=39, B=21)
x2.f <- toTriangular(c(AA=28, AB=30, BB=8))
# }
# NOT RUN {
out <- HWPerm.mult(x2.m,x2.f)
# }
# NOT RUN {
#
# autosomal k alleles not accounting for gender
#

x3 <- c(AA=12,AB=19,AC=13,BB=7,BC=5,CC=0)
x3 <- toTriangular(x3)
# }
# NOT RUN {
out <- HWPerm.mult(x3)
# }
# NOT RUN {
#
# X-chromosomal k alleles 
#

x4.m <- c(A=15,B=17,C=24) 
x4.f <- toTriangular(c(AA=4,AB=2,AC=13,BB=6,BC=19,CC=4))
# }
# NOT RUN {
out <- HWPerm.mult(x4.m,x4.f)
# }
# NOT RUN {
#
# Autosomal k alleles accounting for gender
#

x5.m <- toTriangular(c(AA=12,AB=19,AC=13,BB=7,BC=5,CC=0))
x5.f <- toTriangular(c(AA=8,AB=12,AC=13,BB=8,BC=7,CC=0))
# }
# NOT RUN {
out <- HWPerm.mult(x5.m,x5.f)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab