Learn R Programming

hsphase (version 2.0.4)

.maf: Calculate Minor Allele Frequency (MAF)

Description

This function calculates the minor allele frequency (MAF) for a given single nucleotide polymorphism (SNP) data. The SNP data should be coded numerically: 0 for homozygous for the first allele (AA), 1 for heterozygous (AB), and 2 for homozygous for the second allele (BB). Missing data should be coded as 9.

Usage

.maf(snp)

Value

A numeric value representing the minor allele frequency (MAF) for the SNP data provided.

Arguments

snp

A numeric vector representing the genotype of individuals for a single SNP. The genotype should be coded as 0 for AA, 1 for AB, and 2 for BB. Use 9 to represent missing data.

Examples

Run this code
snp_data <- c(0, 0, 1, 2, 2, 9)
maf_value <- .maf(snp_data)
print(maf_value)

Run the code above in your browser using DataLab