# NOT RUN {
####=========================================####
#### For CRAN time limitations most lines in the
#### examples are silenced with one '#' mark,
#### remove them and run the examples using
#### command + shift + C |OR| control + shift + C
####=========================================####
data(PolyData)
genotypes <- PolyData$PGeno
phenotypes <- PolyData$PPheno
# ####=========================================####
# ####### convert markers to numeric format
# ####=========================================####
# numo <- atcg1234(data=genotypes, ploidy=4); numo[1:5,1:5]; dim(numo)
#
# ###=========================================####
# ###### plants with both genotypes and phenotypes
# ###=========================================####
# common <- intersect(phenotypes$Name,rownames(numo))
#
# ###=========================================####
# ### get the markers and phenotypes for such inds
# ###=========================================####
# marks <- numo[common,]; marks[1:5,1:5]
# phenotypes2 <- phenotypes[match(common,phenotypes$Name),];
# phenotypes2[1:5,1:5]
#
# ###=========================================####
# ### response variable
# ###=========================================####
# yy.trn <- phenotypes2
# set.seed(1234)
# ww <- sample(1:187,38)
# yy.trn[ww,"tuber_shape"] <- NA
#
# ###=========================================####
# ###### Additive relationship matrix, specify ploidy
# ###=========================================####
# A <- A.mat(marks, ploidy=4); dim(K1);K1[1:5,1:5]
# D <- D.mat(marks, ploidy=4)
# E <- E.mat(marks, ploidy=4)
# ###=========================================####
# ### run the genomic selection model
# ###=========================================####
# ans <- mmer2(tuber_shape~1, random=~g(Name),
# G=list(Name=A), data=yy.trn)
# cor(phenotypes2[ww,"tuber_shape"],ans$fitted.y[ww])
# summary(ans)
#
# ###=========================================####
# ### run it as GWAS model
# ###=========================================####
# my.map <- PolyData$map
# models <- c("additive","1-dom-alt","1-dom-ref","2-dom-alt","2-dom-ref")
# ans2 <- mmer2(tuber_shape~1, random=~g(Name), models = "additive",
# G=list(Name=A), W=marks, data=phenotypes2)
# summary(ans2)
#
# ###=========================================####
# ### compare to GWAS including dominance
# ###=========================================####
# phenotypes2$Named <- phenotypes2$Name
# ans3 <- mmer2(tuber_shape~1, random=~g(Name) + g(Named), models = "additive",
# G=list(Name=A, Named=D), W=marks, data=phenotypes2)
# summary(ans3)
# }
Run the code above in your browser using DataLab