getMAF {gdmp}R Documentation

Return frequency of the minor allele of a SNP

Description

Given individual genotypes of a single SNP, the function returns allele frequency of the minor allele.

Usage

getMAF(snpG)

Arguments

snpG

is a column vector in the genotypes array, created by toArray and converted to integer genotypes by snpRecode. The column represents genotypes of a single SNP for all individuals in data.

Details

Allele frequency is calculated for one of the two alleles and is returned if it is below 0.5, otherwise ‘1 - allele frequency’ is returned. The function retuns a frequency of 0 for non polymorphic SNPs.

Value

Allele frequency of the minor allele.

References

Falconer and Mackay (1996). Introduction to Quantitative Genetics (4th Edition). Pearson Education Limited, Edinburgh, England.

See Also

snpSelect, snpRecode, toArray

Examples

set.seed(002016)
snpG.1 <- c(rep(0, 100), rep(1, 80), rep(2, 9))
snpG.2 <- c(rep(0, 100), rep(1, 80))
snpG.3 <- c(rep(0, 100), rep(2, 9))
snpG.4 <- c(rep(0, 100))

getMAF(snpG.1)
#        0
#0.2592593

getMAF(snpG.2)
#        1
#0.2222222

getMAF(snpG.3)
#         0
#0.08256881

getMAF(snpG.3)


[Package gdmp version 0.2.0 Index]