sim_msc: Simulate multispecies coalescent on a species tree

Description Usage Arguments Details Value References See Also Examples

View source: R/RcppExports.R

Description

Simulates the multispecies coalescent on a species tree.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
sim_msc(
  species_tree,
  ne,
  num_sampled_individuals,
  num_genes,
  rescale = TRUE,
  mutation_rate = 1L,
  generation_time = 1L
)

sim_multispecies_coal(
  species_tree,
  ne,
  num_sampled_individuals,
  num_genes,
  rescale = TRUE,
  mutation_rate = 1
)

Arguments

species_tree

input species tree of class "phylo"

ne

Effective population size

num_sampled_individuals

number of individuals sampled within each lineage

num_genes

number of genes to simulate within each locus

rescale

Rescale the tree into coalescent units (otherwise assumes it is in those units)

mutation_rate

The rate of mutation per generation

generation_time

The number of time units per generation

Details

This a multispecies coalescent simulator with two usage options. The function can rescale the given tree into coalescent units given the 'mutation_rate', 'ne', and the 'generation_time'. These result in a tree with coalescent times in units of expected number of mutations per site. The generation_time parameter default is 1 time unit per generation if the units of the tree are in millions of years The mutation_rate parameter is by default set to 1 mutations per site per generation (which is nonsensical). Rescale is set to true by default.

If rescale is set to false the tree is assumed to be in coalescent units and 'ne' is used as the population genetic parameter theta.

Value

A list of coalescent trees

References

Bruce Rannala and Ziheng Yang (2003) Bayes Estimation of Species Divergence Times and Ancestral Population Sizes Using DNA Sequences From Multiple Loci Genetics August 1, 2003 vol. 164 no. 4 1645-1656 Mallo D, de Oliveira Martins L, Posada D (2015) SimPhy: Phylogenomic Simulation of Gene, Locus and Species Trees. Syst. Biol. doi: http://dx.doi.org/10.1093/sysbio/syv082

See Also

sim_ltBD, sim_stBD, sim_stBD_t

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# first simulate a species tree
mu <- 0.5
lambda <- 1.0
nt <- 6
tr <- sim_stBD(sbr = lambda, sdr = mu, numbsim = 1, n_tips = nt)
# for a locus tree with 100 genes sampled per locus tree
gentrees <- sim_msc(tr[[1]],
                    ne = 10000,
                    mutation_rate = 1e-9,
                    generation_time = 1e-6,
                    num_sampled_individuals = 1,
                    num_genes = 100)

treeducken documentation built on March 3, 2021, 1:11 a.m.