HWE: Hardy-Weinberg Equilibrium test for multilocus data

Description Usage Arguments Details Value Author(s) See Also Examples

Description

The function HWE.test is a generic function to perform Hardy-Weinberg Equilibrium tests defined by the genetics package. adegenet proposes a method for genind objects.

The output can be of two forms:
- a list of tests (class htest) for each locus-population combinaison
- a population x locus matrix containing p-values of the tests

Usage

1
2
## S3 method for class 'genind'
HWE.test(x,pop=NULL,permut=FALSE,nsim=1999,hide.NA=TRUE,res.type=c("full","matrix"))

Arguments

x

an object of class genind.

pop

a factor giving the population of each individual. If NULL, pop is seeked from x\$pop.

permut

a logical passed to HWE.test stating whether Monte Carlo version (TRUE) should be used or not (FALSE, default).

nsim

number of simulations if Monte Carlo is used (passed to HWE.test).

hide.NA

a logical stating whether non-tested loci (e.g., when an allele is fixed) should be hidden in the results (TRUE, default) or not (FALSE).

res.type

a character or a character vector whose only first argument is considered giving the type of result to display. If "full", then a list of complete tests is returned. If "matrix", then a matrix of p-values is returned.

Details

Monte Carlo procedure is quiet computer-intensive when large datasets are involved. For more precision on the performed test, read HWE.test documentation (genetics package).

Value

Returns either a list of tests or a matrix of p-values. In the first case, each test is designated by locus first and then by population. For instance if res is the "full" output of the function, then the test for population "PopA" at locus "Myloc" is given by res$Myloc$PopA. If res is a matrix of p-values, populations are in rows and loci in columns. P-values are given for the upper-tail: they correspond to the probability that an oberved chi-square statistic as high as or higher than the one observed occured under H0 (HWE).

In all cases, NA values are likely to appear in fixed loci, or entirely non-typed loci.

Author(s)

Thibaut Jombart t.jombart@imperial.ac.uk

See Also

HWE.test in the genetics package, chisq.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
data(nancycats)
obj <- nancycats
if(require(genetics)){
obj.test <- HWE.test(obj)

# pvalues matrix to have a preview
HWE.test(obj,res.type="matrix")

#more precise view to...
obj.test$fca90$P10
}

## End(Not run)

Example output

Loading required package: ade4

   /// adegenet 2.0.1 is loaded ////////////

   > overview: '?adegenet'
   > tutorials/doc/questions: 'adegenetWeb()' 
   > bug reports/feature requests: adegenetIssues()


Loading required package: genetics
Loading required package: combinat

Attaching package: 'combinat'

The following object is masked from 'package:utils':

    combn

Loading required package: gdata
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to locate valid perl interpreter
gdata: 
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata: 
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.

gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.

gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.

Attaching package: 'gdata'

The following object is masked from 'package:stats':

    nobs

The following object is masked from 'package:utils':

    object.size

The following object is masked from 'package:base':

    startsWith

Loading required package: gtools

Attaching package: 'gtools'

The following object is masked from 'package:adegenet':

    chr

Loading required package: MASS
Loading required package: mvtnorm


NOTE: THIS PACKAGE IS NOW OBSOLETE.



  The R-Genetics project has developed an set of enhanced genetics

  packages to replace 'genetics'. Please visit the project homepage

  at http://rgenetics.org for informtion.




Attaching package: 'genetics'

The following objects are masked from 'package:base':

    %in%, as.factor, order

As of adegenet_1.5-0, this function has been removed and is replaced by 'hw.test' in the package 'pegas'
As of adegenet_1.5-0, this function has been removed and is replaced by 'hw.test' in the package 'pegas'
NULL

adegenet documentation built on July 18, 2021, 1:06 a.m.