Learn R Programming

Ease (version 0.1.2)

setPopulation: Setting a population

Description

Generation of a population by providing all the necessary ingredients for its definition, including a genome, a mutation matrix and a selection regime.

Usage

setPopulation(
  name,
  size,
  dioecy,
  genomeObj,
  mutMatrixObj,
  selectionObj,
  selfRate = 0,
  demography = F,
  growthRate = 0,
  initPopSize = NULL,
  initGenoFreq = NULL
)

Value

a Population object

Arguments

name

the name of the population

size

the population size

dioecy

logical indicating whether the simulated population is dioecious or hermaphroditic

genomeObj

a Genome object

mutMatrixObj

a MutationMatrix object

selectionObj

a Selection object

selfRate

the selfing rate

demography

a logic indicating whether the population should have a demography (stochasticity in the number of individuals present in the population + logistic growth with carrying capacity equal to the size parameter)

growthRate

a Genome object

initPopSize

the initial size of the population. It is necessarily equal to size if the population has no demography.

initGenoFreq

a vector of the size of the genotype number describing the initial allele frequencies common to all simulations

Author

Ehouarn Le Faou

Details

A population is defined strictly by a name, a size, a sexual system (dioecy or hermaphodite), and the three objects defined previously: genome, mutation matrix and selection. In addition to that, it is possible to define - a selfing rate (by default equal to 0) - a vector of initial genotypic frequencies - a demography

Two demographic regimes are possible: no demography, i.e. a fixed population size, or demography, i.e. a population where the size fluctuates stochastically. The boolean argument `demography` is used to define whether there should be stochasticity. For a fixed population size, it is therefore sufficient to define that `demography = FALSE` (default) and to set the desired population size with the `popSize` parameter.

For a fluctuating demography, `demography` must be `TRUE` and three other parameters are then needed: the initial population size (`initPopSize`), the population growth rate (`growthRate`) and the carrying capacity of the population (the population size, `popSize`).

It is also possible to avoid defining a population size altogether, by setting off the genetic drift (`drift` parameter). This will allow the model to be simulated deterministically.

Examples

Run this code
# Definition of a population in its simplest form:
DL <- list(dl = c("A", "a"))
HL <- list(hl = c("B", "b"))
mutations <- list(
  mutation(from = "A", to = "a", rate = 1e-3),
  mutation(from = "B", to = "b", rate = 1e-3)
)
genomeObj <- setGenome(listHapLoci = HL, listDipLoci = DL)
pop <- setPopulation(
  name = "A",
  size = 1000,
  dioecy = TRUE,
  genomeObj = genomeObj,
  selectionObj = setSelectNeutral(genomeObj),
  mutMatrixObj = setMutationMatrix(genomeObj, mutations = mutations)
)

Run the code above in your browser using DataLab