getMAF: Return frequency of the minor allele of a SNP

Description Usage Arguments Details Value References See Also Examples

View source: R/dataEdit.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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)

gdmp documentation built on May 1, 2019, 8:07 p.m.

Related to getMAF in gdmp...