Allele/genotype sharing indices, which count the number of shared alleles in different ways:
l Relatedness estimators, which account for the similarity in allele composition of two individuals by chance (identity by state; IBS) based on reference allele frequencies:
Relatedness estimators, which additionally unbias for sample size effects:
Single locus similarities are either simply averaged over loci for each pairwise comparison ($B_{xy}$, $S_{xy}$, $M_{xy}$), weighted for each locus before averaging ($r_{xy}$, $l_{xy}$, $ritland$, $Li$) or the multilocus estimate is weigthed by the average of weigths for each pairwise comparison over loci ($wang.fin$, $morans.fin$, $loiselle$, $wang$, $morans$).
Bxy(row, data, pop1, pop2, allele.column, ref.pop = NA)
Sxy(row, data, pop1, pop2, allele.column, ref.pop = NA)
Mxy(row, data, pop1, pop2, allele.column, ref.pop = NA)
rxy(row, data, pop1, pop2, allele.column, ref.pop = NA)
Li(row, data, pop1, pop2, allele.column, ref.pop = NA)
ritland(row, data, pop1, pop2, allele.column, ref.pop = NA)
lxy(row, data, pop1, pop2, allele.column, ref.pop = NA)
lxy.w(row, data, pop1, pop2, allele.column, ref.pop = NA)
loiselle(row, data, pop1, pop2, allele.column, ref.pop = NA)
wang(row, data, pop1, pop2, allele.column, ref.pop = NA)
wang.fin.w(allele.column, ref.pop = NA)
wang.w(allele.column, ref.pop = NA)
wang.compose(Ps, as)
morans.fin(row, data, pop1, pop2, allele.column, ref.pop = NA)
morans.w(pop1, pop2, allele.column, ref.pop = NA)
data
used for calculations$S_{xy}$ The similarity is calculated based on the average number of allele positions, which share the same allele in both individuals. If there are at least three alleles in the locus - A, B and C, two diploid individuals may have four different states of similarity. If all alleles are the same in individuals - Sxy=1. If both individuals are heterozygous and both alleles are present in both individuals (AB vs AB) Sxy=1. If one individual is homozygous for a shared allele (eg. AA vs AB) Sxy=0.75. If only one allele is the same in both individuals (AB vs AC) Sxy=0.5 and if no allele is shared Sxy=0 (Lynch 1988).
$M_{xy}$ Sharing rate is calculated according to shared allele positions i.e. 0, 1 or 2 shared allele positions for diploids. A sharing rate of 0 is calculated if no alleles are shared, a rate of 0.5 if only one allele position is equal in individuals (AC vs AB or AA vs AB) and a rate of 1 if individuals match in both allele positions (AA vs AA or AB vs AB) (Blouin et al. 1996).
$r_{xy}$ The estimator $r_{xy}$ based on Queller and Goodnight 1989 adapted to pairwise comparisons as described in Oliehoek et al. 2006 is calculated as follows:
$r_{xy,l} = \frac{0.5(I_{ac}+I_{ad}+I_{bc}+I_{bd})-p_{a}-p_{b}}{1+I_{ab}-p_{a}-p_{b}}$ |
$I_{a-d} = $ allele identities of individual I in locus l |
$p_{a-b} = $ frequencies of allele a or b in reference populations |
$l_{xy}$ In Lynch and Ritland 1999 $l_{xy}$ is referred to as $r_{xy}$ arcoding to equation (5a). For multilocus estimates weights over loci are calculated according to equation (6a and 7a) (Lynch and Ritland 1999).
$l_{xy,l} = \frac{p_{a}*(S_{bc}+S_{bd})+p_{b}*(S_{ac}+S_{ad})-4p_{a}p_{b}}{(1+S_{ab})*(p_{a}+p_{b})-4p_{a}p_{b}}$ |
$w_{xy,l} = \frac{(1+S_{ab})*(p_{a}+p_{b})-4p_{a}p_{b}}{2p_{a}p_{b}}$ |
$S_{a-d} = $ allele identities of individual S in locus l |
$p_{a-b} = $ frequencies of allele a or b in reference populations |
rxy
. The final pairwise estimate is divided by the sum of weights for loci $W_{xy}$, which is averaged analogous to RE-RAT procedure of the pairwise relatedness estimate. $Li$ The estimator is calculated according to Li et al. 1993 equation 9 corrected for the average similarity for unrelated individuals based on reference allele frequencies as $U=2a_{2}+a_{3}$. The inital similarity $S_{xy}$ is calculated based on Lynch 1988.
$Li_{xy,l} = \frac{S-U}{1-U}$ |
$ritland$ Ritlands original estimator from Ritland 1996 (equation 5) is calculated according to Lynch and Ritland 1999 by multiplying the final estimate with 2. As the sum of all p is equal to 1 the equation is simplyfied to:
$ritland_{xy,l} = \frac{2}{n-1}[(\sum\frac{S_{i}}{p_{i}})-1]$ |
The single locus estimate is averaged over loci. The basic similarity is calculated for allele i as 0.25 if i is present in both individuals, 0.5 if i is present in both and one individual is homozogious for i and 1 if both individuals are homozygous for i. Note that this similarity measure is equivalent to Blouin's approach $M_{xy}$ (Blouin et al. 1996) if summed over all alleles for each pairwise comparison.
$loiselle$ The estimator first described in Loiselle et al. 1995 is implemented as described by Hardy and Vekemans 2015. The frequency of each allele in individuals (i.e. 0.5 or 1 for diploids) in a pairwise comparison are combined and corrected for the allele frequency in the reference population. The product of corrected shared allele frequencies is additionally corrected for sample size bias and combined over loci via weighting with the polymorphic index ($\sum{p_{i}} * (1 - p_{i})$).
$loiselle_{xy,l} = \sum{ \frac{ \sum{(p_{ila}-p{la})*(p_{jla}-p_{la})} +\sum{(p_{la}*(1-p_{la}))} } {n_{l}-1}}/ \sum{\sum{p_{la}*(1-p_{la})}} $ |
$wang$ Equations described by Wang 2002 are implemented as follows:
A binary vector $P$ of classes of observed similarities is calculated for each pairwise comparison. One of the 4 categories is set as 1, all remaining P are set as 0. $P_{1}$ is 1 if both animals are homozygous for the same allele or both are heterozygous with the same allele combination. $P_{2}$ is 1 if one individual is homozygous and the other is heterozygous sharing only 1 allele. $P_{3}$ is 1 if only 1 allele is shared between individuals with 1 copy per individual. All other comibnations fall into the category four $P_{4}$. Note that the categories follow the general classification as described for $S_{xy}$ described by Lynch 1988.
The estimator descirbed by Wang 2002 is relatively complex and can be discussed only superficial here. The probability of each category i.e. the joint probability of genotypes can be estimated using the two-gene ($\Theta$) and four-gene ($\Delta$) coefficient based on the sum of powers of allele frequencies ($a_{m}=\sum{p_{i}^{m}}$) summing up each probability of each category of $P$. Formulas used for calculations can be found in Wang 2002 Equation (9), (10) and (10). Combining these estimates into r=$\frac{\Theta}{2}+\Delta$ yields the estimate by Wang (2002). By using the estimator wang
each expected sum of powers of allele frequency is corrected for sample size N ($\bar{a}_{2}$, $\bar{a}_{3}$, $\bar{a}_{4}$) compare eqation (12), (13) and (14) in Wang 2002.
Finally, to get an multilocus estimate each single locus estimate is corrected for the average similarity value for unrelated individuals $u=2a_{2}+a_{3}$ as described in Li et al. 1993. Each single term of the estimate $\Theta$ and $\Delta$, namely $b-g$ and each $P$ are unbiased by $u$ and the combined estimate is weigthed with the sum of $u$ over loci.
$wang.fin$
This estimate is based on the same equations as wang
. However, for the use of finite samples the bias correction of sample size (N) is omitted. Instead of $\bar{a}_{2}$, $\bar{a}_{3}$, $\bar{a}_{4}$ ((12), (13), and (14) in Wang 2002) the pure sum of powers of allele frequencies ($a_{m}=\sum{p_{i}^{m}}$) are used.
$morans$ The estimator morans refers to morans I, which is widely used as estimator for spatial autocorrela- tion. It is described in Hardy and Vekemans 1999 as estimator for genetic relatedness. The approach is similar to loiselle (Loiselle et al. 1995) or $r_{xy}$ (Queller and Goodnight 1989) by correcting each individual allele frequency by the allele frequency of the reference sample for each shared allele of each pairwise comparison. Each shared allele is then weighted by the variance of individual allele frequencies and a term for sample size bias. In order to calculate the estimator over loci the sum of pairwise estimates over loci is weighted by the sum of weights over loci for each comparison.
$morans_{xy,l} = \frac{ \sum{ (p_{ila}-p_{la})*(p_{jla}-p_{la}) } } {\sum{Var(p_{ila}+1/(n_{l}-1))}} $ |
$morans.fin$ The estimator morans.fin refers to the same calculations as morans but omitting weights for sample size bias. Thus it should only be applied for finite samples (Hardy and Vekemans 1999).
allele.sharing
Demerelate
Emp.calc
## internal function not intended for direct use
Run the code above in your browser using DataLab