ohg: Matrix of Opposing Homozygotes

View source: R/ohg.R

ohgR Documentation

Matrix of Opposing Homozygotes

Description

Creates a matrix of pairwise opposing-homozygote (OH) counts from a genotype matrix.

Usage

ohg(genotypeMatrix)

Arguments

genotypeMatrix

matrix. Genotypes (numeric): 0, 1, 2 for AA, AB, BB and 9 for missing.

Value

Returns a square matrix (sample \times sample) of pairwise counts of opposing homozygotes. (Some versions may return this matrix inside a named list element.)

Note

This function can be slow for large datasets.

Author(s)

Ferdosi, M. H., & Boerner, V. (2014). A fast method for evaluating opposing homozygosity in large SNP data sets. Livestock Science.

See Also

rpoh

Examples

genotype <- matrix(c(
  2,1,0,
  2,0,0,
  0,0,2
), byrow = TRUE, ncol = 3)

ohg(genotype)

hsphase documentation built on Feb. 17, 2026, 5:07 p.m.