combine_loci {clipp} | R Documentation |
Combine the genotype frequencies and transition matrices of two genetic loci
Description
A function to calculate the genotype frequencies and the transition matrices
for the joint genotypes of two unlinked genetic loci in linkage
equilibrium, given the corresponding objects for the separate loci.
The results from this function can be used as inputs to
pedigree_loglikelihood
or
genotype_probabilities
to model the combined effect of the two loci on phenotypes.
Usage
combine_loci(geno_freq1, geno_freq2, trans1, trans2, annotate = FALSE)
Arguments
geno_freq1 |
A vector of strictly positive numbers that sum to |
geno_freq2 |
Similar to |
trans1 |
An |
trans2 |
Similar to |
annotate |
A logical flag. When |
Details
This function combines the genotype frequencies and transition
probabilities of two unlinked genetic loci that are in linkage equilibrium
in a given population. Because
the loci are unlinked, any person's genotypes at the two loci are
conditionally independent given his or her parental genotypes,
and because the loci are in linkage equilibrium, the genotypes at the two
loci for a random person from the population are independent.
This function uses these assumptions to calculate the population frequencies
and transition probabilities for the joint genotypes of the two loci, where a
joint genotype is just a pair consisting of a genotype at locus 1
and a genotype at locus 2. If the annotate
option is set to FALSE
then
these frequencies and probabilities can be used in
pedigree_loglikelihood
to model the combined effect of the two
loci on the phenotypes. By a repeated application of this function, more
than two genetic loci can be included in the genetic model.
Value
A list with the following components:
geno_freq |
A vector of strictly positive numbers (the joint genotype
frequencies) that sum to |
trans |
Either a matrix of genetic transmission probabilities suitable to be
used as the |
genotype_decoder |
A data frame giving the locus 1 and locus 2 genotypes
that correspond to each joint genotype. In some cases, this could aid the user's
calculation of the |
Examples
pa1 <- c(0.9, 0.1); names(pa1) <- c("-","+")
pa2 <- c(0.5, 0.5); names(pa2) <- c("A","a")
(geno_freq1 <- geno_freq_monogenic(pa1, TRUE))
(geno_freq2 <- geno_freq_monogenic(pa2, TRUE))
(trans1 <- trans_monogenic(2, TRUE))
(trans2 <- trans_monogenic(2))
(cl <- combine_loci(geno_freq1, geno_freq2, trans1, trans2, TRUE))
sum(cl$geno_freq)
apply(cl$trans[,-(1:2)], 1, sum)