View source: R/oneMarkerDistribution.R
oneMarkerDistribution | R Documentation |
Computes the genotype probability distribution of one or several pedigree members, possibly conditional on known genotypes for the marker.
oneMarkerDistribution(
x,
ids,
marker = 1,
loopBreakers = NULL,
grid.subset = NULL,
partialmarker = NULL,
output = c("array", "table", "sparse"),
verbose = TRUE
)
x |
A |
ids |
A vector of ID labels of one or more members of |
marker |
Either a |
loopBreakers |
(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 |
grid.subset |
(Optional; not relevant for most users.) A numeric matrix
describing a subset of all marker genotype combinations for the |
partialmarker |
(Deprecated) An alias for |
output |
A character string, either |
verbose |
A logical. |
The output format depends on the output
argument:
"array": A named k
-dimensional array, where k = length(ids)
, with the
joint genotype distribution for the ids
individuals, conditional on the
known genotypes if present.
"table": A data frame with k+1
columns, where each row corresponds
to a genotype combination, and the last column prob
gives the
probability.
"sparse": A data frame with the same structure as the "table" output, but only combinations with non-zero probability are included.
twoMarkerDistribution()
# Trivial example: Hardy-Weinberg probabilities for an equifrequent SNP
s = singleton(id = 1) |> addMarker(alleles = 1:2, afreq = c(0.5, 0.5))
oneMarkerDistribution(s, ids = 1)
# Conditioning on a partial genotype
s = setGenotype(s, ids = 1, geno = "1/-")
oneMarkerDistribution(s, ids = 1)
# Genotype distribution for a child of heterozygous parents
trio = nuclearPed(father = "fa", mother = "mo", child = "ch") |>
addMarker(fa = "1/2", mo = "1/2")
oneMarkerDistribution(trio, ids = "ch")
# Joint distribution of the parents, given that the child is heterozygous
trio = addMarker(trio, ch = "1/2")
ids = c("fa", "mo")
oneMarkerDistribution(trio, ids = ids, marker = 2)
# Table output of the previous example
oneMarkerDistribution(trio, ids = ids, marker = 2, output = "table")
oneMarkerDistribution(trio, ids = ids, marker = 2, output = "sparse")
# 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) |>
addMarker("9" = "a/a", afreq = c(a = 0.01, b = 0.99))
oneMarkerDistribution(y, ids = 8)
# Multi-component (trivial) example
z = singletons(1:2) |> addMarker(`1` = "1/2", `2` = "1/2", alleles = 1:2)
oneMarkerDistribution(z, 1:2)
oneMarkerDistribution(z, 1:2, output = "sparse")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.