Learn R Programming

coala

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 coalescent theory. 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.

Installation

The package can be installed from CRAN using

install.packages("coala")

If you want to use the simulation programs ms, msms or seqgen, they need to be installed separately. This is described in the "Using External Simulators" vignette and in the wiki.

Usage & Help

Coala comes with a vignette that explains the packages concepts and is a good place to start. It also has a vignette containing a few example applications.

Detailed information about coala's functions is provided via R's help system. Call help(_function_) in R to view them. They usually also contain examples and further links.

The ABC vignette gives an example on how coala can be used to conduct the simulations for Approximate Bayesian Computation.

Also take a look at the project wiki for additional resources.

Example

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
# [1] 15 12  1  4  0  1  0  2  0

More examples can be found in the examples vignette.

Problems

If you encounter problems when using coala, please file a bug report or mail to coala-pkg (at) googlegroups.com.

Supported Simulators

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 manually. The R version of scrm should be installed automatically, and the R version ms if the package phyclust is installed.

Development

To follow or participate in the development of coala, please install the development version from GitHub using

devtools::install_github('statgenlmu/coala')

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.

Copy Link

Version

Install

install.packages('coala')

Monthly Downloads

404

Version

0.7.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

March 4th, 2024

Functions in coala (0.7.2)

locus_trio

Locus Trios
feat_recombination

Feature: Recombination
feat_sample

Creates a feature that represents the sampling from one population
+.coalmodelpart

Add a feature or parameter to a model
par_zero_inflation

Zero Inflation for Parameters
parameter

Model Parameters
locus

Loci
par_variation

Variable Parameters
simulator_seqgen

Simulator: seq-gen
sumstat_class

Base Class for Summary Statistics
scale_model

Function that downscales a coalescent model
list_simulators

Returns the available simulators
feat_outgroup

Feature: Outgroup
search_executable

Search the working directory and the run path for an executable
create_segsites

Segregating Sites
feat_pop_merge

Feature: Population Merge
sumstat_sfs

Summary Statistic: Site Frequency Spectrum
simulator_msms

Simulator: msms
sumstat_seg_sites

Summary Statistic: Segregating Sites
simulator_scrm

Simulator: scrm
sumstat_tajimas_d

Summary Statistic: Tajima's D
sumstat_trees

Summary Statistic: Ancestral Trees
sumstat_dna

Summary Statistic: DNA
sumstat_jsfs

Summary Statistic: Joint Site Frequency Spectrum
sumstat_mcmf

Summary Statistic: Most Common Mutation's Frequency
sumstat_file

Summary Statistic: Files
simulate.coalmodel

Simulate Data According to a Demographic Model
get_outgroup

Getters for coalescent models
feat_unphased

Feature: Unphased Sequences
simulator_ms

Simulator: ms
sumstat_nucleotide_div

Summary Statistic: Nucleotide Diversity
sumstat_four_gamete

Summary Statistic: Four-Gamete-Condition
sumstat_omega

Summary Statistic: Omega
sumstat_ihh

Summary Statistic: Integrated Extended Haplotype Homozygosity
as.segsites.GENOME

Convert PopGenome Data into Coala's Format
create_abc_sumstat

Convert Simulation Results to abc's Summary Statistic Format
coala-package

A Framework for Coalescent Simulation in R
calc_sumstats_from_data

Calculate summary statistics for biological data
coal_model

Create a Coalescent Model
as.segsites

Convert genetic data to coala's internal format
check_model

Check which simulator can simulate a model
create_abc_param

Convert Simulation Results to abc's Parameter Format
calc_jsfs

Calculates the Joint Site Frequency Spectrum
conv_to_ms_arg.growth

Generate command line arguments for features
feat_ignore_singletons

Feature: Ignore Singletons
feat_growth

Feature: Exponential population size growth/decline
feat_migration

Feature: Migration/Gene Flow
feat_mutation

Feature: Mutation
feat_selection

Feature: Selection
feat_size_change

Feature: Instantaneous Size Change