R package related
# Pew et al. (2015) related: an R package for analysing pairwise relatedness from codominant molecular markers. Molecular Ecology Resources.
# https://frasierlab.wordpress.com/software/
library(related)
## Loading required package: tools
## Loading required package: ggplot2
## single locus - Ritland (1996)
mydat <- data.frame(ID=as.character(c("1", "2", "3")), SNP1a= c(1, 2, 1), SNP1b=c(1, 1, 1))
mydat[,1] <- as.character(mydat[,1])
mydat
## ID SNP1a SNP1b
## 1 1 1 1
## 2 2 2 1
## 3 3 1 1
output <- coancestry(mydat , ritland=1)
## user system elapsed
## 0.001 0.001 0.003
##
## Reading output files into data.frames... Done!
output$relatedness
## pair.no ind1.id ind2.id group trioml wang lynchli lynchrd ritland
## 1 1 1 2 1 2 0 0 0 0 -0.8
## 2 2 1 3 1 3 0 0 0 0 0.4
## 3 3 2 3 2 3 0 0 0 0 -0.8
## quellergt dyadml
## 1 -2 0
## 2 1 0
## 3 -2 0
## two loci - Ritland (1996)
mydat <- data.frame(ID=as.character(c("1", "2", "3")), SNP1a= c(1, 2, 1), SNP1b=c(1, 1, 1), SNP2a=c(1,1,1), SNP2b=c(1,2,2))
mydat[,1] <- as.character(mydat[,1])
mydat
## ID SNP1a SNP1b SNP2a SNP2b
## 1 1 1 1 1 1
## 2 2 2 1 1 2
## 3 3 1 1 1 2
output <- coancestry(mydat , ritland=1)
## user system elapsed
## 0.001 0.001 0.002
##
## Reading output files into data.frames... Done!
output$relatedness
## pair.no ind1.id ind2.id group trioml wang lynchli lynchrd ritland
## 1 1 1 2 1 2 0 0 0 0 -0.650
## 2 2 1 3 1 3 0 0 0 0 -0.050
## 3 3 2 3 2 3 0 0 0 0 -0.275
## quellergt dyadml
## 1 -1.00 0
## 2 0.25 0
## 3 -2.00 0