lumpAlleles: Allele lumping

View source: R/lumpAlleles.R

lumpAllelesR Documentation

Allele lumping

Description

Perform allele lumping (i.e., merging unobserved alleles) for all markers attached to the input pedigree.

Usage

lumpAlleles(
  x,
  markers = NULL,
  always = FALSE,
  special = TRUE,
  alleleLimit = Inf,
  verbose = FALSE
)

Arguments

x

A ped object or a list of such.

markers

A vector of names or indices referring to markers attached to x. (Default: All markers.)

always

A logical. If TRUE, lumping is always attempted. By default (FALSE) lumping is skipped for markers where no individuals, or all individuals, are genotyped.

special

A logical. If TRUE, special lumping procedures (depending on the pedigree) will be attempted if the marker has a mutation model that is not generally lumpable (in the Kemeny-Snell sense).

alleleLimit

A positive number or Inf (default). If the mutation model is not generally lumpable, and the allele count exceeds this limit, switch to an equal model with the same rate and reapply lumping.

verbose

A logical.

Value

An object similar to x, but whose attached markers have reduced allele set.

Examples

x = nuclearPed() |> addMarker(geno = c(NA, NA, "1/1"), alleles = 1:5)

# Before lumping
afreq(x, 1)

# Lump
y = lumpAlleles(x, verbose = TRUE)
afreq(y, 1)

# With lumpable mutation model
x2 = setMutmod(x, model = "equal", rate = 0.1)
mutmod(x2, 1)

y2 = lumpAlleles(x2, verbose = TRUE)
mutmod(y2, 1)

# Mutation model requiring special lumping
x3 = setMutmod(x, model = "random", rate = 0.1, seed = 1)
mutmod(x3, 1)

# Lump
y3 = lumpAlleles(x3, verbose = TRUE)

mutmod(y3, 1)

stopifnot(all.equal(likelihood(x), likelihood(y)),
          all.equal(likelihood(x2), likelihood(y2)),
          all.equal(likelihood(x3), likelihood(y3)))


pedprobr documentation built on June 8, 2025, 10:56 a.m.