Haplotype block generator

Description

This function generates HapBlocks based on sliding windows. The window and the step size can be specified in markers or kb. For each window, block coordinates are generated.

Usage

1
 ghap.blockgen(phase, windowsize = 10, slide = 5, unit = "marker")

Arguments

phase

A GHap.phase object

windowsize

A numeric value for the size of the window (default = 10).

slide

A numeric value for the step size (default = 5).

unit

A character value for the size unit used for the window and the step. It can be either "marker" or "kb" (default = "marker").

Value

A data frame with columns:

BLOCK

Block alias.

CHR

Chromosome name.

BP1

Block start position.

BP2

Block end position.

SIZE

Haplotype size.

NSNP

Number of marker.

Author(s)

Yuri Tani Utsunomiya <ytutsunomiya@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
# #### 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)
# 
# 
# ### RUN ###
# 
# # Generate block coordinates based on windows of 10 markers, sliding 5 marker at a time
# blocks <- ghap.blockgen(phase, 10, 5, "marker")
# 
# # Generate block coordinates based on windows of 500 kb, sliding 100 kb at a time
# blocks <- ghap.blockgen(phase, 500, 100, "kb")