Calculate minor allele frequency (MAF) at every loci

compute_maf(snpdata, include_het = FALSE, mat_name = "GT", name = NULL)

Arguments

snpdata

An object of class SNPdata

include_het

A Boolean that specifies whether to account for the heterozygous allele or not. This can only be activated when mat_name = "GT" or mat_name = "Imputed".

mat_name

A string with the name of the matrix to be used. Default is "GT". The other possible values are "Phased", "Imputed", "Phased_imputed".

name

A character with the name of the new column that will created to store the MAF values.

Value

The input SNPdata object with following 2 additional columns in the details table:

  1. MAF: minor allele frequency at every each SNPs

  2. MAF_allele: the code for the minor allele. Possible values are: 1: the alternate allele is the minor allele, 0: the reference allele is the minor allele, 0/1: the heterozygous allele is the minor allele, 0=1: the reference and alternate alleles have the same frequencies, 0=1=2: the three alleles have the same frequencies.

Details

If include_het = FALSE, the mixed alleles will not be considered in the MAF calculation.

Examples

if (FALSE) { # \dontrun{
  snpdata <- compute_maf(
    snpdata,
    include_het = FALSE,
    mat_name    = "GT"
  )
} # }