diff --git a/.Rbuildignore b/.Rbuildignore index 3a44a7cd..2e0fc2b0 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,7 +6,6 @@ ^_pkgdown\.yml ^SIMplyBee\.Rproj ^docs -^vignettes/*F2* ^vignettes/*R ^vignettes/*RData ^vignettes/*pdf @@ -16,3 +15,5 @@ ^vignettes/SIMplyBee\_logo\_small\.png ^.*\.Rproj$ ^\.Rproj\.user$ +^doc$ +^Meta$ diff --git a/vignettes/A_Honeybee_biology.Rmd b/vignettes/A_Honeybee_biology.Rmd index 1bd7c87a..c9e60ec3 100644 --- a/vignettes/A_Honeybee_biology.Rmd +++ b/vignettes/A_Honeybee_biology.Rmd @@ -52,14 +52,15 @@ honeybee genomes that represent the founder population. You can quickly generate random genomes using AlphaSimR's `quickHaplo()`. These founder genomes are rapidly simulated by sampling chromosomes as series of 0s and 1s, and do not include any species-specific demographic history. This is equivalent to all loci -having allele frequency 0.5 and being in linkage equilibrium. We use this approach -only for demonstrations and testing. +having allele frequency 0.5 and being in linkage equilibrium. We use this +approach only for demonstrations and testing. Alternatively, you can more accurately simulate honeybee genomes with SIMplyBee's `simulateHoneyBeeGenomes()`. This function simulates the honeybee -genome using coalescent simulation of whole chromosomes using MaCS (Chen et al., 2009) -for three subspecies: *A. m. ligustica*, *A. m. carnica*, and *A. m. mellifera* -according to the demographic model described by Wallberg et al. (2014). +genome using coalescent simulation of whole chromosomes using MaCS (Chen et al., +2009) for three subspecies: *A. m. ligustica*, *A. m. carnica*, and *A. m. +mellifera* according to the demographic model described by Wallberg et al. +(2014). As a demonstration, we will use `quickHaplo()` and simulate genomes of two founding individuals. In this example, the genomes will be represented by only @@ -71,12 +72,12 @@ simulation here. founderGenomes <- quickHaplo(nInd = 2, nChr = 3, segSites = 100) ``` -As mentioned, the `simulateHoneyBeeGenomes()` generates more realistic chromosome -samples, but also requires much more time. Hence, when you use `simulateHoneyBeeGenomes()`, -we suggest you save the output to an RData file that you then load in your -environment and work with it. See the function documentation using -`help(simulateHoneyBeeGenomes)` to learn all the parameters involved in the -function. +As mentioned, the `simulateHoneyBeeGenomes()` generates more realistic +chromosome samples, but also requires much more time. Hence, when you use +`simulateHoneyBeeGenomes()`, we suggest you save the output to an RData file +that you then load in your environment and work with it. See the function +documentation using `help(simulateHoneyBeeGenomes)` to learn all the parameters +involved in the function. Now we are ready to setup global simulation parameters using `SimParamBee`. `SimParamBee` builds upon AlphaSimR's `SimParam`, which includes genome and @@ -199,7 +200,7 @@ Let's now mate our virgin queen, so that she is promoted to a queen and can start laying eggs of her own workers and drones. ```{r cross colony} -colony <- cross(colony, drones = baseDrones) +colony <- cross(colony, drones = baseDrones, checkCross = "warning") colony ``` @@ -222,7 +223,7 @@ buildUp(colony) All the functions in SIMplyBee return objects, hence we need to save them as an object, otherwise they are lost. -```{r} +```{r buildup and save} colony <- buildUp(colony) colony ``` @@ -292,13 +293,13 @@ look at `pull*()` functions. These functions return a list of objects: `pulled` being the pulled individuals (`Pop` object), and `remnant` being the remaining colony without the pulled individuals. -```{r} +```{r remnant} tmp <- pullWorkers(colony, n = 10) colony <- tmp$remnant colony ``` -```{r} +```{r pulled workers} pulledWorkers <- tmp$pulled pulledWorkers ``` @@ -341,7 +342,7 @@ corresponding `pHomBrood()` and `nHombrood()` functions that can be applied either on the queen (`Pop` class) or colony (`Colony` class) directly. You can obtain the entire `misc` slot with the `getMisc()` function. -```{r} +```{r misc} getMisc(getQueen(colony)) ``` @@ -371,7 +372,7 @@ current colony and mate her with her brothers. Oh, dear. ```{r inbred colony} inbredColony <- createColony(x = createVirginQueens(x = colony, nInd = 1)) fathers <- selectInd(drones, nInd = SP$nFathers, use = "rand") -inbredColony <- cross(inbredColony, drones = fathers) +inbredColony <- cross(inbredColony, drones = fathers, checkCross = "warning") getCsdAlleles(inbredColony) getCsdAlleles(inbredColony, unique = TRUE) ``` diff --git a/vignettes/B_Multiple_colonies.Rmd b/vignettes/B_Multiple_colonies.Rmd index 6c01d701..e3d6d6f3 100644 --- a/vignettes/B_Multiple_colonies.Rmd +++ b/vignettes/B_Multiple_colonies.Rmd @@ -157,7 +157,7 @@ of drones as we have colonies in our `MultiColony`. # Pull 10 groups of drones from the DCA droneGroups <- pullDroneGroupsFromDCA(DCA, n = 10, nDrones = nFathersPoisson) # Cross all virgin queens in the apiary to the selected drones -apiary1 <- cross(apiary1, drones = droneGroups) +apiary1 <- cross(apiary1, drones = droneGroups, checkCross = "warning") # Check whether the queens are present (and hence mated) isQueenPresent(apiary1) ``` @@ -215,7 +215,7 @@ droneGroups <- pullDroneGroupsFromDCA(DCA, n = nColonies(apiary2), nDrones = nFathersPoisson) # Cross virgin queens in apiary2 to selected drones -apiary2 <- cross(apiary2, drones = droneGroups) +apiary2 <- cross(apiary2, drones = droneGroups, checkCross = "warning") ``` To learn more about the `nFathersPoisson()` function and other similar diff --git a/vignettes/C_Colony_events.Rmd b/vignettes/C_Colony_events.Rmd index ca93d8f5..27355558 100644 --- a/vignettes/C_Colony_events.Rmd +++ b/vignettes/C_Colony_events.Rmd @@ -44,11 +44,11 @@ fatherGroups <- pullDroneGroupsFromDCA(drones, n = 30, nDrones = 10) # Create Colony and MultiColony class, cross them and build them up colony <- createColony(x = basePop[11]) -colony <- cross(colony, drones = fatherGroups[[1]]) +colony <- cross(colony, drones = fatherGroups[[1]], checkCross = "warning") colony <- buildUp(colony, nWorkers = 100, nDrones = 20) apiary <- createMultiColony(basePop[12:17]) -apiary <- cross(apiary, drones = fatherGroups[2:7]) +apiary <- cross(apiary, drones = fatherGroups[2:7], checkCross = "warning") apiary <- buildUp(apiary, nWorkers = 100, nDrones = 20, exact = TRUE) ``` diff --git a/vignettes/D_Crossing.Rmd b/vignettes/D_Crossing.Rmd index e39e62e6..d255c2a9 100644 --- a/vignettes/D_Crossing.Rmd +++ b/vignettes/D_Crossing.Rmd @@ -155,7 +155,7 @@ to 100 drones! # Samples some drone for mating from the DCA drones <- selectInd(DCA, nInd = 10, use = "rand") # Mate the virgin queen with the drones -queen1 <- cross(x = virginQueen1, drones = drones) +queen1 <- cross(x = virginQueen1, drones = drones, checkCross = "warning") # Check the number of fathers for the queen nFathers(queen1) ``` @@ -207,13 +207,13 @@ Now, we can cross our virgin queens to drone groups. ```{r} # Pop-class with multiple queens -queens1 <- cross(x = virginQueens1, drones = droneGroups[1:3]) +queens1 <- cross(x = virginQueens1, drones = droneGroups[1:3], checkCross = "warning") nFathers(queens1) ``` ```{r} # MultiColony-class -beekeeper1 <- cross(x = beekeeper1, drones = droneGroups[4:9]) +beekeeper1 <- cross(x = beekeeper1, drones = droneGroups[4:9], checkCross = "warning") nFathers(beekeeper1) ``` @@ -275,7 +275,7 @@ we can cross the colonies of each beekeeper by providing the `crossPlan1` to the ```{r} # Cross the colonies of the beekeeper 2 -beekeeper2 <- cross(x = beekeeper2, drones = DCA, crossPlan = crossPlan1) +beekeeper2 <- cross(x = beekeeper2, drones = DCA, crossPlan = crossPlan1, checkCross = "warning") nFathers(beekeeper2) ``` @@ -343,7 +343,8 @@ unmated. Once we have the spatial cross plan, we can mate our colonies. beekeeper3 <- cross(x = beekeeper3, crossPlan = crossPlan2, droneColonies = c(beekeeper1, beekeeper2), - nDrones = 13) + nDrones = 13, + checkCross = "warning") # Inspect the number of fathers nFathers(beekeeper3) ``` @@ -387,7 +388,8 @@ beekeeper4 <- cross(x = beekeeper4, droneColonies = c(beekeeper1, beekeeper2, beekeeper3), crossPlan = "create", spatial = FALSE, - nDrones = 12) + nDrones = 12, + checkCross = "warning") nFathers(beekeeper4) beekeeper5 <- cross(x = beekeeper5, @@ -395,7 +397,8 @@ beekeeper5 <- cross(x = beekeeper5, crossPlan = "create", spatial = TRUE, radius = 3, - nDrones = 12) + nDrones = 12, + checkCross = "warning") nFathers(beekeeper5) ``` @@ -440,7 +443,8 @@ beekeeper6 <- cross(beekeeper6, drones = matingStationDCA, spatial = FALSE, crossPlan = "create", - nDrones = 15) + nDrones = 15, + checkCross = "warning") nFathers(beekeeper6) ``` @@ -471,6 +475,7 @@ crossPlanBeekeeper7 <- c( beekeeper7 <- cross(x = beekeeper7, crossPlan = crossPlanBeekeeper7, - drones = c(singleDrone, DCA, matingStationDCA)) + drones = c(singleDrone, DCA, matingStationDCA), + checkCross = "warning") nFathers(beekeeper7) ``` diff --git a/vignettes/E_Genomics.Rmd b/vignettes/E_Genomics.Rmd index 59925804..e138cd4a 100644 --- a/vignettes/E_Genomics.Rmd +++ b/vignettes/E_Genomics.Rmd @@ -41,7 +41,7 @@ baseQueens <- createVirginQueens(founderGenomes) baseDrones <- createDrones(x = baseQueens[1], nInd = 15) colony <- createColony(x = baseQueens[2]) -colony <- cross(colony, drones = baseDrones) +colony <- cross(colony, drones = baseDrones, checkCross = "warning") colony <- buildUp(colony) ``` diff --git a/vignettes/F2_Variance_calculations.Rmd b/vignettes/F2_Variance_calculations.Rmd index 131b07b7..5daf390e 100644 --- a/vignettes/F2_Variance_calculations.Rmd +++ b/vignettes/F2_Variance_calculations.Rmd @@ -40,13 +40,13 @@ head(basePop@gv) head(basePop@pheno) drones <- createDrones(x = basePop[1:5], nInd = 3) colony <- createColony(x = basePop[6]) -colony <- cross(x = colony, drones = drones) +colony <- cross(x = colony, drones = drones, checkCross = "warning") colony <- addWorkers(x = colony, nInd = 50) colony <- buildUp(colony) apiary <- createMultiColony(basePop[7:20]) drones <- createDrones(basePop[1:5], nInd = 100) droneGroups <- pullDroneGroupsFromDCA(drones, n = nColonies(apiary), nDrones = 15) -apiary <- cross(x = apiary, drones = droneGroups) +apiary <- cross(x = apiary, drones = droneGroups, checkCross = "warning") apiary <- buildUp(apiary) colonyGv <- calcColonyGv(apiary) colonyPheno <- calcColonyPheno(apiary) diff --git a/vignettes/F_Quantitative_Genetics.Rmd b/vignettes/F_Quantitative_Genetics.Rmd index 3d14cda3..6d6d2755 100644 --- a/vignettes/F_Quantitative_Genetics.Rmd +++ b/vignettes/F_Quantitative_Genetics.Rmd @@ -205,7 +205,7 @@ it, and adding some workers. ```{r create_colony} colony <- createColony(x = basePop[6]) -colony <- cross(x = colony, drones = drones) +colony <- cross(x = colony, drones = drones, checkCross = "warning") colony <- addWorkers(x = colony, nInd = 50) colony ``` @@ -365,7 +365,7 @@ apiary. apiary <- createMultiColony(basePop[7:20]) drones <- createDrones(basePop[1:5], nInd = 100) droneGroups <- pullDroneGroupsFromDCA(drones, n = nColonies(apiary), nDrones = 15) -apiary <- cross(x = apiary, drones = droneGroups) +apiary <- cross(x = apiary, drones = droneGroups, checkCross = "warning") apiary <- buildUp(apiary) ``` @@ -460,7 +460,7 @@ basePop <- createVirginQueens(founderGenomes) drones <- createDrones(x = basePop[1:5], nInd = 100) apiary <- createMultiColony(basePop[6:20]) droneGroups <- pullDroneGroupsFromDCA(drones, nColonies(apiary), nDrones = 15) -apiary <- cross(x = apiary, drones = droneGroups) +apiary <- cross(x = apiary, drones = droneGroups, checkCross = "warning") apiary <- buildUp(apiary) apiary ``` @@ -588,7 +588,7 @@ basePop <- createVirginQueens(founderGenomes) drones <- createDrones(x = basePop[1:5], nInd = 100) apiary <- createMultiColony(basePop[6:20]) droneGroups <- pullDroneGroupsFromDCA(drones, nColonies(apiary), nDrones = 15) -apiary <- cross(x = apiary, drones = droneGroups) +apiary <- cross(x = apiary, drones = droneGroups, checkCross = "warning") ``` Let's explore queen's genetic and phenotypic values for fecundity and honey diff --git a/vignettes/G_Sampling_functions.Rmd b/vignettes/G_Sampling_functions.Rmd index 383eae6a..c8e9de76 100644 --- a/vignettes/G_Sampling_functions.Rmd +++ b/vignettes/G_Sampling_functions.Rmd @@ -80,7 +80,7 @@ DCA to mate with each of the 10 virgin queens. ```{r} droneGroups <- pullDroneGroupsFromDCA(DCA = DCA, n = 10, nDrones = nFathersPoisson) -apiary <- cross(apiary, drones = droneGroups) +apiary <- cross(apiary, drones = droneGroups, checkCross = "warning") ``` And inspect the number of fathers in each of the colony and their mean. diff --git a/vignettes/Z_FAQ.Rmd b/vignettes/Z_FAQ.Rmd index 439fd4a3..112a368e 100644 --- a/vignettes/Z_FAQ.Rmd +++ b/vignettes/Z_FAQ.Rmd @@ -56,14 +56,14 @@ baseDrones <- createDrones(baseVirginQueen[1]) # A colony colony <- createColony(baseVirginQueen[2]) -colony <- cross(x = colony, crossPlan = "create", drones = baseDrones) +colony <- cross(x = colony, crossPlan = "create", drones = baseDrones, checkCross = "warning") colony <- addDrones(colony, nInd = 100) colony # Crossing one of the remaining virgin queens with drones from the DCA <- createDCA(colony, nInd = 50) DCA -queen <- cross(x = baseVirginQueen[3], crossPlan = "create", drones = DCA) +queen <- cross(x = baseVirginQueen[3], crossPlan = "create", drones = DCA, checkCross = "warning") queen getFathers(queen) diff --git a/vignettes/founderpop-2.png b/vignettes/founderpop-2.png deleted file mode 100644 index 004d56fc..00000000 Binary files a/vignettes/founderpop-2.png and /dev/null differ diff --git a/vignettes/founderpop.png b/vignettes/founderpop.png index 004d56fc..ddb4de6a 100644 Binary files a/vignettes/founderpop.png and b/vignettes/founderpop.png differ