Learn R Programming

pedtools (version 2.12.0)

setMarkersFromMatrix: Attach markers from an allele matrix

Description

A fast alternative to setMarkers() for prepared allele matrices. All pedigree components share the same allele definitions and frequencies. Individuals not present in the matrix receive missing genotypes. If no marker attributes are given (loci), the observed alleles are assigned equal frequencies.

Usage

setMarkersFromMatrix(x, alleleMatrix = NULL, loci = NULL)

Value

The input pedigrees with markers attached.

Arguments

x

A ped object or a (possibly nested) list of pedigrees.

alleleMatrix

A matrix with two allele columns per marker and row names identifying individuals. If loci = NULL, columns must have matching names, e.g. M1, M1 or M1.1, M1.2.

loci

Optional list of locus attributes. Each element must contain name and afreq. If alleles is omitted, allele labels are taken from names(afreq). Other possible entries include mutmod, chrom and posMb. Supplied frequencies and mutation models must be valid; no validation is performed here.

Examples

Run this code
x = list(nuclearPed(1), singleton("S"))
a = matrix(c("A", "B", "A", "A"), nrow = 2, byrow = TRUE,
           dimnames = list(c("3", "S"), c("M1.1", "M1.2")))

# Without `loci`: Equal frequencies to observed alleles
y = setMarkersFromMatrix(x, a)
getGenotypes(y)
afreq(y[[1]], 1)

# Supply allele frequencies explicitly
loci = list(list(name = "M1", afreq = c(A = 0.8, B = 0.2)))
z = setMarkersFromMatrix(x, a, loci = loci)
afreq(z[[1]], 1)

Run the code above in your browser using DataLab