recodeAffySNP: Recoding of Affymetrix SNP Values

Description Usage Arguments Value See Also Examples

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## 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)


## End(Not run)

scrime documentation built on May 2, 2019, 10:24 a.m.

Related to recodeAffySNP in scrime...