Learn R Programming

⚠️There's a newer version (0.7.2) of this package.Take me there.

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. You can ask questions on coala's mailing list.

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

657

Version

0.4.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Paul Staab

Last Published

February 6th, 2016

Functions in coala (0.4.0)

feat_ignore_singletons

Feature: Ignore Singletons
feat_growth

Feature: Exponential population size growth/decline
create_abc_sumstat

Convert Simulation Results to abc's Summary Statistic Format
check_model

Check which simulator can simulate a model
as.segsites

Convert genetic data to coala's internal format
locus

Loci
feat_recombination

Feature: Recombination
get_outgroup

Getters for coalescent models
sumstat_dna

Summary Statistic: DNA
sumstat_sfs

Summary Statistic: Site Frequency Spectrum
scale_model

Function that downscales a coalescent model
feat_size_change

Feature: Instantaneous Size Change
coala-package

A Framework for Coalescent Simulation in R
parameter

Model Parameters
sumstat_trees

Summary Statistic: Ancestral Trees
search_executable

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

Calculate summary statistics for biological data
simulator_seqgen

Simulator: seq-gen
par_zero_inflation

Zero Inflation for Parameters
list_simulators

Returns the available simulators
par_variation

Variable Parameters
feat_sample

Creates a feature that represents the sampling from one population
create_abc_param

Convert Simulation Results to abc's Parameter Format
sumstat_class

Base Class for Summary Statistics
conv_to_ms_arg.growth

Generate command line arguments for features
sumstat_mcmf

Summary Statistic: Most Common Mutation's Frequency
coal_model

Create a Coalescent Model
simulator_ms

Simulator: ms
+.coalmodelpart

Add a feature or parameter to a model
feat_selection

Feature: Selection
feat_pop_merge

Feature: Population Merge
simulator_msms

Simulator: msms
feat_mutation

Feature: Mutation
simulator_scrm

Simulator: scrm
feat_outgroup

Feature: Outgroup
calc_jsfs

Calculates the Joint Site Frequency Spectrum
sumstat_tajimas_d

Summary Statistic: Tajima's D
sumstat_ihh

Summary Statistic: Integrated Extended Haplotype Homozygosity
feat_unphased

Feature: Unphased Sequences
locus_trio

Locus Trios
as.segsites.GENOME

Convert PopGenome Data into Coala's Format
sumstat_four_gamete

Summary Statistic: Four-Gamete-Condition
sumstat_jsfs

Summary Statistic: Joint Site Frequency Spectrum
sumstat_omega

Summary Statistic: Omega
feat_migration

Feature: Migration/Gene Flow
simulate.coalmodel

Simulate Data According to a Demographic Model
sumstat_seg_sites

Summary Statistic: Segregating Sites
create_segsites

Segregating Sites
sumstat_nucleotide_div

Summary Statistic: Nucleotide Diversity
sumstat_file

Summary Statistic: Files