Skip to content

Commit 01a56ee

Browse files
authored
Merge pull request #587 from HighlanderLab/devel
Changing vignette D
2 parents c018375 + 1b39ecc commit 01a56ee

File tree

4 files changed

+67
-10
lines changed

4 files changed

+67
-10
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: SIMplyBee
22
Type: Package
33
Title: 'AlphaSimR' Extension for Simulating Honeybee Populations and Breeding Programmes
4-
Version: 0.4.0
4+
Version: 0.4.1
55
Authors@R: c(
66
person("Jana", "Obšteter", email = "[email protected]",
77
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-1511-3916")),

NEWS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ editor_options:
44
wrap: 72
55
---
66

7+
# SIMplyBee version 0.4.1
8+
9+
- 2024-09-19
10+
11+
## Bug fixes
12+
13+
- locations of the colonies in the D_Crossing vignettes were previously
14+
sampled by random. This caused that on some runs some queens were left unmated,
15+
which caused an error. We now read in the locations from a csv file.
16+
17+
718
# SIMplyBee version 0.4.0
819

920
- 2024-08-23

vignettes/Colony_locations.csv

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
ColonyID,X,Y
2+
1,0.662431162288274,5.97033145745812
3+
2,0.889869211813095,0.882040306233467
4+
3,3.20406617225118,4.2012594475023
5+
4,3.37467634975274,1.85276144978548
6+
5,6.26877271726022,4.12336288238627
7+
6,1.49762073729787,0.854711175179748
8+
7,6.27428327657999,5.28537368571472
9+
8,0.377119552748809,1.26003243402567
10+
9,0.884600259265786,2.55843304434275
11+
10,4.85341262281402,4.34423864421118
12+
11,0.439273950460384,5.78768883580839
13+
12,4.85267013629791,5.24037990077726
14+
13,6.27814888107222,1.67684867115787
15+
14,5.91398658831959,2.21947012261649
16+
15,2.2845571049277,2.76273156562477
17+
16,2.15001173188715,5.30559199476844
18+
17,3.30277055998226,3.88408253149063
19+
18,1.59318554922445,3.95724726174676
20+
19,5.14489315015939,3.48380219722517
21+
20,4.89542592867685,4.87175443368121
22+
21,4.98504294579104,4.63186113766538
23+
22,1.96273450676472,2.98552319129881
24+
23,1.94181870616625,1.04070091389605
25+
24,3.71355474699821,3.98892629339701
26+
25,1.76640287495849,1.81689439235
27+
26,3.49162610986539,2.007127614613
28+
27,4.70110619836582,1.98065883153337
29+
28,2.93773502070683,2.79053982429322
30+
29,1.69897541097397,2.4435374157815
31+
30,1.54126706057672,0.265964466739025
32+
31,0.211675140867833,1.58970616827141
33+
32,4.38863010920245,4.35616019770602
34+
33,4.3632705003701,0.955920230806015
35+
34,5.94574863325625,5.50420647366442
36+
35,2.86914251070775,0.176914088999066

vignettes/D_Crossing.Rmd

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -287,19 +287,26 @@ colonies. Although we are not sampling drones directly, you still need to
287287
provide `nDrones` argument to determine the number of sampled drone producing
288288
colonies.
289289

290-
For spatial mating, we need to set the location to our apiaries (all the
291-
colonies within an beekeeper will have the same location). Here, we are setting
292-
this locations randomly, but these could be actual coordinated of colonies
293-
within a country.
290+
For spatial mating, we need to set the location to our apiaries. Here, we are
291+
reading the locations in from a file with the coordinates of all colonies, then
292+
selecting the colonies of a specific beekeeper, creating a list of coordinate
293+
pairs (with the `Map` function). We could also set locations randomly.
294294

295295
```{r}
296+
# Read locations from a file
297+
locations = read.csv("Colony_locations.csv")
296298
# Set location to apiaries
299+
beekeeper1_locations <- locations[locations$ColonyID %in% getId(beekeeper1),]
297300
beekeeper1 <- setLocation(beekeeper1,
298-
location = Map(c, runif(nColonies(beekeeper1), 0, 2*pi), runif(nColonies(beekeeper1), 0, 2*pi)))
301+
location = Map(c, beekeeper1_locations$X, beekeeper1_locations$Y))
302+
303+
beekeeper2_locations <- locations[locations$ColonyID %in% getId(beekeeper2),]
299304
beekeeper2 <- setLocation(beekeeper2,
300-
location = Map(c, runif(nColonies(beekeeper2), 0, 2*pi), runif(nColonies(beekeeper2), 0, 2*pi)))
305+
location = Map(c, beekeeper2_locations$X, beekeeper2_locations$Y))
306+
307+
beekeeper3_locations <- locations[locations$ColonyID %in% getId(beekeeper3),]
301308
beekeeper3 <- setLocation(beekeeper3,
302-
location = Map(c, runif(nColonies(beekeeper2), 0, 2*pi), runif(nColonies(beekeeper3), 0, 2*pi)))
309+
location = Map(c, beekeeper3_locations$X, beekeeper3_locations$Y))
303310
304311
```
305312

@@ -372,10 +379,13 @@ beekeepers 1 to 3 as drone producing colonies. Let's first set the locations of
372379
the beekeepers 4 and 5 colonies.
373380

374381
```{r}
382+
beekeeper4_locations <- locations[locations$ColonyID %in% getId(beekeeper4),]
375383
beekeeper4 <- setLocation(beekeeper4,
376-
location = Map(c, runif(nColonies(beekeeper4), 0, 2*pi), runif(nColonies(beekeeper4), 0, 2*pi)))
384+
location = Map(c, beekeeper4_locations$X, beekeeper4_locations$Y))
385+
386+
beekeeper5_locations <- locations[locations$ColonyID %in% getId(beekeeper5),]
377387
beekeeper5 <- setLocation(beekeeper5,
378-
location = Map(c, runif(nColonies(beekeeper5), 0, 2*pi), runif(nColonies(beekeeper5), 0, 2*pi)))
388+
location = Map(c, beekeeper5_locations$X, beekeeper5_locations$Y))
379389
```
380390

381391
Now, we will mate the colonies of beekeeper 4 in a random manner and colonies of

0 commit comments

Comments
 (0)