HWETest: Test for Hardy Weinberg equilibrium

View source: R/stats.R

HWETestR Documentation

Test for Hardy Weinberg equilibrium

Description

Test experiment features for Hardy Weinberg equilibrium.

Usage

HWETest(
  object,
  experiment = c("hla_alleles", "hla_aa", "hla_g_groups", "hla_supertypes",
    "hla_NK_ligands"),
  HWE_group = NULL,
  HWE_cutoff = NULL,
  as.MiDAS = FALSE
)

Arguments

object

MiDAS object.

experiment

String specifying experiment to test. Valid values includes "hla_alleles", "hla_aa", "hla_g_groups", "hla_supertypes", "hla_NK_ligands".

HWE_group

Expression defining samples grouping to test for Hardy Weinberg equilibrium. By default samples are not grouped.

HWE_cutoff

Number specifying p-value threshold. When HWE_group is specified both groups are thresholded.

as.MiDAS

Logical flag indicating if MiDAS object should be returned.

Details

Setting as.MiDAS to TRUE will filter MiDAS object based on p-value cut-off given by HWE_cutoff.

Value

Data frame with Hardy Weinberg Equilibrium test results or a filtered MiDAS object.

Examples

# create MiDAS object
midas <- prepareMiDAS(hla_calls = MiDAS_tut_HLA,
                      colData = MiDAS_tut_pheno,
                      experiment = "hla_alleles"
)

# get HWE p-values as data frame
HWETest(midas, experiment = "hla_alleles")

# get HWE in groups defined by disease status
# grouping by `disease == 1` will divide samples into two groups:
# `disease == 1` and `not disease == 1`
HWETest(midas, experiment = "hla_alleles", HWE_group = disease == 1)

# filter MiDAS object by HWE test p-value
HWETest(midas, experiment = "hla_alleles", HWE_cutoff = 0.05, as.MiDAS = TRUE)


Genentech/midasHLA documentation built on Feb. 12, 2024, 9:38 a.m.