loadhaplo: Load haplotype genotype data

ghap.loadhaploR Documentation

Load haplotype genotype data

Description

This function loads HapGenotypes generated by ghap.haplotyping and converts them to a native GHap.haplo object.

Usage

  ghap.loadhaplo(input.file = NULL,
                 hapsamples.file = NULL,
                 hapalleles.file = NULL,
                 hapgenotypesb.file = NULL,
                 verbose = TRUE)

Arguments

input.file

Prefix for input files.

hapsamples.file

Individual information file.

hapalleles.file

Haplotype alleles information file.

hapgenotypesb.file

Binary haplotype genotype matrix file.

verbose

A logical value specifying whether log messages should be printed (default = TRUE).

Value

The returned GHap.haplo object is a list with components:

nsamples

An integer value for the sample size.

nalleles

An integer value for the number of haplotype alleles.

nsamples.in

An integer value for the number of active samples.

nalleles.in

An integer value for the number of active haplotype alleles.

pop

A character vector relating samples to populations. This information is obtained from the first column of the hapsamples file.

id

A character vector mapping genotypes to samples. This information is obtained from the second column of the hapsamples file.

id.in

A logical vector indicating active samples. By default, all samples are set to TRUE.

chr

A character vector mapping haplotype alleles to chromosomes. This information is obtained from the second column of the hapalleles file.

block

A character vector containing block names. This information is obtained from the first column of the hapalleles file.

bp1

A numeric vector with haplotype allele start positions. This information is obtained from the third column of the hapalleles file.

bp2

A numeric vector with haplotype allele end positions. This information is obtained from the fourth column of the hapalleles file.

allele

A character vector with haplotype allele identity. This information is obtained from the fifth column of the hapalleles file.

allele.in

A logical vector indicating active haplotype alleles. By default, all alleles are set to TRUE.

genotypes

A character value giving the pathway to the binary haplotype genotype matrix.

The input format is described in ghap.haplotyping.

Author(s)

Yuri Tani Utsunomiya <ytutsunomiya@gmail.com>
Marco Milanesi <marco.milanesi.mm@gmail.com>

Examples


# #### DO NOT RUN IF NOT NECESSARY ###
# 
# # Copy phase data in the current working directory
# exfiles <- ghap.makefile(dataset = "example",
#                          format = "phase",
#                          verbose = TRUE)
# file.copy(from = exfiles, to = "./")
# 
# # Load data
# phase <- ghap.loadphase("example")
# 
# # Generate blocks of 5 markers sliding 5 markers at a time
# blocks <- ghap.blockgen(phase, windowsize = 5,
#                         slide = 5, unit = "marker")
# 
# # Haplotyping
# ghap.haplotyping(phase = phase, blocks = blocks, outfile = "example",
#                  binary = T, ncores = 1)
# 
# ### RUN ###
# 
# # Load haplotype genotypes using prefix
# haplo <- ghap.loadhaplo("example")
# 
# # Load haplotype genotypes using file names
# haplo <- ghap.loadhaplo(hapsamples.file = "example.hapsamples",
#                         hapalleles.file = "example.hapalleles",
#                         hapgenotypesb.file = "example.hapgenotypesb")


GHap documentation built on July 2, 2022, 1:07 a.m.