oneMarkerDistribution: Genotype distribution for a single marker

Description Usage Arguments Value Author(s) See Also Examples

View source: R/oneMarkerDistribution.R

Description

Computes the genotype probability distribution of one or several pedigree members, possibly conditional on known genotypes for the marker.

Usage

1
2
3
4
5
6
7
8
9
oneMarkerDistribution(
  x,
  ids,
  partialmarker,
  loop_breakers = NULL,
  eliminate = 0,
  grid.subset = NULL,
  verbose = TRUE
)

Arguments

x

A ped object.

ids

A numeric with ID labels of one or more pedigree members.

partialmarker

Either a marker object or the name (or index) of a marker attached to x.

loop_breakers

(Only relevant if the pedigree has loops). A vector with ID labels of individuals to be used as loop breakers. If NULL (default) loop breakers are selected automatically. See breakLoops().

eliminate

A non-negative integer, indicating the number of iterations in the internal genotype-compatibility algorithm. Positive values can save time if partialmarker has many alleles.

grid.subset

(Optional; not relevant for most users.) A numeric matrix describing a subset of all marker genotype combinations for the ids individuals. The matrix should have one column for each of the ids individuals, and one row for each combination: The genotypes are described in terms of the matrix M = allGenotypes(n), where n is the number of alleles for the marker. If the entry in column j is the integer k, this means that the genotype of individual ids[j] is row k of M.

verbose

A logical.

Value

A named k-dimensional array, where k = length(ids), with the joint genotype distribution for the ids individuals. The probabilities are conditional on the known genotypes and the allele frequencies of partialmarker.

Author(s)

Magnus Dehli Vigeland

See Also

twoMarkerDistribution()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Trivial example giving Hardy-Weinberg probabilities
s = singleton(id = 1)
m = marker(s, alleles = 1:2) # equifrequent SNP
oneMarkerDistribution(s, ids = 1, partialmarker = m)

# Conditioning on a partial genotype
genotype(m, id = 1) = c(1, NA)
oneMarkerDistribution(s, ids = 1, partialmarker = m)

# Genotype distribution for a child of heterozygous parents
trio = nuclearPed(father = "fa", mother = "mo", child = "ch")
m1 = marker(trio, fa = 1:2, mo = 1:2)
oneMarkerDistribution(trio, ids = "ch", partialmarker = m1)

# Joint distribution of the parents, given that the child is heterozygous
m2 = marker(trio, ch = 1:2, alleles = 1:2, afreq = c(0.5, 0.5))
oneMarkerDistribution(trio, ids = c("fa", "mo"), partialmarker = m2)

# A different example: The genotype distribution of an individual (id = 8)
# whose half cousin (id = 9) is homozygous for a rare allele.
y = halfCousinPed(degree = 1)
snp = marker(y, `9` = "a", alleles = c("a", "b"), afreq = c(0.01, 0.99))
plot(y, snp)
oneMarkerDistribution(y, ids = 8, partialmarker = snp)

pedprobr documentation built on Nov. 13, 2020, 5:06 p.m.