Learn R Programming

Hapi (version 0.0.3)

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

Description

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

Usage

num2base(hap, ref, alt)

Arguments

hap

a dataframe of consensus haplotypes

ref

a character represents reference allele

alt

a character represents alternative allele

Value

a dataframe containing converted haplotypes

Examples

Run this code
# NOT RUN {
ref <- sample(c('A','T'),500, replace=TRUE)
alt <- sample(c('C','G'),500, replace=TRUE)

consensusHap <- data.frame(hap1=rep(0,500),hap2=rep(1,500),
    total=rep(5,500),rate=rep(1,500),
    confidence=rep('F',500),
    stringsAsFactors = FALSE)
rownames(consensusHap) <- seq_len(500)

hap <- num2base(hap=consensusHap, ref=ref, alt=alt)
# }

Run the code above in your browser using DataLab