compute_maf: Minor Allele Frequency

Description Usage Arguments Value Examples

View source: R/maf.R

Description

compute_maf returns results from minor allele frequency checks

Usage

1
2
compute_maf(x, output = c("marker_names", "marker_maf", "recoded",
  "geno_list"), missing_value = NA_character_, maf_threshold = 0)

Arguments

x

A matrix. Genotype names are stored in rows whereas marker names are stored in columns.

output

Character vector with output options.

missing_value

Character vector providing the encoding of missing elements.

maf_threshold

Numeric or complex vector specifying the minor allele frequency threshold.

Value

If output is "marker_names" a character vector with marker names that have passed the quality check will be returned. If output is "marker_maf" a numeric vector with the minor allele frequency at each marker locus will be returned. If output is "geno_list" a list with encoding for the major and the minor genotype at each locus will be returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 # Load a matrix with SNP genotypes encoded as numeric values
 data(marker_numeric)

 # Return the names of all polymorphic markers.
 compute_maf(marker_numeric, output = "marker_names",
             missing_value = NA_real_, maf_threshold = 0)

 # Set one locus to monomorphic
 marker_mono <- marker_numeric
 marker_mono[, 1] <- 1
 compute_maf(marker_numeric, output = "marker_names",
             missing_value = NA_real_, maf_threshold = 0)

 # Load a matrix with SNP genotypes encoded as character values
 data(marker_character)

 # Return the minor allele frequency at each locus with MAF >= 0.05.
 compute_maf(marker_character, output = "marker_maf",
             missing_value = "??",
             maf_threshold = 0.05)

 # Return the minor and major genotype at each locus.
 compute_maf(marker_character, output = "geno_list", missing_value = "??",
             maf_threshold = 0)

# Examine a case where there more than three genotypes.
multiple_genotypes <- matrix(c(
 "AA", "AA", "AT", "TT",
 "CC", "CG", "GG", "GG",
 "TT", "NN", "TT", "AA",
 "CC", "CC", "CC", "CC"
), ncol = 4, dimnames = list(NULL, paste0("col", seq_len(4))))
compute_maf(multiple_genotypes, output = "marker_names",
            missing_value = "NN", maf_threshold = 0)

mwesthues/sspredr documentation built on May 23, 2019, 10:56 a.m.