This callback specifies that a code block is providing logic for an individual to choose a mate. The first parent is chosen based on fitness values, then this callback is called to determine the second parent (if no callback is specified, it is chosen randomly proportional to fitness). The callback code should return a vector of weights specifying the proportional probability of each individual in the population being the second parent (including the first parent, as selfing is possible). Alternatively, it could return an Individual object referring to the individual chosen as the second parent. Returning a numeric 0 tells SLiM that no mate could be found. Lastly, returning NULL tells SLiM to use the default weights vector, which is the same as just returning weights but is more efficient. see SLiM Manual: page 599

mateChoice(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:

individual

The parent already chosen (the female, in sexual simulations)

genome1

One genome of the parent already chosen

genome2

The other genome of the parent already chosen

subpop

The subpopulation into which the offspring will be placed

sourceSubpop

The subpopulation from which the parents are being chosen

weights

The standard fitness-based weights for all individuals

Author

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

Examples

slim_block(mateChoice(p2), {

  ## in subpopulation 2, high fitness individuals are preferred
  return(weights^2)

})
#> A slimr_block:
#> <slimr_script[1]>
#> block_1:1:1 mateChoice(p2) {
#>     return(weights^2);
#> }