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

Description Usage Arguments Value Author(s) Examples

View source: R/basic.R

Description

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

Usage

1
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

Author(s)

Ruidong Li

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

Example output



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