This callback specifies that a code block is providing logic to modify an offspring that has been produced during a SLiM simulation, and is called for every offspring produced. The code should modify the pseudo-variables associated with the child (see details) child, childGenome1, and childGenome2. It should also return a single logical T or F. If F, the offspring will be discarded and the callback called again. Make sure there is a non-zero probability of returning T, or the simulation could hang indefinitely. see SLiM Manual: page 601

modifyChild(subpop_id)

Arguments

subpop_id

The id(s) of the subpopulation(s) to which this callback should apply. Can be an integer 1, 2, etc., or character "p1", "p2", etc.

Value

None

Details

Global variables available in reproduction callbacks:

child

The generated child (an object of class Individual)

childGenome1

One genome of the generated child

childGenome2

The other genome of the generated child

childIsFemale

T if the child will be female, F if male (defined only if sex is enabled)

parent1

The first parent (an object of class Individual)

parent1Genome1

One genome of the first parent

parent1Genome2

The other genome of the first parent

isCloning

T if the child is the result of cloning

isSelfing

T if the child is the result of selfing

parent2

The second parent (an object of class Individual)

parent2Genome1

One genome of the second parent

parent2Genome2

The other genome of the second parent

subpop

The subpopulation in which the child will live

sourceSubpop

The subpopulation of the parents (==subpop if not a migration mating)

Author

Benjamin C Haller (bhaller@benhaller.com) and Philipp W Messer (messer@cornell.edu)

Examples

slim_block(modifyChild(), {

  # prevent hermaphroditic selfing
  if(parent1 == parent2) {
    return(F)
  }
  return(T)

})
#> A slimr_block:
#> <slimr_script[1]>
#> block_1:1:1 modifyChild() {
#>     if (parent1 == parent2) {
#>         return(F);
#>     }
#>     return(T);
#> }