transHapmap2numeric: Convert genotypic data in character to number for training...

View source: R/otherFunc.r

transHapmap2numericR Documentation

Convert genotypic data in character to number for training models

Description

This function help users to transform genetic matrix from character format to numeric format. AA-0, Aa-1, aa-2, A is major allele and a is minor allele.

Usage

transHapmap2numeric(G)

Arguments

G

Genetic matrix of character, row represents sample and column represents SNP.

Details

0: AA
1: Aa
2: aa

A is major allele and a is minor allele

Value

A matrix for genotypic data in numeric format.

Author(s)

Qian Cheng, Shuqin Jiang, Xiangfeng Wang

Examples

## Not run! 
## load hapmap data (genomic data) of MZ hybrids
data(MZ)

## pre-process for input of transHapmap2numeric 
rownames(MZ) <- MZ[,1]
MZ <- MZ[,-c(1:11)]
MZ.t <- t(MZ)

## conversion
MZ.n <- transHapmap2numeric(MZ.t)
dim(MZ.t)

GOVS-pack/GOVS documentation built on Oct. 9, 2022, 8:29 a.m.