Skip to content

Commit 316145f

Browse files
Merge pull request #573 from LStrachan/devel
Simplify vignette A
2 parents 1123148 + a03096b commit 316145f

File tree

1 file changed

+14
-45
lines changed

1 file changed

+14
-45
lines changed

vignettes/A_Honeybee_biology.Rmd

Lines changed: 14 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ library(package = "SIMplyBee")
5050
Figure 1 visualizes the initiation of the simulation. First, we simulate some
5151
honeybee genomes that represent the founder population. You can quickly generate
5252
random genomes using AlphaSimR's `quickHaplo()`. These founder genomes are
53-
rapidly simulated by sampling 0s and 1s, and do not include any species-specific
54-
demographic history. This is equivalent to all loci having allele frequency 0.5
55-
and being in linkage equilibrium. We use this approach only for demonstrations
56-
and testing.
53+
rapidly simulated by sampling chromosomes as series of 0s and 1s, and do not
54+
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.
5757

5858
Alternatively, you can more accurately simulate honeybee genomes with
5959
SIMplyBee's `simulateHoneyBeeGenomes()`. This function simulates the honeybee
60-
genome using MaCS (Chen et al., 2009) for three subspecies: *A. m. ligustica*,
61-
*A. m. carnica*, and *A. m. mellifera* according to the demographic model
62-
described by Wallberg et al. (2014).
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).
6363

64-
As a first demonstration, we will use `quickHaplo()` and simulate genomes of two
64+
As a demonstration, we will use `quickHaplo()` and simulate genomes of two
6565
founding individuals. In this example, the genomes will be represented by only
6666
three chromosomes and 1,000 segregating sites per chromosome. Honeybees have 16
6767
chromosomes and far more segregating sites per chromosome, but we want a quick
@@ -71,43 +71,12 @@ simulation here.
7171
founderGenomes <- quickHaplo(nInd = 2, nChr = 3, segSites = 100)
7272
```
7373

74-
Alternatively, we use `simulateHoneyBeeGenomes()` to sample genomes of a founder
75-
population including 4 *A. m. mellifera* (North) individuals and 2 *A. m.
76-
carnica* individuals. The genomes will be represented by only three chromosomes
77-
and 5 segregating sites per chromosome. These numbers are of course extremely
78-
low because we want a quick examample for demonstrative reasons. This chunk of
79-
code should take a few minutes to run.
80-
81-
```{r simulate honeybee genomes}
82-
founderGenomes2 <- simulateHoneyBeeGenomes(nMelN = 4,
83-
nCar = 2,
84-
nChr = 3,
85-
nSegSites = 5)
86-
```
87-
88-
Unfortunately, due to the complexity of this function, even using such small
89-
numbers takes a while to run. Simulating a group of founder genomes with more
90-
realistic numbers will therefore require a lot of time to run. We suggest
91-
running this part to an external server and save the outcome as an RData file,
92-
which we can load in our environment and work with it.
93-
94-
```{r save Rdata file}
95-
# Save the genomes on a server
96-
save(founderGenomes2, file = "FounderGenomes2_3chr.RData")
97-
# Loade the saved genomes elsewhere
98-
load(file = "FounderGenomes2_3chr.RData")
99-
```
100-
101-
Besides specifying the number of individuals, chromosomes, and segregating
102-
sites, `simulateHoneyBeeGenomes()`, also takes a number of genomic parameters:
103-
effective population size, ploidy, length of chromosomes in base pairs, genetic
104-
length of a chromosome in Morgans, mutation rate, recombination rate, and time
105-
of population splits. The default values for these numbers follow published
106-
references (Wallberg et al., 2014). While you can change these parameters, we
107-
don't advise doing this because such demographic models, and their parameters,
108-
are estimated jointly, so we should not be changing them independently. You can
109-
read more about these parameters in the help page
110-
`help(simulateHoneyBeeGenomes)`.
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.
11180

11281
Now we are ready to setup global simulation parameters using `SimParamBee`.
11382
`SimParamBee` builds upon AlphaSimR's `SimParam`, which includes genome and

0 commit comments

Comments
 (0)