loci_hwe | R Documentation |
Return the p-value from an exact test of HWE.
loci_hwe(.x, .col = "genotypes", ...)
## S3 method for class 'tbl_df'
loci_hwe(.x, .col = "genotypes", mid_p = TRUE, ...)
## S3 method for class 'vctrs_bigSNP'
loci_hwe(.x, .col = "genotypes", mid_p = TRUE, ...)
## S3 method for class 'grouped_df'
loci_hwe(
.x,
.col = "genotypes",
mid_p = TRUE,
n_cores = bigstatsr::nb_cores(),
block_size = bigstatsr::block_size(nrow(.x), 1),
type = c("tidy", "list", "matrix"),
...
)
.x |
a vector of class |
.col |
the column to be used when a tibble (or grouped tibble is passed directly to the function). This defaults to "genotypes" and can only take that value. There is no need for the user to set it, but it is included to resolve certain tidyselect operations. |
... |
not used. |
mid_p |
boolean on whether the mid-p value should be computed. Default is TRUE, as in PLINK. |
n_cores |
number of cores to be used, it defaults to
|
block_size |
maximum number of loci read at once. |
type |
type of object to return, if using grouped method. One of "tidy", "list", or "matrix". Default is "tidy". |
This function uses the original C++ algorithm from PLINK 1.90.
a vector of probabilities from HWE exact test, one per locus
the C++ algorithm was written by Christopher Chang for PLINK 1.90, based on original code by Jan Wigginton (the code was released under GPL3).
example_gt <- load_example_gt("gen_tbl")
# For HWE
example_gt %>% loci_hwe()
# For loci_hwe per locus per population, use reframe
example_gt %>%
group_by(population) %>%
reframe(loci_hwe = loci_hwe(genotypes))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.