simGenealogy: Simulate genealogies

Description Usage Arguments Details Value Author(s) References Examples

Description

This function simulates genealogies using the multispecies coalescence approach of Fujisawa and Barraclough (2013).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
simGenealogy(
  Species = 30,
  Scenario = "A",
  Ind = 5,
  PopSize = 10000,
  Nsim = 1,
  Scale = NULL,
  SameInd = TRUE,
  SamePop = TRUE
)

Arguments

Species

The species tree within the gene trees should be simulated for Scenarios B-G. In case of Scenario A the number of species. If Nsim > 1 there should be multiphylo with the same number of species per tree

Scenario

Scenario of Fujisawa and Barraclough (2013)

  • A Null model assuming a neutral coalescent process in a single population

  • B Diversification (coalescence within a species tree)

  • D1 Fluctuating population size; bottleneck and then exponential growth

  • D2 Fluctuating population size; instant growth then shrink

  • E Diversification with different sized populations

  • F1 Random sample of individuals per species

  • F2 Random sample of individuals per species, with sampling probabilities proportional to population sizes

  • G Geographic structure

Ind

Individuals per species. Either a vector of length 1 (i.e. same number of individuals per species) or of the same length as Ntip(SpeciesTree)

PopSize

Population size Ne. Assumed to be the same for each species but can vary over time in scenario D. Either a vector of length 1 or of the same length as Nsim.

Nsim

Number of simulated genealogies

Scale

Scale depth of genealogy to this value (e.g. 1)

SameInd

Only important for Scenario F: Should the same random number of individuals be used for all Nsim? Default TRUE

SamePop

Only important for Scenario E: Should the same random population sizes be used for all Nsim? Default TRUE

Details

Scenarios C1 and C2 of incomplete taxon sampling or non-zero rate of species extinction from Fujisawa and Barraclough (2013) are possible to simulate by using a different species tree (see examples). Moreover, the species tree could be also generated by the protracted birth-death process to mirror the genealogy simulation of Sukumaran and Knowles (2017).

Value

A list with up to three elements.

Author(s)

Torsten Hauffe but most of the code was forked from Fujisawa and Barraclough (2013)

References

Fujisawa, T. and T. Barraclough (2013): Delimiting species using single-locus data and the Generalized Mixed Yule Coalescent approach: a revised method and evaluation on simulated data sets. Systematic Biology 62(5), 707-724.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Scenario A
GeneTree <- simGenealogy(Species = 30,
                         Scenario = "A",
                         Ind = 5,
                         PopSize = 10000)
plot(GeneTree$Genealogy, cex = 0.4)

# Scenario B
SpeciesTree <- pbtree(b = 0.27, n = 30)
GeneTree <- simGenealogy(Species = SpeciesTree,
                         Scenario = "B",
                         Ind = 5,
                         PopSize = 10000)
plot(GeneTree$Genealogy, cex = 0.4)

# Scenario C1
FullTree <- pbtree(b = 0.27, n = 50)
SpeciesTree <- drop.tip(FullTree, sample(FullTree$tip.labels, 20))
GeneTree <- simGenealogy(Species = SpeciesTree,
                         Scenario = "C1",
                         Ind = 5,
                         PopSize = 10000)
plot(GeneTree$Genealogy, cex = 0.4)
# Scenario F2 with two simulation runs
# Simulating two genealogies for the same species tree 
# and with the same random number of individuals and 
# population sizes per species per simulation run
SpeciesTree <- pbtree(b = 0.27, n = 30)
GeneTree <- simGenealogy(Species = SpeciesTree,
                         Scenario = "F2",
                         Ind = 5,
                         PopSize = 10000,
                         Nsim = 2)
GeneTree$Species
# Simulating two genealogies for the same species tree 
# but with a different random number of individuals and 
# population sizes per species per simulation run
SpeciesTree <- pbtree(b = 0.27, n = 30)
GeneTree <- simGenealogy(Species = SpeciesTree,
                         Scenario = "F2",
                         Ind = 5,
                         PopSize = 10000,
                         Nsim = 2,
                         SameInd = FALSE,
                         SamePop = FALSE)
GeneTree$Species
                           

thauffe/TraitGmyc documentation built on July 4, 2021, 7:37 a.m.