Learn R Programming

coala (version 0.7.2)

coal_model: Create a Coalescent Model

Description

This creates a basic coalescent model to which more features, loci, parameters and summary statistics can be added later. Data under the model can be simulated using the simulate function.

Usage

coal_model(sample_size, loci_number = 0, loci_length = 1000, ploidy = 1)

Value

The basic coalescent model which can be extended with features, parameters, loci and summary statistics.

Arguments

sample_size

Defines the number of populations and the number of individual sampled from each population. Given as an integer vector where each entry gives the number of individuals sampled from the corresponding population.

loci_number

You can optionally add a number of loci with equal length to the model. This gives to number of loci to add.

loci_length

This gives the length of the loci to add.

ploidy

The number of chromosomes that will be simulated per individual.

See Also

The 'coala-intro' vignette for a general description on how to extend models.

For checking which simulators can be used for this model: check_model

For adding mutation or for a list of other features: feat_mutation

For adding loci: locus_single, locus_averaged, locus_trio

For a generating DNA sequences or for a list of summary statistics: sumstat_dna

Examples

Run this code
# A model with one population and 20 unlinked loci:
model <- coal_model(10, 20) +
  feat_mutation(5) +
  sumstat_tajimas_d()
check_model(model)
simulate(model)

# A model with two populations:
model <- coal_model(c(13, 18), 5) +
  feat_migration(.5, symmetric = TRUE) +
  sumstat_trees()
check_model(model)
simulate(model)

# A model with 10 populations:
model <- coal_model(rep(2, 10), 5) +
  feat_migration(.5, symmetric = TRUE) +
  sumstat_trees()
check_model(model)
simulate(model)

# A model with recombination:
model <- coal_model(20, 1, 1000) +
  feat_recombination(10) +
  feat_mutation(5) +
  sumstat_four_gamete()
check_model(model)
simulate(model)

Run the code above in your browser using DataLab