af | R Documentation |
Function af
computes the allele frequency for a vector with autosomal or X-chromosomal genotype counts or compositions.
af(x)
x |
a vector or matrix with counts or compositions. |
Function af
calculates the A allele frequency for the given order of autosomal genotype counts (AA,AB,BB) or the given order of
X chromosomal genotype counts (A,B,AA,AB,BB). The genotypes must be supplied this order. Use maf
to calculate the minor allele
frequency and more flexible coding.
a vector with allele frequencies
Jan Graffelman (jan.graffelman@upc.edu)
maf
, afx
#
# A simulated random marker
#
X <- as.vector(rmultinom(1,100,c(0.5,0.4,0.1)))
X <- X/sum(X)
print(X)
print(af(X))
#
# MN blood group counts
#
x <- c(MM=298,MN=489,NN=213)
#
# Calculate frequency M allele
#
af(x)
#
# Calculate frequency N allele
#
af(rev(x))
1 - af(x)
#
# Calculated allele frequencies (p) for a matrix of genotype counts.
#
X <- HWData(nm=10,n=100)
X
p <- af(X)
p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.