Learn R Programming

coala (version 0.3.0)

feat_selection: Adds positive selection to a model

Description

Adds positive selection to a model

Usage

feat_selection(strength_AA = 0, strength_Aa = 0, strength_aa = 0,
  strength_A = NULL, population = "all", time, start = TRUE,
  start_frequency = 5e-04, Ne = 10000, position = 0.5,
  force_keep = TRUE)

Arguments

strength_AA
The selection strength for the selected homozygote. The parameter is valid for the choosen population and the time further pastwards from either time 0 on if start = TRUE, or from time onwards. The same applies for strength
strength_Aa
The selection strength for the heterozygote.
strength_aa
The selection strength for the recessive homoygote.
strength_A
This sets the strength for the selected allele in an haploid model or a diploid model with additive selection. strength_AA, strength_Aa, strength_aa are ignored when this is argument is given.
population
The population in which the allele is selected. Can either be all for all population, or the number of a population.
time
The time at which the selection starts if start == TRUE (looking forwards in time), or the time at which the selection strength changes if start == FALSE. The new strength applies for to the time period further into the past in t
start
Whether selection should start at this time point. At this time the selected allele is introduced in the population with an initial starting frequency. This must be set to TRUE for exactly one selection feature in the model. The values of
start_frequency
The start frequency at which the selected allele is introduced at time time. If the model has multiple population, this can either be a numeric vector that contains the initial frequency for each population or a single number. In the latter c
Ne
The effective population size that is used for the forward simulations.
position
The position of the selected site, relative to the simulated sequence. Values between 0 and 1 are within the simulated area, while smaller values are to the left of it and larger ones to the right.
force_keep
Whether to restart simulatin in which the selected goes to extinction or not.

Examples

Run this code
# Positive selection in population 2:
model <- coal_model(c(10, 13), 100) +
  feat_pop_merge(par_range('tau', .1, 2), 2, 1) +
  feat_selection(strength_AA=par_expr(2*s),
                 strength_Aa=par_range('s', 100, 2000),
                 population = 2,
                 time=par_expr(tau))

Run the code above in your browser using DataLab