A mutationEffect() callback is called by SLiM when it is determining the fitness effect of a mutation carried by an individual. Normally, the fitness effect of a mutation is determined by the selection coefficient s of the mutation and the dominance coefficient h of the mutation (the latter used only if the individual is heterozygous for the mutation). For details on this callback see SLiM Manual: page 712

mutationEffect(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 mutationEffect 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, and is thus hemizygous or haploid)

effect

The default relative fitness value calculated by SLiM

individual

The individual carrying this mutation (an object of class 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(mutationEffect(), {
  if (homozygous) {
    return(1.0 + mut.selectionCoeff);
  } else {
    return(1.0 + mut.mutationType.dominanceCoeff * mut.selectionCoeff);
  }
})
#> A slimr_block:
#> <slimr_script[1]>
#> block_1:1:1 mutationEffect() {
#>     if (homozygous) {
#>         return(1 + mut.selectionCoeff);
#>     } else {
#>         return(1 + mut.mutationType.dominanceCoeff * mut.selectionCoeff);
#>     }
#> }