This callback specifies that a code block is providing logic to decide the fitness of a mutation in an individual. The callback should return a the relative fitness value of the mutation, where a value of 1.0 is neutral. This is called once per mutation per individual per generation in which it is active. If mut_id_type = NULL then the callback will be called only once per individual and should return a global relative fitness value that is independent of mutations the individual possesses. see SLiM Manual: page 596

fitness(mut_type_id, subpop_id)

Arguments

mut_type_id

The id of the mutationType to which this callback should apply. Can be an integer 1, 2, etc., or character "m1", "m2", etc.

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:

mut

A Mutation object, the mutation whose relative fitness is being evaluated

homozygous

A value of T (the mutation is homozygous), F (heterozygous), or NULL (it is paired with a null chromosome, which can occur with sex chromosomes)

relFitness

The default relative fitness value calculated by SLiM

individual

The individual carrying this mutation (an object of class Individual)

genome1

One genome of the individual carrying this mutation

genome2

The other genome of that individual

subpop

The subpopulation in which that individual lives

Author

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

Examples

slim_block(fitness(m2), {
  ## sets up frequency dependent selection for m2
  return(1.5 - sim.mutationFrequencies(p1, mut))
})
#> A slimr_block:
#> <slimr_script[1]>
#> block_1:1:1 fitness(m2) {
#>     return(1.5 - sim.mutationFrequencies(p1, mut));
#> }