Learn R Programming

Ease (version 0.1.2)

setMetapopulation: Setting a metapopulation

Description

A metapopulation is a set of population(s) (from 1) that are simulated with potential migration between them. Only genotypes can migrate, i.e. adult individuals.

Usage

setMetapopulation(populations, migMat = matrix(1))

Value

a Metapopulation object

Arguments

populations

a list of Population objects

migMat

a migration matrix

Author

Ehouarn Le Faou

Details

The construction of a Metapopulation object requires only two arguments (one optional). The first is a population(s) list, defined from the population class. The second is a migration matrix, which connects the populations together. This matrix is a probability matrix (square with the sum of the rows equal to 1, whose size is equal to the number of populations) where each value corresponds to the proportion of individuals (genotypes) that disperse from their source population (row) to their target population (column).

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)
)
metapop <- setMetapopulation(populations = list(pop))
metapop <- simulate(metapop, nsim = 10, seed = 123)
# Other examples available in the documentation of the package

Run the code above in your browser using DataLab