Hardy-Weinberg {genepop}R Documentation

Tests of Hardy-Weinberg genotypic proportions

Description

Compute variants of the exact conditional test for Hardy-Weinberg genotypic proportions. The tests differ by their test statistics. HWtable_analysis handles a single table of genotype counts, and test_HW requires a standard genepop input file. See this section of the Genepop-executable documentation for more information on the statistical methods.

Usage

test_HW(
  inputFile,
  which = "Proba",
  outputFile = "",
  settingsFile = "",
  enumeration = FALSE,
  dememorization = 10000,
  batches = 20,
  iterations = 5000,
  verbose = interactive()
)

HWtable_analysis(
  inputFile,
  which = "Proba",
  settingsFile = "",
  enumeration = FALSE,
  dememorization = 10000,
  batches = 20,
  iterations = 5000,
  verbose = interactive()
)

Arguments

inputFile

character: The path of the input file. For test_HW, this file should be in Genepop format. For HWtable_analysis, it should be in ad hoc format illustrated by sample file Rhesus.txt used in the Examples section, and further detailed in this section of the Genepop-executable documentation.

which

character: 'Proba', 'excess', and 'deficit' to perform the probability test, score test for excess, and score tests for deficit, respectively, in each population and for each locus. test_HW additionally handles 'global excess' and 'global deficit' for global tests for all loci and/or all populations, and HWtable_analysis additionally handles 'Fis' to report basic information (allele frequencies and Fis).

outputFile

character: The path of the output file

settingsFile

character: The path of the settings file

enumeration

logical: whether to compute the complete enumeration test for samples with less than 5 alleles

dememorization

integer: length of dememorization step of Markov chain algorithm

batches

integer: Number of batches

iterations

integer: Iterations per batch

verbose

logical: whether to print some information

Value

The path of the output file is returned invisibly.

Examples

locinfile <- genepopExample('sample.txt')
test_HW(locinfile, which='deficit', 'sample.txt.D')
if ( ! interactive()) clean_workdir(otherfiles='sample.txt')
# Example in Guo & Thompson 1992 Table 5
locinfile <- genepopExample('Rhesus.txt')
outfile <- HWtable_analysis(locinfile,which='Proba',batches = 1000,iterations = 1000)
readLines(outfile)[21]
#clean_workdir(otherfiles='Rhesus.txt')

[Package genepop version 1.2.2 Index]