# build a simulation of a standard breeding programme for honey bees,
# then setting up evaluation of genomic prediction within and
# across the multiple breeding programmes.
# Later, we will add the complexity of multiple honey bee subspecies.
library(AlphaSimR)
## Loading required package: R6
library(SIMplyBee)
##
## Attaching package: 'SIMplyBee'
## The following object is masked from 'package:base':
##
## split
library(ggplot2)
load("/Users/mulusewfikere/founderGenomes.RData")
# Estimation of GEBV, Queen selection, quantifying direct and indirect effects
# Assessing Genomic prediction scenarios and performance test
# Step 3 ------------
# Discription of pre-given parameters
# Number of chromosome(nChr),
# Number of segregation sites (nSegSite),
# Number of worker (nWorker),
# Number of drones (nDrones),
# Number of virgin queens (nVirginQueens) in a full-size colony,
# Number of drones that a queen mates with (nFathers),
# The complementary sex determination (CSD) locus:
# The chromosome (csdChr),
# The physical position on the chromosome (csdPos),
# The number of alleles (nCsdAlleles).
# I ran this section on the HPC cluster and saved the file as *.RData
# founderGenomes <- simulateHoneyBeeGenomes(nMelN = 400,>
# nChr = 16,
# nSegSites = 10000)
# save(founderGenomes, file="founderGenomes.RData")
# Check parameters
founderGenomes@nInd
## [1] 400
founderGenomes@nLoci
## [1] 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000
## [13] 10000 10000 10000 10000
founderGenomes@nChr
## [1] 16
SP <- SimParamBee$new(founderGenomes,
nWorkers = 100,
nDrones = 10,
csdChr = 3,
nCsdAlleles = 100)
nQtlPerChr <- 1000
mean <- c(10, 10 / SP$nWorkers)
varA <- c(1, 1 / SP$nWorkers)
corA <- matrix(data = c( 1.0, -0.5,
-0.5, 1.0),
nrow = 2, byrow = TRUE)
# Add the traits to SimParamBee
SP$addTraitA(nQtlPerChr = nQtlPerChr,
mean = mean, var = varA, corA = corA,
name = c("queenTrait", "workersTrait"))
# Environmental effect parameters
varE <- c(3, 3 / SP$nWorkers)
corE <- matrix(data = c(1.0, 0.3,
0.3, 1.0),
nrow = 2, byrow = TRUE)
SP$setVarE(varE = varE, corE = corE)
basePop <- createVirginQueens(founderGenomes, n = 20)
# Create an apiary, cross it, and build it up
DCA <- createDrones(x = basePop[1:5], nInd = 100)
droneGroups <- pullDroneGroupsFromDCA(DCA, n = 3, nDrones = 15)
apiary <- createMultiColony(x = basePop[6:8])
apiary <- cross(x = apiary, drones = droneGroups)
apiary <- buildUp(x = apiary)
# Step 9.1. --------------
## Compare the pooled worker to the queen's genotype
genoQ <- getSegSiteGeno(apiary@colonies[[1]], caste = "queen")
genoW <- getSegSiteGeno(apiary@colonies[[1]], caste = "workers")
sexW <- getCasteSex(apiary@colonies[[1]], caste = "workers")
poolW <- getPooledGeno(x = genoW, type = "mean", sex = sexW)
plot(y = poolW, x = jitter(genoQ), ylim = c(0, 2), xlim = c(0, 2),
ylab = "Average allele dosage in workers",
xlab = "Allele dosage in the queen")
head(getWorkersGv(apiary[[1]]))
## queenTrait workersTrait
## 901 10.40382 0.17837681
## 902 10.64641 0.06702058
## 903 10.11944 0.15122706
## 904 10.17310 0.10542585
## 905 10.23181 0.24706901
## 906 10.32134 0.15383074
head(getWorkersPheno(apiary[[1]]))
## queenTrait workersTrait
## 901 9.582725 0.04919258
## 902 10.392553 -0.03271334
## 903 13.060422 0.26439056
## 904 10.199977 0.22330373
## 905 9.217614 0.23048526
## 906 11.093265 0.29199516
## Genetic value
par(mfrow=c(3,2))
hist(gvAllTraitCol1$queenTraitCol1, xlab = "gvQueenTraitCol1", main = "")
hist(gvAllTraitCol2$queenTraitCol2, xlab = "gvQueenTraitCol2", main = "")
hist(gvAllTraitCol3$queenTraitCol3, xlab = "gvQueenTraitCol3", main = "")
hist(gvAllTraitCol1$workersTraitCol1, xlab = "gvWorkersTraitCol1", main = "")
hist(gvAllTraitCol2$workersTraitCol2, xlab = "gvWorkersTraitCol2", main = "")
hist(gvAllTraitCol3$workersTraitCol3, xlab = "gvWorkersTraitCol3", main = "")
## Phenotypic value
par(mfrow=c(3,2))
hist(pvAllTraitCol1$queenTraitCol1, xlab = "pvQueenTraitCol1", main = "")
hist(gvAllTraitCol2$queenTraitCol2, xlab = "pvQueenTraitCol2", main = "")
hist(gvAllTraitCol3$queenTraitCol3, xlab = "pvQueenTraitCol3", main = "")
hist(pvAllTraitCol1$workersTraitCol1, xlab = "pvWorkersTraitCol1", main = "")
hist(pvAllTraitCol2$workersTraitCol2, xlab = "pvWorkersTraitCol2", main = "")
hist(pvAllTraitCol3$workersTraitCol3, xlab = "gvWorkersTraitCol3", main = "")
colonyGv <- calcColonyGv(apiary)
colonyGv
## [,1]
## 1 23.37062
## 2 19.82874
## 3 23.78014
colonyPheno <- calcColonyPheno(apiary)
colonyPheno
## [,1]
## 1 23.16364
## 2 23.06634
## 3 21.54986
bestColony <- selectColonies(apiary, n = 1, by = colonyGv)
bestColony
## An object of class "MultiColony"
## Number of colonies: 1
## Are empty: 0
## Are NULL: 0
## Have split: 0
## Have swarmed: 0
## Have superseded: 0
## Have collapsed: 0
## Are productive: 0
## Inspect the best colony
bestColony@colonies
## [[1]]
## An object of class "Colony"
## Id: 3
## Location:
## Queen: 8
## Number of fathers: 15
## Number of workers: 98
## Number of drones: 10
## Number of virgin queens: 0
## Has split: FALSE
## Has swarmed: FALSE
## Has superseded: FALSE
## Has collapsed: FALSE
## Is productive: TRUE
ggplot(data = gvAllTraitCol1, aes(x = queenTraitCol1, y = workersTraitCol1)) +
xlab("Genetic value for the queen effect") +
ylab("Genetic value for the workers effect") +
geom_point() +
theme_classic()
# We know genetic values of all individuals, including drones that the queen mated with (=fathers in a colony)
# Inspect the values at each colony and this will help us to inspect variation in the distribution of genetic values # of worker
getFathersGv(apiary@colonies[[1]])
## queenTrait workersTrait
## 850 9.940240 0.136222068
## 565 10.384376 0.187243180
## 883 8.718280 0.046739149
## 784 11.825200 0.024573397
## 882 10.440230 0.138634490
## 414 10.252519 0.318609121
## 546 9.298160 0.118191012
## 599 9.711896 0.137479922
## 440 9.168958 0.272114142
## 460 10.327152 0.261738651
## 708 9.419290 -0.069146866
## 801 9.030204 0.262724146
## 704 9.890303 -0.049074765
## 761 8.974359 -0.008892438
## 502 11.717679 0.190652880
getFathersGv(apiary@colonies[[2]])
## queenTrait workersTrait
## 430 10.124612 0.06308442
## 689 8.058640 0.09616668
## 494 9.816476 0.15577435
## 766 9.644451 0.10951077
## 458 10.719642 0.33402265
## 603 9.770427 0.03815456
## 775 10.351177 -0.01528416
## 786 10.479120 -0.07910023
## 876 9.714475 -0.03188051
## 445 8.866509 0.25892924
## 626 7.656385 0.24961787
## 631 8.703236 0.17168137
## 699 9.390953 0.03205672
## 668 10.037995 0.15693561
## 425 8.391437 0.46590914
getFathersGv(apiary@colonies[[3]])
## queenTrait workersTrait
## 687 8.136314 0.199728343
## 768 10.568584 -0.002453396
## 688 9.602318 0.007936096
## 896 10.583676 0.090779245
## 875 9.248541 0.206207360
## 412 10.799160 0.187181993
## 740 8.850494 0.058294158
## 697 9.679118 0.065683378
## 729 9.165016 0.025627955
## 812 8.480494 0.096560681
## 593 12.065078 0.291047957
## 466 8.757717 0.529447531
## 682 8.485811 0.092976264
## 794 11.291045 -0.037526182
## 859 10.660255 0.238922630