recodeGenosMinorSnpAllele: Minor allele frequencies

View source: R/quantgen.R

recodeGenosMinorSnpAlleleR Documentation

Minor allele frequencies

Description

Recode bi-allelic SNP genotypes in terms of the number of copies of the minor allele. Let be a bi-allelic SNP with two alleles, A, the first allele, and B, the second allele. Here, "first" and "second" are arbitrary, meaning that "A" as "B" can be the minor (least frequent) allele. The SNP genotypes are originally coded in number of copies of the second allele: that is, if a genotype is "AA", its allele dose is 0; if "AB", then 1; and if "BB", then 2. Let us now assume that, in fact, "A" is the minor (least frequent) allele, then, when recoding SNP genotypes in terms of minor alleles, "AA" will correspond to 2, "AB" to 1 and "BB" to 0.

Usage

recodeGenosMinorSnpAllele(X, alleles, verbose = 1)

Arguments

X

matrix of bi-allelic SNP genotypes encoded, for each SNP, in number of copies of its second allele, i.e. as allele doses in [0,2], with genotypes in rows and SNPs in columns; missing values should be encoded as NA; the "second" allele is arbitrary, it corresponds to the second column of alleles, which can be the minor or the major allele

alleles

data.frame with SNPs in rows (names as row names) and alleles in columns (exactly 2 columns are required); the second column should correspond to the allele which number of copies is counted at each SNP in X

verbose

verbosity level (0/1)

Value

list with a matrix of SNP genotypes encoded, for each SNP, in number of copies of its minor allele, with genotypes in rows and SNPs in columns, a data.frame of alleles which columns are named "minor" and "major", and a vector of logicals indicating which SNPs have been recoded

Author(s)

Timothee Flutre


timflutre/rutilstimflutre documentation built on Feb. 7, 2024, 8:17 a.m.