Description Usage Arguments Details Value Author(s) References Examples
This function simulates genealogies using the multispecies coalescence approach of Fujisawa and Barraclough (2013).
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
)
|
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)
|
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 |
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).
A list with up to three elements.
Genealogy Genealogies, which for scenarios B-G are simulated within the provided species tree. The genealogy is of class multiphylo with Nsim genealogies.
Species data.frame with the number of individuals and population sizes per species.
PopFluc data.frame with parameters for fluctuating population size (Only for scenarios D1 and D2 of fluctuating population sizes). G: Growth rate of all subpopulations. T: Half the age of the penultimate diversification event where an instantaneous change in population size too place. Ne: Subpopulation's size before T. N0: Subpopulation's size before T.
Torsten Hauffe but most of the code was forked from Fujisawa and Barraclough (2013)
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.
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.