Coalescent simulators can rapidly simulate biological sequences evolving according to a given model of evolution. You can use this package to specify such models, to conduct the simulations and to calculate additional statistics from the results. It relies on existing simulators for doing the simulation, and currently supports the programs 'ms', 'msms' and 'scrm'. It also supports finite-sites mutation models by combining the simulators with the program 'seq-gen'.
Coala is an R package for simulating biological sequences according
to a given model of evolution. It can call a number of efficient
simulators based on
All simulators can be combined with the program seq-gen to simulate finite
site mutation models.
Coala also directly imports the simulation results into
R, and can
calculate various summary statistics from the results.
The package can be installed from CRAN using
Detailed information about coala's functions is provided via R's help system.
help(_function_) in R to view them. They usually also contain examples and further links.
In the following example, we create a simple panmictic model, simulate it and calculate the site frequency spectrum (SFS) of the simulation results:
model <- coal_model(sample_size = 10, loci_number = 2) +feat_mutation(5) +sumstat_sfs()result <- simulate(model)result$sfs
More examples can be found in the examples vignette.
If you encounter problems when using coala, please
file a bug report or mail to
coala-pkg (at) googlegroups.com.
The package supports the coalescent simulators ms, scrm and msms.
All simulators can be combined with seq-gen to simulate finite sites
mutation models. The programs msms and seq-gen must be installed
The R version of scrm should be installed automatically,
and the R version ms if the package
phyclust is installed.
To follow or participate in the development of
coala, please install the
development version from GitHub using
on Linux and OS X. This requires that you have
devtools and a compiler or
Xcode installed. Bug reports and pull request on GitHub are highly appreciated.
The extending coala vignette
contains information on how to create new summary statistics and add simulators
to coala. The wiki also contains a few
resources for developers.
locus_groupargument for features. Using it, features can be defined only for a subset of the loci in the model (#161, #181). Thanks to @andrewparkermorgan for suggesting this feature.
testthatis not available (#165).
symmetricis used together with
create_abc_sumstatfunctions for converting the simulation results into the format needed for abc::abc function (#151).
active_msms()to download msms' jar file (#153).
+and then be added to one or more models later (#155).
as.segsites.GENOMEfunction that converts genetic data imported with the package PopGenome to coala's format (#139).
feat_ignore_singletons, which is a feature that makes coala ignore singletons when calculating the summary statistics (#138).
phyclustinstead of requiring that the binary is installed on the system (#140).
calc_sumstats_from_datafunction for calculating summary statistics from biological data (#124).
ploidyparameter is now provided in the
coal_modelinstead of in
sumstat_ihh()and made the statistic return a
data.frameinstead of a list.
random = FALSEin
NAif the model has no outgroup rather than throwing an error.