Load haplotype genotype data

Share:

Description

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

Usage

1
  ghap.loadhaplo(hapsamples.file, hapalleles.file, hapgenotypes.file, verbose = TRUE)

Arguments

hapsamples.file

Individual information file.

hapalleles.file

Haplotype alleles information file.

hapgenotypes.file

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 big.matrix object containing the 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# #### DO NOT RUN IF NOT NECESSARY ###
# 
# # Copy the example data in the current working directory
# ghap.makefile()
# 
# # Load data
# phase <- ghap.loadphase("human.samples", "human.markers", "human.phase")
# 
# # Subset data - randomly select 3000 markers with maf > 0.02
# maf <- ghap.maf(phase, ncores = 2)
# set.seed(1988)
# markers <- sample(phase$marker[maf > 0.02], 3000, replace = FALSE)
# phase <- ghap.subsetphase(phase, unique(phase$id), markers)
# rm(maf,markers)
# 
# # Generate block coordinates based on windows of 10 markers, sliding 5 marker at a time
# blocks <- ghap.blockgen(phase, 10, 5, "marker")
# 
# 
# ### RUN ###
# 
# # Generate matrix of haplotype genotypes
# ghap.haplotyping(phase, blocks, batchsize = 100, ncores = 2, freq = 0.05, outfile = "example")
# 
# # Load haplotype genotypes
# haplo <- ghap.loadhaplo("example.hapsamples", "example.hapalleles", "example.hapgenotypes")