# Data

Load mice SNP data available in the BGLR R package.

library(BGLR)
data(mice)
?mice

## Question 1.1

Compute the pairwise relatedness of Ritland (1996) between the first three individuals (i.e.., ID1-ID2, ID1-ID3, and ID2-ID3) based on the first five SNPs in mice.X. Hint: compute a locus specific relaitonship and then average them over loci.

X35 <- mice.X[1:3, 1:5]
n <- nrow(X35)
m <- ncol(X35)
G35 <- matrix(NA, ncol=n, nrow=n)

## Question 1.2

Read Pew et al. (2015) paper and download the related R package from here. Verify your results from Question 1.1 using the conancestry() function with the ritland=1 argument. Note that you have to recode your genotype matrix in order to use this function.

library(related)
## Loading required package: tools
## Loading required package: ggplot2

## Question 1.3

Write a function that returns the total allelic (TA) relationship of Nejati-Javaremi et al. (1997). Apply your function to the first three individuals and the first five SNPs in mice.X.

## Question 1.4

Compute the first genomic relationship matrix of VanRaden (2008) using the entire markers. Report the median of the lower triangular part of G matrix.

## Question 1.5

Compute the second genomic relationship matrix of VanRaden (2008) using the entire markers. Report the median of the lower triangular part of G matrix. What is the correlation of lower triangular parts of two VanRaden’s (2008) G matrices?

## Question 1.6

Compute the dominant genomic relationship matrix of Su et al. (2012) using the entire markers. Report the median of the lower triangular part of D matrix.

## Question 1.7

Compute the dominant genomic relationship matrix of Vitezica et al. (2013) using the entire markers. Report the median of the lower triangular part of D matrix. What is the correlation of lower triangular parts of two D matrices?