recodeSNPs {scrime} | R Documentation |
Recoding of SNP Values
Description
Recodes the values used to specify the genotypes of the SNPs to other values. Such a recoding might be required to use other functions contained in this package.
Usage
recodeSNPs(mat, first.ref = FALSE, geno = 1:3, snp.in.col = FALSE)
Arguments
mat |
a matrix or data frame consisting of character strings of length 2 that
specify the genotypes of the SNPs. Each of these character strings
must be a combination of the letters A, T, C, and G. Missing values can
be specified by |
first.ref |
does the first letter in the string coding the heterozygous
genotype always stands for the more frequent allele? E.g., codes |
geno |
a numeric or character vector of length 3 giving the three values that
should be used to recode the genotypes. By default, |
snp.in.col |
does each column of |
Value
A matrix of the same size as mat
containing the recoded genotypes. (Missing values are
coded by NA
).
See Also
Examples
## Not run:
# Generate an example data set consisting of 5 rows and 12 columns,
# where it is assumed that each row corresponds to a SNP.
mat <- matrix("", 10, 12)
mat[c(1, 4, 6),] <- sample(c("AA", "AT", "TT"), 18, TRUE)
mat[c(2, 3, 10),] <- sample(c("CC", "CG", "GG"), 18, TRUE)
mat[c(5, 8),] <- sample(c("GG", "GT", "TT"), 12, TRUE)
mat[c(7, 9),] <- sample(c("AA", "AC", "CC"), 12, TRUE)
mat
# Recode the SNPs
recodeSNPs(mat)
# Recode the SNPs by assuming that the first letter in
# the heterogyzous genotype refers to the major allele.
recodeSNPs(mat, first.ref = TRUE)
## End(Not run)