hwe_frequencies: Fast estimation of allele and genotype frequencies under Hardy-Weinberg equilibrium
Description
Alleles are assumed to be numerated from 1 and up with no missing label. Thus if the largest value in either allele1 or allele2 is K then we assume that there can be at least K possible alleles.
Genotypes are sorted such the the smallest allele comes first, i.e., 2x1 -> 1x2, and 2x3 -> 2x3
A list with three variables: allele_freq for estimated allele frequencies, genotype_freq for estimated genotype_frequencies (under HWE assumption), obs_genotype is the frequency of the genotypes, available_genotypes is the number of available genotypes used for the estimation, and unique_alleles is the number of unique alleles (matches the length of allele_freq)
Arguments
allele1
An integer vector (starting with values 1 upwards) of first alleles
allele2
An integer vector (starting with values 1 upwards) of second alleles