isHomozygous: Find homozygous genotypes

View source: R/marker_stats.R

isHomozygousR Documentation

Find homozygous genotypes

Description

Identifies homozygous genotypes in the marker data. A genotype is homozygous if both alleles are non-missing and equal.

Usage

isHomozygous(x, ids = typedMembers(x), count = FALSE)

Arguments

x

A ped object or a list of such. An error is raised if x has no marker data.

ids

A vector of individual ID labels. Defaults to all typed members of x.

count

A logical. If TRUE, return counts per individual.

Value

By default, a logical matrix of dimension ⁠N x L⁠, where N is length(ids) and L is the number of markers. If count = TRUE, a numeric vector of length N giving the number of homozygous genotypes for each individual.

Examples

x = nuclearPed(father = "fa", mother = "mo", children = "ch") |>
  addMarker(name = "m1", geno = c(NA, "1/1", "1/2")) |>
  addMarker(name = "m2", geno = c(NA, "2/2", "2/2"))

isHomozygous(x)
isHomozygous(x, ids = "mo")
isHomozygous(x, count = TRUE)


pedtools documentation built on Feb. 1, 2026, 5:06 p.m.