scrime (version 1.3.5)

recodeAffySNP: Recoding of Affymetrix SNP Values

Description

Recodes the values used on Affymetrix SNP chips to code the genotypes to other values -- required, e.g., by other functions of this package.

Usage

recodeAffySNP(mat, refAA = FALSE, geno = 1:3)

Arguments

mat

a matrix or data frame consisting of the character strings "AA", "AB", "BB". Missing values can be coded by either "NN" or NA. Each row is assumed to correspond to a variable, and each column to a microarray.

refAA

codes "AA" always for the homozygous reference genotype? If TRUE, "AA" is always replaced by geno[1], and "BB" by geno[3]. If FALSE, it is evaluated rowwise whether "AA" or "BB" occurs more often, and the more frequently occuring value is set to geno[1].

geno

a numeric or character vector of length 3 giving the three values that should be used to recode the genotypes. By default, geno = 1:3 which is the coding, e.g., required by rowChisqStats or pamCat.

Value

A matrix of the same size as mat containing the recoded genotypes. (Missing values are coded by NA.)

See Also

recodeSNPs, snp2bin

Examples

Run this code
# NOT RUN {
# Generate a sample data set consisting of 10 rows and 12 columns,
# and randomly replace 5 of the values by "NN".

mat <- matrix("", 10, 12)
mat[1:5,] <- sample(c("AA", "AB", "BB"), 60, TRUE,
   prob = c(0.49, 0.42, 0.09))
mat[6:10,] <- sample(c("AA", "AB", "BB"), 60, TRUE,
   prob = c(0.09, 0.42, 0.49))
mat[sample(120, 5)] <- "NN"
mat

# Recode the SNPs.

recodeAffySNP(mat)

# Recode the SNPs assuming that "A" is always the major allele.

recodeAffySNP(mat, refAA = TRUE)

# }

Run the code above in your browser using DataLab