Genotype Frequencies & Hardy Weinberg

Genotype Frequency Operations are performed together with a Hardy-Weinberg QA test. Only Markers and Samples that have passed the basic Matrix QA, filtered by specified missingness thresholds as well as non-mismatching markers status will be considered in the Genotype Frequency count & Hardy Weinberg Operation.

Genotype Frequency count

A recount of Genotypes is done, and a 3×3 contingency table is created for each marker as in the following example:

AA Aa aa
Case 110 85 15
Control 90 72 48
All 200 157 63

Hardy-Weinberg

Similarly to what’s exposed above, an alternate genotype frequency count is performed on the control population to calculate the Hardy-Weinberg test. This is necessary for non-autosomal chromosomes, where only the female samples in the control population are taken in account to calculate the Hardy-Weinberg test.

The Hardy-Weinberg test is calculated through the Chi-Square value, as in the following contingency table example:

AA Aa aa
Observed 90 72 48
Expected 75.6 100.8 33.6

To arrive at this table, first we calculate the frequency of every observed allele:

``` freq A = ((observed AA count × 2) + observed Aa count) / (total genotypes count × 2) freq a = ((observed aa count × 2) + observed Aa count) / (total genotypes count × 2) ```

Having the equation for genotype frequencies:

``` pAA = freq A² pAa = 2 × freq A × freq a paa = freq a² ```

The expected frequencies are:

``` expAA = pAA × total genotypes count expAa = pAa × total genotypes count expaa = paa × total genotypes count ```

Once this contingency table is built for every marker, the X² (Chi-Square) is calculated as follows:

`X² = (obsAA-expAA)²/(expAA) + (obsaa-expaa)²/(expaa) + (obsAa-expAa)²/(expAa)`

From this X² value, a p-value can be calculated for a X² distribution with 1 degree of freedom.

Heterozygosity

The last test to be calculated in this Operation is the Observed and Expected Heterozygosity:

```Observed Heterozygosity = obsAa / total genotypes count Expected Heterozygosity = pAa```

See Genotype Frequency & Hardy-Weinberg section for details on table displays.