HWPerm.mult: Permutation tests fo variants with multiple alleles

HWPerm.multR Documentation

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 = 1e-10, 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 for the comparison of floating point numbers

verbose

print output or not

...

addtional arguments

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.

Value

pofthesample

probability of the observed sample

pseudodist

probabilities of simulated samples

pval

p-value

Author(s)

Jan Graffelman jan.graffelman@upc.edu

References

Graffelman, J. and Weir, B.S. (2017) Multi-allelic exact tests for Hardy-Weinberg equilibrium that account for gender. Molecular Ecology Resources. 18(3) pp. 461–473. doi: 10.1111/1755-0998.12748

See Also

HWPerm

Examples

#
# bi-allelic autosomal
#

x1 <- c(AA=298,AB=489,BB=213)
## Not run: 
out <- HWPerm.mult(x1)

## End(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)

## End(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)

## End(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)

## End(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)

## End(Not run)

#
# Autosomal STR with multipe alleles
#

data(NistSTRs)
A1 <- NistSTRs[,1]
A2 <- NistSTRs[,2]
GenotypeCounts <- AllelesToTriangular(A1,A2)
print(GenotypeCounts)
## Not run: 
out <- HWPerm.mult(GenotypeCounts)

## End(Not run)

HardyWeinberg documentation built on May 7, 2022, 5:05 p.m.