View source: R/gl.diagnostics.hwe.r
| gl.diagnostics.hwe | R Documentation |
Different causes may be responsible for lack of Hardy-Weinberg proportions. This function helps diagnose potential problems.
gl.diagnostics.hwe(
x,
alpha_val = 0.05,
bins = 20,
stdErr = TRUE,
colors.hist = gl.colors(2, verbose = 0),
colors.barplot = gl.colors("2c", verbose = 0),
plot.theme = theme_dartR(),
n.cores = "auto",
plot.file = NULL,
plot.dir = NULL,
verbose = NULL
)
x |
Name of the genlight object containing the SNP data [required]. |
alpha_val |
Level of significance for testing [default 0.05]. |
bins |
Number of bins to display in histograms [default 20]. |
stdErr |
Whether standard errors for Fis and Fst should be computed (default: TRUE) |
colors.hist |
List of two color names for the borders and fill of the histogram [default gl.colors(2, verbose = 0)]. |
colors.barplot |
Vector with two color names for the observed and expected number of significant HWE tests [default gl.colors("2c", verbose = 0)]. |
plot.theme |
User specified theme [default theme_dartR()]. |
n.cores |
Kept for backward compatibility and ignored: the jackknife is computed directly from the per-locus statistics and needs no parallel processing [default "auto"]. |
plot.file |
Name for the RDS binary file to save (base name only, exclude extension) [default NULL] |
plot.dir |
Directory in which to save files [default = working directory] |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log ; 3, progress and results summary; 5, full report [default NULL, adopting the global verbosity set by gl.set.verbosity(), or 2 if no global is set]. |
This function initially runs gl.report.hwe and reports
the ternary plots. The remaining outputs follow the recommendations from
Waples
(2015) paper and De Meeus 2018. These include:
A histogram with the distribution of p-values of the HWE tests. The distribution should be roughly uniform across equal-sized bins.
A bar plot with observed
and expected (null expectation) number of loci significant in 0, 1, ..., n
populations. The y axis is the number of loci; the expectation is the
number of loci times the binomial probability of that many significant
tests at alpha_val. If HWE tests are significant by chance alone,
observed and expected number of HWE tests should have roughly a similar
distribution.
A scatter plot with a linear regression between Fst and Fis, averaged across subpopulations. De Meeus 2018 suggests that in the case of Null alleles, a strong positive relationship is expected (together with the Fis standard error much larger than the Fst standard error, see below). Note, this is not the scatter plot that Waples 2015 presents in his paper. In the lower right corner of the plot, the Pearson correlation coefficient is reported.
The Fis and Fst (averaged over loci and
subpopulations) standard errors are also printed on screen and reported in
the returned list (if stdErr=TRUE). These are computed with the
Jackknife method over loci (See De Meeus 2007 for details on how this is
computed).
De Meeus 2018 suggests that under a global significant heterozygosity
deficit:
- if the correlation between Fis and Fst is strongly positive, and StdErrFis >> StdErrFst, Null alleles are likely to be the cause.
- if the correlation between Fis and Fst is ~0 or mildly positive, and StdErrFis > StdErrFst, Wahlund may be the cause.
- if the correlation between Fis and Fst is ~0, and StdErrFis ~ StdErrFst, selfing or sib mating could to be the cause.
It is important to realise that these statistics only suggest a pattern (pointers). Their absence is not conclusive evidence of the absence of the problem, as their presence does not confirm the cause of the problem.
A table where the
number of observed and expected significant HWE tests are reported by each
population, indicating whether these are due to heterozygosity excess or
deficiency. These can be used to have a clue of potential problems (e.g.
deficiency might be due to a Wahlund effect, presence of null alleles or
non-random sampling; excess might be due to sex linkage or different
selection between sexes, demographic changes or small Ne. See Table 1 in
Wapples 2015). The last two columns of the table generated by this function
report chisquare values and their associated p-values. Chisquare is computed
following Fisher's procedure for a global test (Fisher 1970), with twice
as many degrees of freedom as HWE tests were run in the population; loci
monomorphic or under-sampled in a population are not tested there, and
the expected number of significant tests is alpha_val times the
number of tests. This basically
tests whether there is at least one test that is truly significant in the
series of tests conducted (De Meeus et al 2009).
A list with the table with the summary of the HWE tests and (if stdErr=TRUE) a named vector with the StdErrFis and StdErrFst.
Author(s): Carlo Pacioni. Custodian: Carlo Pacioni – Post to https://groups.google.com/d/forum/dartr
de Meeus, T., McCoy, K.D., Prugnolle, F., Chevillon, C., Durand, P., Hurtrez-Bousses, S., Renaud, F., 2007. Population genetics and molecular epidemiology or how to "debusquer la bete". Infection, Genetics and Evolution 7, 308-332.
De Meeus, T., Guegan, J.-F., Teriokhin, A.T., 2009. MultiTest V.1.2, a program to binomially combine independent tests and performance comparison with other related methods on proportional data. BMC Bioinformatics 10, 443-443.
De Meeus, T., 2018. Revisiting FIS, FST, Wahlund Effects, and Null Alleles. Journal of Heredity 109, 446-456.
Fisher, R., 1970. Statistical methods for research workers Edinburgh: Oliver and Boyd.
Waples, R. S. (2015). Testing for Hardy-Weinberg proportions: have we lost the plot?. Journal of heredity, 106(1), 1-19.
gl.report.hwe
require("dartR.data")
if (isTRUE(getOption("dartR_fbm"))) platypus.gl <- gl.gen2fbm(platypus.gl)
gl <- gl.filter.allna(platypus.gl[,1:50])
res <- gl.diagnostics.hwe(x = gl , stdErr=FALSE, n.cores=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.