genoDoses2genoClasses: Convert genotypes

View source: R/quantgen.R

genoDoses2genoClassesR Documentation

Convert genotypes

Description

Convert SNP genotypes from "allele doses" into "genotypic classes". Let us denote by "A" (or A1) the first allele, and "B" (or A2) the second allele. The specific nucleotides (A, C, G or T) corresponding to "A" and "B" are specified via the allele argument to the function. Moreover, whether A is the major (most frequent) allele or not, doesn't matter for the function to work. At a given SNP, genotypes being homozygous for the first allele are coded as "0" in allele dose, and will be converted into "AA" in genotypic class. Those being heterozygous are "1" and will be "AB". Finally, those being homozygous for the second allele are "2" and will be "BB". The code is not particularly efficient, but at least it exists.

Usage

genoDoses2genoClasses(
  X = NULL,
  tX = NULL,
  alleles,
  na.string = "--",
  nb.cores = 1,
  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,1,2, with genotypes in rows and SNPs in columns; the "second" allele is arbitrary, it corresponds to the second column of alleles, which can be the minor or the major allele

tX

matrix with SNPs in rows and genotypes in columns

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; only the rows corresponding to SNPs in X or tX will be kept

na.string

character used to replace NA values

nb.cores

the number of cores to use, i.e. at most how many child processes will be run simultaneously (not on Windows)

verbose

verbosity level (0/1)

Value

data.frame with SNPs in rows and genotypes in columns

Author(s)

Timothee Flutre

See Also

genoClasses2genoDoses


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