recode.snpdata: Recode SNP marker data.

Description Usage Arguments Details Value Examples

Description

recode.snpdata recodes SNP marker data for use with other functions in this package.

Usage

1
2
3
recode.snpdata(data, snp.major = FALSE, ma.ref = FALSE,
  input.haplotype = FALSE, output.allele = TRUE, output.haplotype = FALSE,
  na.string = NULL)

Arguments

data

numeric matrix or dataframe.

snp.major

logical.

ma.ref

logical.

input.haplotype

logical.

output.allele

logical.

output.haplotype

logical.

na.string

numeric or character vector.

Details

The standard marker data used by other functions of this package takes one of three forms: (a) subjects by row, counts of reference alleles by column; (b) subjects by row, allelic types (2 per marker) by column; (c) haplotypes (2 per subject) by row, allelic types by column. Reference alleles are coded 1, alternate alleles are coded 2.

By default, snp.major = FALSE, set it to TRUE if input matrix has SNPs by row and allelic types (2 per subject) by column. ma.ref = FALSE, set it to TRUE if the minor allele is to be the reference allele. input.haplotype = FALSE, set it to TRUE if input matrix has haplotypes (2 per subject) by row and allelic types by column. output.allele = TRUE, set it to FALSE if counts of reference alleles is the desired output format. output.haplotype = FALSE, set it to TRUE if recoded marker data by haplotype is the desired output format. input.haplotype is only invoked when snp.major = FALSE. output.haplotype is only invoked when output.allele = TRUE.

Value

A list of two elements. First element named data is a matrix of recoded marker data in specified format. Second element is a dataframe named alleles that specifies reference/alternate alleles at all markers.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
test.dat = matrix(c(3,4,4,3), 4, 10)

# treat test.dat as 4 input haplotypes of two subjects at 10 SNP markers,
# output recoded data as haplotypes
recode.snpdata(test.dat, input.haplotype = TRUE, output.haplotype = TRUE)

# treat test.dat as 4 input haplotypes of two subjects at 10 SNP markers,
# output recoded data as counts of reference alleles
recode.snpdata(test.dat, input.haplotype = TRUE, output.allele = FALSE)
#'
# treat test.dat as allelic types at 5 SNPs of 4 subjects,
# output recoded data as haplotypes
recode.snpdata(test.dat, output.haplotype = TRUE)

bowenwang7/r3 documentation built on May 17, 2019, 6:39 p.m.