blockstats: HapBlock statistics

ghap.blockstatsR Documentation

HapBlock statistics

Description

Generate HapBlock summary statistics from pre-computed HapAlleles statistics.

Usage

ghap.blockstats(hapstats, ncores = 1, verbose = TRUE)

Arguments

hapstats

A data.frame containing HapAllele statistics, as generated by the ghap.hapstats function.

ncores

A numeric value specifying the number of cores to be used in parallel computing (default = 1).

verbose

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

Details

For each HapBlock, the function counts the number of unique HapAlleles and computes the expected heterozygosity 1 - ∑ {p_{i}}^2 , where p_{i} is the frequency of HapAllele i. Please notice that when HapAlleles are prunned out by frequency the block statistics can retrieve high expected heterozygosity for blocks with small number of HapAlleles.

Value

A data frame with columns:

BLOCK

Block alias.

CHR

Chromosome name.

BP1

Block start position.

BP2

Block end position.

EXP.H

Block expected heterozygosity.

N.ALLELES

Number of HapAlleles per block.

Author(s)

Yuri Tani Utsunomiya <ytutsunomiya@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
# blocks <- ghap.blockgen(phase, windowsize = 5,
#                         slide = 5, unit = "marker")
# 
# # Haplotyping
# ghap.haplotyping(phase = phase, blocks = blocks, outfile = "example",
#                  binary = T, ncores = 1)
# 
# # Load haplotype genotypes using prefix
# haplo <- ghap.loadhaplo("example")
# 
# # Subset
# ids <- which(haplo$pop == "Pure1")
# haplo <- ghap.subset(haplo, ids = ids,
#                      variants = haplo$allele.in,
#                      index = TRUE)
# 
# # Compute haplotype statistics
# hapstats <- ghap.hapstats(haplo)
# 
# ### RUN ###
#
# # Compute block statistics
# blockstats <- ghap.blockstats(hapstats)


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