trans_monogenic {clipp} | R Documentation |
The transmission matrix for a single genetic locus
Description
A function to calculate the transmission matrix for a single autosomal genetic locus with an arbitrary number of alleles and unphased genotypes, based on Mendel's laws of inheritance.
Usage
trans_monogenic(n_alleles, annotate = FALSE)
Arguments
n_alleles |
A positive integer, interpreted as the number of possible alleles at the genetic locus. |
annotate |
A logical flag. When |
Details
When annotate
is FALSE
, this function returns a matrix of
genetic transmission probabilities, whose rows corresponding to the possible
joint parental genotypes and whose columns corresponding to the possible
offspring genotypes. There are ngeno = n_alleles * (n_alleles + 1) / 2
possible
unphased genotypes, and by choosing an order on these genotypes (which can be
viewed by setting annotate
to TRUE
, see below)
we can label the set of possible genotypes as 1:ngeno
.
Then the (ngeno * gm + gf - ngeno, go)
th element of the outputted matrix is
the conditional probability that a person has genotype go
, given that his
or her biological mother and father have genotypes gm
and gf
,
respectively.
When annotate
is TRUE
, the function converts this matrix to a data frame,
adds column names giving the offspring genotype corresponding to each
column, and adds columns gm
and gf
describing the parental genotypes
corresponding to each row. In this data frame, genotypes are written
in the usual form 1/1, 1/2, ...
for the alleles 1:n_alleles
.
Note that if the output of this function is to be used as the trans
argument of pedigree_loglikelihood
then the annotate
option
must be set to FALSE
.
Value
Either a matrix of genetic transmission probabilities suitable to be
used as the trans
argument of pedigree_loglikelihood
(if annotate
is FALSE
), or a data frame that is an annotated version of
this matrix (if annotate
is TRUE
).
Examples
# The transition matrix for a biallelic, autosomal locus with unphased genotypes
trans_monogenic(2)
trans_monogenic(2, annotate = TRUE)