Learn R Programming

geneHapR (version 1.2.4)

write.hap: Save Haplotype Results to Disk

Description

This function will write hap result into a txt file.

Usage

write.hap(x, file = file, sep = "\t", pheno = pheno, phenoName = phenoName)

Value

No return value

Arguments

x

objec of hapResult or hapSummary class

file

file path, where to save the hap result/summary

sep

the field separator string. Values within each row of x are separated by this string. Default as "\t"

pheno, phenoName

the phenotype data.frame, only used for export hapResult object.

Details

The hap result and hap summary result have common features. The common features of these two types are: First four rows contains extra information: CHR, POS, INFO and ALLELE Hap names were in the first column. The differences are: Hap summary result have a freq column while hap result not. Rows represent haplotypes in hap summary result, while rows represent accessions in hap result. In addtion, the accessions of each haplotype in hap summary result were separated by ";".

Examples

Run this code


oriDir <- getwd()
 temp_dir <- tempdir()
 if(! dir.exists(temp_dir))
   dir.create(temp_dir)
 setwd(temp_dir)
data("geneHapR_test")
write.hap(hapResult, file = "hapResult.txt")
setwd(oriDir)

Run the code above in your browser using DataLab