Recursive Method to Generate Partial Kinship and Inbreeding Coefficients Across Founders
This section describes how to calculate a partial kinship matrix and partial inbreeding coefficient with respect to a given
founder individual and was initially described in the Lacy et al. (1996) paper. A supplemental manuscript that provides an example is
Gulisija & Crow (2007). A partial kinship matrix traces only alleles descending from a specific founder individual. A founder individual
is an individual with both parents unknown and is therefore considered unrelated to all other individuals in a pedigree other than their
descendants. Similarly, a partial inbreeding coefficient measures the probability that an individual is homozygous (identical by descent)
for an allele descended from a given founder. To compute partial inbreeding coefficients, a distinct partial kinship matrix is built for
each founder. The sum of partial kinship matrices corresponding to all founder individuals yields a matrix of kinship coefficients between
individuals. As mentioned in the previous section, Recursive Method to Create A, the
numerator relationship matrix is twice the co-ancestry or kinship coefficient and is a great way to confirm the calculation is correct.
Lacy_1996 <- function(animal,sire,dam,founders,kinship =FALSE)
{
Founders <- length(founders) # Number of Founders #
PartialInbreedingF <- vector("list", Founders+1) # Stores Partial Kinships #
## Loop Through Founders
for(f in 1:Founders)
{
## Step 1 - Set up founder square block
PartialKinship <- matrix(data=NA,ncol=length(animal),nrow=length(animal),byrow=T)
PartialKinship[1:(Founders),1:(Founders)] <- 0
PartialKinship[f,f] <- 0.5
## loop through non-founders
for(i in (Founders+1):ncol(PartialKinship))
{
if (sire[i] != 0 & dam[i] != 0) # Both parents known #
{
for(j in 1:(i-1))
{
PartialKinship[j,i] = 0.5*(PartialKinship[sire[i],j]+PartialKinship[dam[i],j])
PartialKinship[i,j] = PartialKinship[j,i];
}
PartialKinship[i,i] = PartialKinship[i,f] + (0.5*PartialKinship[sire[i],dam[i]])
}
if(sire[i] == 0 & dam[i] != 0) # Only Dam is known #
{
for(j in 1:(i-1))
{
PartialKinship[j,i] = PartialKinship[i,j] = 0.5 * (PartialKinship[j,dam[i]])
}
PartialKinship[i,i] = PartialKinship[i,f]*2
}
if(sire[i] != 0 & dam[i] == 0) # Only Sire is known #
{
for(j in 1:(i-1))
{
PartialKinship[j,i] = PartialKinship[i,j] = 0.5 * (PartialKinship[j,sire[i]])
}
PartialKinship[i,i] = PartialKinship[i,f]*2
}
}
PartialInbreedingF[[f]] <- PartialKinship
}
## Now calculate partial inbreeding coefficient of an ##
## individual with respect to a given founder ##
sizef = length(c((Founders+1):length(animal)))
PartF <- cbind(c(animal[(Founders+1):length(animal)]),matrix(data=0,ncol=Founders,nrow=sizef))
for(i in 1:sizef) # Loop across non-founder individuals #
{
for(f in 1:(Founders)) # Loop across founders #
{
if (sire[(Founders+i)] != 0 & dam[(Founders+i)] != 0)
{
# Partial Inbreeding Coefficient with respect to founder #
# j of a descendant i (with parents m and p) is given by Fi(j) = f_mp. #
PartF[i,c(f+1)] <- PartialInbreedingF[[f]][sire[Founders+i],dam[Founders+i]]
}
}
}
# if want partial kinships but partial F in list #
PartialInbreedingF[[Founders+1]] <- PartF;
# if don't want partial kinships just output partial F #
if(kinship == TRUE){return(PartialInbreedingF)}
if(kinship == FALSE){return(PartF)}
}
The following pedigree file
from Gulisija & Crow (2007) can be utilized with the R code above. The columns are animal, sire and dam and the pedigree is already
ordered so that parents come before progeny. Lastly the animals go from 1 to the total number of animals. Outlined below is what the
partial kinship matrix for founder 1 looks like at the end of each iteration of the for loop. The last iteration will provide the
partial inbreeding values across all non-founder individuals.
- Lacy R. C., G. Alaks and A. Walsh. 1996. Hierarchical Analysis of Inbreeding Depression in Peromyscus polionotus. Evolution 50(6), 2187-2200.
- Gulisija D. and J. F. Crow. 2007. Inferring purging from pedigree data. Evolution, 61(5), 1043-1051.