Learn R Programming

dartR.sim (version 0.70)

gl.sim.offspring: Simulates offspring based on alleles provided by parents

Description

This takes a population (or a single individual) of fathers (provided as a genlight object) and mother(s) and simulates offspring based on 'random' mating. It can be used to simulate population dynamics and check the effect of those dynamics and allele frequencies, number of alleles. Another application is to simulate relatedness of siblings and compare it to actual relatedness found in the population to determine kinship.

Usage

gl.sim.offspring(
  fathers,
  mothers,
  noffpermother,
  sexratio = 0.5,
  popname = "offspring",
  verbose = NULL
)

Value

A genlight object with n individuals.

Arguments

fathers

Genlight object of potential fathers [required].

mothers

Genlight object of potential mothers simulated [required].

noffpermother

Number of offspring per mother [required].

sexratio

The sex ratio of simulated offspring (females / females +males, 1 equals 100 percent females) [default 0.5.].

popname

population name of the returned genlight object [default offspring]

verbose

Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2, unless specified using gl.set.verbosity].

Author

Bernd Gruber (Post to https://groups.google.com/d/forum/dartr)

Examples

Run this code
#Simulate 10 potential fathers
gl.fathers <- glSim(10, 20, ploidy=2)
#Simulate 10 potential mothers
gl.mothers <- glSim(10, 20, ploidy=2)
res <- gl.sim.offspring(gl.fathers, gl.mothers, 2, sexratio=0.5)

Run the code above in your browser using DataLab