Skip to content

Commit 946d377

Browse files
authored
Merge pull request #576 from LStrachan/devel
Changes to cross() to reduce chance of random warning
2 parents 316145f + edf9172 commit 946d377

12 files changed

+48
-41
lines changed

.Rbuildignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
^_pkgdown\.yml
77
^SIMplyBee\.Rproj
88
^docs
9-
^vignettes/*F2*
109
^vignettes/*R
1110
^vignettes/*RData
1211
^vignettes/*pdf
@@ -16,3 +15,5 @@
1615
^vignettes/SIMplyBee\_logo\_small\.png
1716
^.*\.Rproj$
1817
^\.Rproj\.user$
18+
^doc$
19+
^Meta$

vignettes/A_Honeybee_biology.Rmd

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@ honeybee genomes that represent the founder population. You can quickly generate
5252
random genomes using AlphaSimR's `quickHaplo()`. These founder genomes are
5353
rapidly simulated by sampling chromosomes as series of 0s and 1s, and do not
5454
include any species-specific demographic history. This is equivalent to all loci
55-
having allele frequency 0.5 and being in linkage equilibrium. We use this approach
56-
only for demonstrations and testing.
55+
having allele frequency 0.5 and being in linkage equilibrium. We use this
56+
approach only for demonstrations and testing.
5757

5858
Alternatively, you can more accurately simulate honeybee genomes with
5959
SIMplyBee's `simulateHoneyBeeGenomes()`. This function simulates the honeybee
60-
genome using coalescent simulation of whole chromosomes using MaCS (Chen et al., 2009)
61-
for three subspecies: *A. m. ligustica*, *A. m. carnica*, and *A. m. mellifera*
62-
according to the demographic model described by Wallberg et al. (2014).
60+
genome using coalescent simulation of whole chromosomes using MaCS (Chen et al.,
61+
2009) for three subspecies: *A. m. ligustica*, *A. m. carnica*, and *A. m.
62+
mellifera* according to the demographic model described by Wallberg et al.
63+
(2014).
6364

6465
As a demonstration, we will use `quickHaplo()` and simulate genomes of two
6566
founding individuals. In this example, the genomes will be represented by only
@@ -71,12 +72,12 @@ simulation here.
7172
founderGenomes <- quickHaplo(nInd = 2, nChr = 3, segSites = 100)
7273
```
7374

74-
As mentioned, the `simulateHoneyBeeGenomes()` generates more realistic chromosome
75-
samples, but also requires much more time. Hence, when you use `simulateHoneyBeeGenomes()`,
76-
we suggest you save the output to an RData file that you then load in your
77-
environment and work with it. See the function documentation using
78-
`help(simulateHoneyBeeGenomes)` to learn all the parameters involved in the
79-
function.
75+
As mentioned, the `simulateHoneyBeeGenomes()` generates more realistic
76+
chromosome samples, but also requires much more time. Hence, when you use
77+
`simulateHoneyBeeGenomes()`, we suggest you save the output to an RData file
78+
that you then load in your environment and work with it. See the function
79+
documentation using `help(simulateHoneyBeeGenomes)` to learn all the parameters
80+
involved in the function.
8081

8182
Now we are ready to setup global simulation parameters using `SimParamBee`.
8283
`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
199200
start laying eggs of her own workers and drones.
200201

201202
```{r cross colony}
202-
colony <- cross(colony, drones = baseDrones)
203+
colony <- cross(colony, drones = baseDrones, checkCross = "warning")
203204
colony
204205
```
205206

@@ -222,7 +223,7 @@ buildUp(colony)
222223
All the functions in SIMplyBee return objects, hence we need to save them as an
223224
object, otherwise they are lost.
224225

225-
```{r}
226+
```{r buildup and save}
226227
colony <- buildUp(colony)
227228
colony
228229
```
@@ -292,13 +293,13 @@ look at `pull*()` functions. These functions return a list of objects: `pulled`
292293
being the pulled individuals (`Pop` object), and `remnant` being the remaining
293294
colony without the pulled individuals.
294295

295-
```{r}
296+
```{r remnant}
296297
tmp <- pullWorkers(colony, n = 10)
297298
colony <- tmp$remnant
298299
colony
299300
```
300301

301-
```{r}
302+
```{r pulled workers}
302303
pulledWorkers <- tmp$pulled
303304
pulledWorkers
304305
```
@@ -341,7 +342,7 @@ corresponding `pHomBrood()` and `nHombrood()` functions that can be applied
341342
either on the queen (`Pop` class) or colony (`Colony` class) directly. You can
342343
obtain the entire `misc` slot with the `getMisc()` function.
343344

344-
```{r}
345+
```{r misc}
345346
getMisc(getQueen(colony))
346347
```
347348

@@ -371,7 +372,7 @@ current colony and mate her with her brothers. Oh, dear.
371372
```{r inbred colony}
372373
inbredColony <- createColony(x = createVirginQueens(x = colony, nInd = 1))
373374
fathers <- selectInd(drones, nInd = SP$nFathers, use = "rand")
374-
inbredColony <- cross(inbredColony, drones = fathers)
375+
inbredColony <- cross(inbredColony, drones = fathers, checkCross = "warning")
375376
getCsdAlleles(inbredColony)
376377
getCsdAlleles(inbredColony, unique = TRUE)
377378
```

vignettes/B_Multiple_colonies.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ of drones as we have colonies in our `MultiColony`.
157157
# Pull 10 groups of drones from the DCA
158158
droneGroups <- pullDroneGroupsFromDCA(DCA, n = 10, nDrones = nFathersPoisson)
159159
# Cross all virgin queens in the apiary to the selected drones
160-
apiary1 <- cross(apiary1, drones = droneGroups)
160+
apiary1 <- cross(apiary1, drones = droneGroups, checkCross = "warning")
161161
# Check whether the queens are present (and hence mated)
162162
isQueenPresent(apiary1)
163163
```
@@ -215,7 +215,7 @@ droneGroups <- pullDroneGroupsFromDCA(DCA,
215215
n = nColonies(apiary2),
216216
nDrones = nFathersPoisson)
217217
# Cross virgin queens in apiary2 to selected drones
218-
apiary2 <- cross(apiary2, drones = droneGroups)
218+
apiary2 <- cross(apiary2, drones = droneGroups, checkCross = "warning")
219219
```
220220

221221
To learn more about the `nFathersPoisson()` function and other similar

vignettes/C_Colony_events.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ fatherGroups <- pullDroneGroupsFromDCA(drones, n = 30, nDrones = 10)
4444
4545
# Create Colony and MultiColony class, cross them and build them up
4646
colony <- createColony(x = basePop[11])
47-
colony <- cross(colony, drones = fatherGroups[[1]])
47+
colony <- cross(colony, drones = fatherGroups[[1]], checkCross = "warning")
4848
colony <- buildUp(colony, nWorkers = 100, nDrones = 20)
4949
5050
apiary <- createMultiColony(basePop[12:17])
51-
apiary <- cross(apiary, drones = fatherGroups[2:7])
51+
apiary <- cross(apiary, drones = fatherGroups[2:7], checkCross = "warning")
5252
apiary <- buildUp(apiary, nWorkers = 100, nDrones = 20, exact = TRUE)
5353
```
5454

vignettes/D_Crossing.Rmd

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ to 100 drones!
155155
# Samples some drone for mating from the DCA
156156
drones <- selectInd(DCA, nInd = 10, use = "rand")
157157
# Mate the virgin queen with the drones
158-
queen1 <- cross(x = virginQueen1, drones = drones)
158+
queen1 <- cross(x = virginQueen1, drones = drones, checkCross = "warning")
159159
# Check the number of fathers for the queen
160160
nFathers(queen1)
161161
```
@@ -207,13 +207,13 @@ Now, we can cross our virgin queens to drone groups.
207207

208208
```{r}
209209
# Pop-class with multiple queens
210-
queens1 <- cross(x = virginQueens1, drones = droneGroups[1:3])
210+
queens1 <- cross(x = virginQueens1, drones = droneGroups[1:3], checkCross = "warning")
211211
nFathers(queens1)
212212
```
213213

214214
```{r}
215215
# MultiColony-class
216-
beekeeper1 <- cross(x = beekeeper1, drones = droneGroups[4:9])
216+
beekeeper1 <- cross(x = beekeeper1, drones = droneGroups[4:9], checkCross = "warning")
217217
nFathers(beekeeper1)
218218
```
219219

@@ -275,7 +275,7 @@ we can cross the colonies of each beekeeper by providing the `crossPlan1` to the
275275

276276
```{r}
277277
# Cross the colonies of the beekeeper 2
278-
beekeeper2 <- cross(x = beekeeper2, drones = DCA, crossPlan = crossPlan1)
278+
beekeeper2 <- cross(x = beekeeper2, drones = DCA, crossPlan = crossPlan1, checkCross = "warning")
279279
nFathers(beekeeper2)
280280
```
281281

@@ -343,7 +343,8 @@ unmated. Once we have the spatial cross plan, we can mate our colonies.
343343
beekeeper3 <- cross(x = beekeeper3,
344344
crossPlan = crossPlan2,
345345
droneColonies = c(beekeeper1, beekeeper2),
346-
nDrones = 13)
346+
nDrones = 13,
347+
checkCross = "warning")
347348
# Inspect the number of fathers
348349
nFathers(beekeeper3)
349350
```
@@ -387,15 +388,17 @@ beekeeper4 <- cross(x = beekeeper4,
387388
droneColonies = c(beekeeper1, beekeeper2, beekeeper3),
388389
crossPlan = "create",
389390
spatial = FALSE,
390-
nDrones = 12)
391+
nDrones = 12,
392+
checkCross = "warning")
391393
nFathers(beekeeper4)
392394
393395
beekeeper5 <- cross(x = beekeeper5,
394396
droneColonies = c(beekeeper1, beekeeper2, beekeeper3),
395397
crossPlan = "create",
396398
spatial = TRUE,
397399
radius = 3,
398-
nDrones = 12)
400+
nDrones = 12,
401+
checkCross = "warning")
399402
nFathers(beekeeper5)
400403
```
401404

@@ -440,7 +443,8 @@ beekeeper6 <- cross(beekeeper6,
440443
drones = matingStationDCA,
441444
spatial = FALSE,
442445
crossPlan = "create",
443-
nDrones = 15)
446+
nDrones = 15,
447+
checkCross = "warning")
444448
nFathers(beekeeper6)
445449
```
446450

@@ -471,6 +475,7 @@ crossPlanBeekeeper7 <- c(
471475
472476
beekeeper7 <- cross(x = beekeeper7,
473477
crossPlan = crossPlanBeekeeper7,
474-
drones = c(singleDrone, DCA, matingStationDCA))
478+
drones = c(singleDrone, DCA, matingStationDCA),
479+
checkCross = "warning")
475480
nFathers(beekeeper7)
476481
```

vignettes/E_Genomics.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ baseQueens <- createVirginQueens(founderGenomes)
4141
baseDrones <- createDrones(x = baseQueens[1], nInd = 15)
4242
4343
colony <- createColony(x = baseQueens[2])
44-
colony <- cross(colony, drones = baseDrones)
44+
colony <- cross(colony, drones = baseDrones, checkCross = "warning")
4545
colony <- buildUp(colony)
4646
```
4747

vignettes/F2_Variance_calculations.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ head(basePop@gv)
4040
head(basePop@pheno)
4141
drones <- createDrones(x = basePop[1:5], nInd = 3)
4242
colony <- createColony(x = basePop[6])
43-
colony <- cross(x = colony, drones = drones)
43+
colony <- cross(x = colony, drones = drones, checkCross = "warning")
4444
colony <- addWorkers(x = colony, nInd = 50)
4545
colony <- buildUp(colony)
4646
apiary <- createMultiColony(basePop[7:20])
4747
drones <- createDrones(basePop[1:5], nInd = 100)
4848
droneGroups <- pullDroneGroupsFromDCA(drones, n = nColonies(apiary), nDrones = 15)
49-
apiary <- cross(x = apiary, drones = droneGroups)
49+
apiary <- cross(x = apiary, drones = droneGroups, checkCross = "warning")
5050
apiary <- buildUp(apiary)
5151
colonyGv <- calcColonyGv(apiary)
5252
colonyPheno <- calcColonyPheno(apiary)

vignettes/F_Quantitative_Genetics.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ it, and adding some workers.
205205

206206
```{r create_colony}
207207
colony <- createColony(x = basePop[6])
208-
colony <- cross(x = colony, drones = drones)
208+
colony <- cross(x = colony, drones = drones, checkCross = "warning")
209209
colony <- addWorkers(x = colony, nInd = 50)
210210
colony
211211
```
@@ -365,7 +365,7 @@ apiary.
365365
apiary <- createMultiColony(basePop[7:20])
366366
drones <- createDrones(basePop[1:5], nInd = 100)
367367
droneGroups <- pullDroneGroupsFromDCA(drones, n = nColonies(apiary), nDrones = 15)
368-
apiary <- cross(x = apiary, drones = droneGroups)
368+
apiary <- cross(x = apiary, drones = droneGroups, checkCross = "warning")
369369
apiary <- buildUp(apiary)
370370
```
371371

@@ -460,7 +460,7 @@ basePop <- createVirginQueens(founderGenomes)
460460
drones <- createDrones(x = basePop[1:5], nInd = 100)
461461
apiary <- createMultiColony(basePop[6:20])
462462
droneGroups <- pullDroneGroupsFromDCA(drones, nColonies(apiary), nDrones = 15)
463-
apiary <- cross(x = apiary, drones = droneGroups)
463+
apiary <- cross(x = apiary, drones = droneGroups, checkCross = "warning")
464464
apiary <- buildUp(apiary)
465465
apiary
466466
```
@@ -588,7 +588,7 @@ basePop <- createVirginQueens(founderGenomes)
588588
drones <- createDrones(x = basePop[1:5], nInd = 100)
589589
apiary <- createMultiColony(basePop[6:20])
590590
droneGroups <- pullDroneGroupsFromDCA(drones, nColonies(apiary), nDrones = 15)
591-
apiary <- cross(x = apiary, drones = droneGroups)
591+
apiary <- cross(x = apiary, drones = droneGroups, checkCross = "warning")
592592
```
593593

594594
Let's explore queen's genetic and phenotypic values for fecundity and honey

vignettes/G_Sampling_functions.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ DCA to mate with each of the 10 virgin queens.
8080

8181
```{r}
8282
droneGroups <- pullDroneGroupsFromDCA(DCA = DCA, n = 10, nDrones = nFathersPoisson)
83-
apiary <- cross(apiary, drones = droneGroups)
83+
apiary <- cross(apiary, drones = droneGroups, checkCross = "warning")
8484
```
8585

8686
And inspect the number of fathers in each of the colony and their mean.

vignettes/Z_FAQ.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ baseDrones <- createDrones(baseVirginQueen[1])
5656
5757
# A colony
5858
colony <- createColony(baseVirginQueen[2])
59-
colony <- cross(x = colony, crossPlan = "create", drones = baseDrones)
59+
colony <- cross(x = colony, crossPlan = "create", drones = baseDrones, checkCross = "warning")
6060
colony <- addDrones(colony, nInd = 100)
6161
colony
6262
6363
# Crossing one of the remaining virgin queens with drones from the
6464
DCA <- createDCA(colony, nInd = 50)
6565
DCA
66-
queen <- cross(x = baseVirginQueen[3], crossPlan = "create", drones = DCA)
66+
queen <- cross(x = baseVirginQueen[3], crossPlan = "create", drones = DCA, checkCross = "warning")
6767
queen
6868
getFathers(queen)
6969

vignettes/founderpop-2.png

-165 KB
Binary file not shown.

vignettes/founderpop.png

22.1 KB
Loading

0 commit comments

Comments
 (0)