Learn R Programming

gdmp (version 0.2.0)

getMAF: 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.

Value

Allele frequency of the minor allele.

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.

References

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

See Also

snpSelect, snpRecode, toArray

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab