Learn R Programming

geneHapR (version 1.2.4)

import_hap: Import hapResult/hapSummary

Description

This function could be used for import hap result or hap summary result. The type of returned object is decided by input file, see details.

Usage

import_hap(file, type = "auto", ...)

Value

hapSummary or hapResult

Arguments

file

hapSummary or hapResult file path.

type

the content type of imported file, should be one of c("hapResult", "hapSummary")

...

extras will pass to read.delim()

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

oldDir <- getwd()
temp_dir <- tempdir()
if(! dir.exists(temp_dir))
  dir.create(temp_dir)
setwd(temp_dir)
data("geneHapR_test")
write.hap(hapResult, file = "test.pheno.txt", sep = "\t")
hap <- import_hap("test.pheno.txt")
hap
setwd(oldDir)

Run the code above in your browser using DataLab