Learn R Programming

SeqVarTools (version 1.10.0)

hwe: Exact test for Hardy-Weinberg equilibrium

Description

Performs an exact test for Hardy-Weinberg equilibrium on Single-Nucleotide Variants

Usage

"hwe"(gdsobj, permute=FALSE)

Arguments

gdsobj
A SeqVarGDSClass object with VCF data.
permute
A logical indicating whether to permute the genotypes to get a set of p-values under the null hypothesis.

Value

A data.frame with the following columns:
variant.id
The unique identifier for the variant
nAA
The number of reference homozygotes
nAa
The number of heterozygotes
naa
The number of alternate homozygotes
afreq
The reference allele frequency
p
p values for the exact test
f
The inbreeding coefficient, 1 - observed heterozygosity / expected heterozygosity

Details

HWE calculations are performed with the HWExact function in the GWASExactHW package.

permute=TRUE will permute the genotypes prior to running the test. This can be useful for obtaining a set of expected values under the null hypothesis to compare to the observed values.

P values are set to NA for all multiallelic and monomorphic variants.

See Also

SeqVarGDSClass, applyMethod

Examples

Run this code
gds <- seqOpen(seqExampleFileName("gds"))
## autosomal variants only
auto <- seqGetData(gds, "chromosome") %in% 1:22
var.auto <- seqGetData(gds, "variant.id")[auto]
hw <- applyMethod(gds, hwe, variant=var.auto)
head(hw)
sum(is.na(hw$p))
range(hw$p, na.rm=TRUE)
seqClose(gds)

Run the code above in your browser using DataLab