genotype_probabilities {clipp} | R Documentation |
Calculate genotype probabilities for a target person
Description
For a chosen individual within a specified family, calculate the person's conditional genotype probabilities, given the family's phenotypes and relationship structure
Usage
genotype_probabilities(target, fam, geno_freq, trans, penet, monozyg = NULL)
Arguments
target |
The individual identifier (an element of |
fam |
A data frame specifying the family's relationship structure,
with rows corresponding to people and columns
corresponding to the following variables (other variables can be included
but will be ignored), which will be coerced to
|
geno_freq |
A vector of strictly positive numbers that sum to |
trans |
An |
penet |
An |
monozyg |
An optional list that can be used to specify genetically
identical persons, such as monozygotic twins, monozygotic triplets,
a monozygotic pair within a set of dizygotic triplets, etc.
Each element of the list should be a vector containing the individual
identifiers of a group of genetically identical persons, e.g. if |
Details
The genotype probabilities are calculated by essentially the same algorithm
as pedigree_loglikelihood
;
see there for details. The genotype probabilities only depend on the
connected component of the pedigree that contains target
, so the
function first restricts fam
and penet
to the rows corresponding to this
connected component. For example, if fam
is the union of two
unrelated families then this function will restrict to the subfamily
containing target
before performing the calculation.
Value
A vector of length length(geno_freq)
, whose j
th element is
the conditional probability that the target person has genotype j
,
given the family's relationship structure and phenotypes. A vector of NA
s
will be returned if a row of penet
consists entirely of zeroes or if
the pedigree is impossible for any other reason
(after restricting fam
and penet
to the connected component of
the pedigree containing target
).
Examples
# Read in some sample data
data("dat_small", "penet_small")
str(dat_small)
str(penet_small)
# Calculate the genotype probabilities for individual "ora008" in the family "ora"
w <- which(dat_small$family == "ora")
fam <- dat_small[w, -1]
penet <- penet_small[w, ]
monozyg <- list(c("ora024", "ora027")) # ora024 and ora027 are identical twins
trans <- trans_monogenic(2)
geno_freq <- geno_freq_monogenic(p_alleles = c(0.9, 0.1))
genotype_probabilities(target = "ora008", fam, geno_freq, trans, penet, monozyg)