Please check your answers to the three questions in Lab 3 using the datasets and procedures described below.
Given the map in the maize and cattle datasets (se below), compute absolute positions for all SNP in each map.
Provide the code and graphics to show that your code is performing the intended function
NOTE: If you need, modify the datasets, don’t modify the function.
library(synbreedData)
data(maize)
data(cattle)
head(maize$map)
## chr pos
## M1 1 1.02
## M2 1 4.13
## M3 1 4.73
## M4 1 10.37
## M5 1 11.70
## M6 1 13.97
head(cattle$map)
## chr pos
## SNP_1 1 0.000001
## SNP_2 1 0.202580
## SNP_3 1 0.279809
## SNP_4 1 0.668932
## SNP_5 1 0.763913
## SNP_6 1 0.828652
Given the maize pedigree (see below), use your function to extract pedigree for individual 12604
provide:
1) all available pedigree
2) pedigree up to 2 generations back (parents and grand parents)
Include the code and the result used to answer each point
library(synbreedData)
data(maize)
head(maize$pedigree)
## ID Par1 Par2 gener
## 5 10910 0 0 0
## 3 10918 0 0 0
## 4 10921 0 0 0
## 1 10924 0 0 0
## 9 10936 0 0 0
## 8 10952 0 0 0
Given the cnt dataset and your code to compute mean and variance using a loop free function.
Compare results to those obtained with the loop writen in lecture 2 (below.
Demonstrate that both results are identical.
mean_cnt<-matrix(0,nrow(cnt),24)
var_cnt<-matrix(0,nrow(cnt),24)
for (i in 1:nrow(cnt)) {
vec_count<-matrix(mcnt[i,],4,24,byrow=F)
mean_sample<-colMeans(vec_count)
var_sample<-diag(var(vec_count))
mean_cnt[i,]<-mean_sample
var_cnt[i,]<-var_sample
}