Functions to calculate relatedness on diploid genetic data