####=========================================####
####random population of 20 lines with 100 markers
####=========================================####
M <- matrix(rep(0,20*100),20,100)
for (i in 1:20) {
M[i,] <- sample(c(-1,0,0,1), size=100, replace=TRUE)
}
rownames(M) <- 1:nrow(M)
v <- sample(1:nrow(M),10)
M2 <- M[v,]
A <- A.mat(M) # assume this is a pedigree-based matrix for the sake of example
G <- A.mat(M2)
H <- H.mat(A,G)
# colfunc <- colorRampPalette(c("steelblue4","springgreen","yellow"))
# hv <- heatmap(H[1:15,1:15], col = colfunc(100),Colv = "Rowv")
#### Polyploid genomic input; A must be a compatible pedigree matrix
M4 <- 2 * (M + 1)
A4 <- A.mat(M4, ploidy=4) # stand-in only, not a polyploid pedigree
G4 <- A.mat(M4[v,,drop=FALSE], ploidy=4)
H4 <- H.mat(A4, G4)
Run the code above in your browser using DataLab