hwe_frequencies: Fast estimation of allele and genotype frequencies under...

View source: R/RcppExports.R

hwe_frequenciesR Documentation

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

Usage

hwe_frequencies(allele1, allele2, min_alleles = 0L)

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

min_alleles

A minimum number of unique alleles available

Value

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)

Author(s)

Claus Ekstrom <claus@rprimer.dk>

Examples

al1 <- sample(1:5, size=1000, replace=TRUE, prob=c(.4, .2, .2, .1, .1))
al2 <- sample(1:5, size=1000, replace=TRUE, prob=c(.4, .2, .2, .1, .1))
hwe_frequencies(al1, al2)


MESS documentation built on Aug. 21, 2023, 1:05 a.m.

Related to hwe_frequencies in MESS...