base2num: Convert genotype coded in A/T/C/G to 0/1

Description Usage Arguments Value Author(s) Examples

View source: R/basic.R

Description

Convert base (A/T/C/G) coded genotype to numeric (0/1) coded

Usage

1
base2num(gmt, ref, alt)

Arguments

gmt

a dataframe of genotype data of gamete cells

ref

a character represents reference allele

alt

a character represents alternative allele

Value

a dataframe containing converted genotype

Author(s)

Ruidong Li

Examples

1
2
3
4
5
6
7
8
9
ref <- sample(c('A','T'),500, replace=TRUE)
alt <- sample(c('C','G'),500, replace=TRUE)

gmt <- data.frame(chr=rep(1,500), pos=seq_len(500),
    ref=ref, alt=alt, gmt1=ref, gmt2=alt, gmt3=ref,
    gmt4=ref, gmt5=c(alt[1:250], ref[251:500]),
    stringsAsFactors = FALSE)
    
gmtDa <- base2num(gmt=gmt[5:9], ref=ref, alt=alt)

Hapi documentation built on May 2, 2019, 6:52 a.m.