hapstats: Haplotype allele statistics

ghap.hapstatsR Documentation

Haplotype allele statistics

Description

Summary statistics for HapAlleles.

Usage

ghap.hapstats(object,
              alpha = c(1, 1),
              batchsize = NULL,
              only.active.samples = TRUE,
              only.active.alleles = TRUE,
              ncores = 1, verbose = TRUE)

Arguments

object

A GHap.haplo object.

alpha

A numeric vector of size 2 specifying the shrinkage parameters for the expected-to-observed homozygotes ratio. Default is c(1, 1).

batchsize

A numeric value controlling the number of HapAlleles to be processed at a time (default = nalleles/10).

only.active.samples

A logical value specifying whether only active samples should be included in the output (default = TRUE).

only.active.alleles

A logical value specifying whether only active haplotype alleles should be included in the output (default = TRUE).

ncores

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

verbose

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

Value

A data frame with columns:

BLOCK

Block alias.

CHR

Chromosome name.

BP1

Block start position.

BP2

Block end position.

ALLELE

Haplotype allele identity.

N

Number of observations for the haplotype.

FREQ

Haplotype frequency.

O.HOM

Observed number of homozygotes.

O.HET

Observed number of heterozygotes.

E.HOM

Expected number of homozygotes.

RATIO

Shrinkage expected-to-observed ratio for the number of homozygotes.

BIN.logP

log10(1/P) or -log10(P) for Hardy-Weinberg equilibrium assuming number of homozygotes follows a Binomial distribution.

POI.logP

log10(1/P) or -log10(P) for Hardy-Weinberg equilibrium assuming number of homozygotes follows a Poisson distribution.

TYPE

Category of the HapAllele: "SINGLETON" = single allele of its block; "ABSENT" = the frequency of the allele is 0; "MINOR" = the least frequent allele of its block (in the case of ties, only the first allele is marked); "MAJOR" = the most frequent allele of its block (ties are also resolved by marking the first allele); "REGULAR" = the allele does not fall in any of the previous categories. Categories "SINGLETON", "MINOR" and "MAJOR" only apply for blocks where frequencies sum to 1.

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 = "./")
# 
# ### RUN ###
# 
# # 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")
# 
# ### RUN ###
# 
# # 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)


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