Calculate Likelihoods for Alternative Relationships
For each specified pair of individuals, calculate the log10-likelihoods of being PO, FS, HS, GP, FA, HA, U (see Details). Individuals must be genotyped or have at least one genotyped offspring.
NOTE values >0 are various NA
types, see 'Likelihood
special codes' in 'Value' section below.
CalcPairLL( Pairs = NULL, GenoM = NULL, Pedigree = NULL, LifeHistData = NULL, AgePrior = TRUE, SeqList = NULL, Complex = "full", Herm = "no", Err = 1e-04, ErrFlavour = "version2.0", Tassign = 0.5, Tfilter = -2, quiet = FALSE, Plot = TRUE )
Pairs |
dataframe with columns
|
GenoM |
numeric matrix with genotype data: One row per individual, and
one column per SNP, coded as 0, 1, 2 or -9 (missing). See also
|
Pedigree |
dataframe with columns id-dam-sire; likelihoods will be calculated conditional on the pedigree. May include non-genotyped individuals, which will be treated as dummy individuals. |
LifeHistData |
dataframe with 3 columns (optionally 5):
If the species has multiple generations per year, use an integer coding such that the candidate parents' ‘Birth year’ is at least one smaller than their putative offspring's. Column names are ignored, so ensure column order is ID - sex - birth year (- BY.min - BY.max). Individuals do not need to be in the same order as in ‘GenoM’, nor do all genotyped individuals need to be included. |
AgePrior |
logical ( |
SeqList |
list with output from |
Complex |
Breeding system complexity. Either "full" (default), "simp" (simplified, no explicit consideration of inbred relationships), "mono" (monogamous). |
Herm |
Hermaphrodites, either "no", "A" (distinguish between dam and sire role, default if at least 1 individual with sex=4), or "B" (no distinction between dam and sire role). Both of the latter deal with selfing. |
Err |
estimated genotyping error rate, as a single number or 3x3 matrix. Details below. The error rate is presumed constant across SNPs, and missingness is presumed random with respect to actual genotype. |
ErrFlavour |
function that takes |
Tassign |
minimum LLR required for acceptance of proposed relationship, relative to next most likely relationship. Higher values result in more conservative assignments. Must be zero or positive. |
Tfilter |
threshold log10-likelihood ratio (LLR) between a proposed relationship versus unrelated, to select candidate relatives. Typically a negative value, related to the fact that unconditional likelihoods are calculated during the filtering steps. More negative values may decrease non-assignment, but will increase computational time. |
quiet |
logical, suppress messages |
Plot |
logical, display scatter plots by |
The same pair may be included multiple times, e.g. with different sex, age difference, or focal relationship, to explore their effect on the likelihoods. Likelihoods are only calculated for relationships that are possible given the age difference, e.g. PO (parent-offspring) is not calculated for pairs with an age difference of 0.
Non-genotyped individuals can be included if they have at least one
genotyped offspring and can be turned into a dummy (see
getAssignCat
); to establish this a pedigree must be provided.
Warning 1: There is no check whether the input pedigree is genetically
sensible, it is simply conditioned upon. Checking whether a pedigree is
compatible with the SNP data can be done with CalcOHLLR
.
Warning 2: Conditioning on a Pedigree
can make computation
orders of magnitude slower.
The Pairs
dataframe including all optional columns listed
above, plus the additional columns:
LL_xx |
Log10-Likelihood of this pair having relationship xx, with xx being one of PO, FS, etc. as detailed below. |
TopRel |
Abbreviation of most likely relationship |
LLR |
Likelihood ratio between most-likely and second most likely relationships |
Relationship abbreviations:
PO |
Parent - offspring |
FS |
Full siblings |
HS |
Half siblings |
GP |
Grandparent |
FA |
Full avuncular |
HA |
Half avuncular and other 3rd degree relationships |
U |
Unrelated |
2nd |
Unclear which type of 2nd degree relatives (HS, GP, or FA) |
?? |
Unclear which type of 1st, 2nd or 3rd degree relatives |
Likelihood special codes:
222 |
Maybe (via) other parent (e.g. focal="GP", but as likely to be maternal as paternal grandparent, and therefore not assignable) |
333 |
Excluded from comparison (shouldn't occur) |
444 |
Not implemented (e.g. would create an odd double/triple relationship in combination with the provided pedigree) |
777 |
Impossible (e.g. cannot be both full sibling and grandparent) |
888 |
Already assigned in the provided pedigree (see |
999 |
NA |
Especially when Complex='full', not only the seven relationship alternatives listed above are considered, but a whole range of possible double and even triple relationships. For example, mother A and offspring B (PO) may also be paternal half-siblings (HS, A and A's mother mated with same male), grandmother and grand-offspring (GP, B's father is A's son), or paternal aunt (B's father is a full or half sib of A).
The likelihood reported as 'LL_PO' is the most-likely one of the possible alternatives, among those that are not impossible due to age differences or due to the pedigree (as reconstructed up to that point). Whether e.g. the likelihood to be both PO & HS is counted as PO or as HS, depends on the situation and is determined by the variable 'focal': During parentage assignment, it is counted as PO but not HS, while during sibship clustering, it is counted as HS but not PO – not omitting from the alternative relationship would result in a deadlock.
PlotPairLL
to plot alternative relationship pairs from
the output; CalcOHLLR
to calculate LLR for parents &
parent-pairs in a pedigree; GetRelM
to find all pairwise
relatives according to the pedigree; GetMaybeRel
to get
likely relative pairs not in the pedigree.
# likelihoods underlying parent LLR in pedigree: data(LH_HSg5, SimGeno_example) Seq.HSg5 <- sequoia(SimGeno_example, LH_HSg5, Module="par") tail(Seq.HSg5$PedigreePar) # take bottom 3 individuals: Pairs <- data.frame(ID1 = c("a01190", "b01191", "a01192"), ID2 = rep(c("a00012", "b00007"), each=3), AgeDif = 1, focal = "PO") # LLRdam & LLRsire: CalcPairLL(Pairs, SimGeno_example) # LLRpair is min. of dam & sire LLR, conditional on co-parent: CalcPairLL(cbind(Pairs, dropPar1=rep(c("dam", "sire"), each=3)), SimGeno_example, SeqList = Seq.HSg5) # likelihoods underlying LLR in getMaybeRel output: data(Ped_griffin, SeqOUT_griffin, package="sequoia") Geno.griffin <- SimGeno(Ped_griffin, nSnp=200, SnpError = 0.01, ParMis=0.4) MR <- GetMaybeRel(GenoM = Geno.griffin, LifeHistData = SeqOUT_griffin$LifeHist, Module = "par", Err = 0.001) FivePairs <- MR$MaybePar[1:5, c("ID1", "ID2", "Sex1", "Sex2")] FivePairs$AgeDif <- NA # pretend unknown age differences PairLL <- CalcPairLL(Pairs = rbind( cbind(FivePairs, focal = "PO"), cbind(FivePairs, focal = "HS"), cbind(FivePairs, focal = "GP")), GenoM = Geno.griffin, Err = 0.005, Plot=FALSE) PairLL[c(1, 6, 11), ] # LL(FS)==222 : HSHA, HSGP, FAHA more likely than FS # LL(GP) higher when focal=HS: GP via 'other' parent also considered # LL(FA) higher when focal=PO: FAHA, or FS of 'other' parent
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.