The survival() callback will be called during the selection phase of the tick cycle of nonWF models, during the tick(s) in which it is active. By default it will be called once per individual in the entire population (whether slated for survival or not); it may optionally be restricted to apply only to individuals in a specified subpopulation, using the <subpop-id> specifier. (In multispecies models, the definition must be preceded by a species specification as usual.) When a survival() callback is called, a focal individual has already been evaluated by SLiM regarding its survival; a final fitness value for the individual has been calculated, and a random uniform draw in [0,1] has been generated that determines whether the individual is to survive (a draw less than the individual’s fitness) or die (a draw greater than or equal to the individual’s fitness). The focal individual is provided to the callback, as is the subpopulation in which it resides. Furthermore, the preliminary decision (whether the focal individual will survive or not), the focal individual’s fitness, and the random draw made by SLiM to determine survival are also provided to the callback. The callback may return NULL to accept SLiM’s decision, or may return T to indicate that the individual should survive, or F to indicate that it should die, regardless of its fitness and the random deviate drawn. The callback may also return a singleton Subpopulation object to indicate the individual should remain alive but should be moved to that subpopulation (note that calling takeMigrants() during the survival phase is illegal, because SLiM is busy modifying the population’s internal state). For more details see SLiM Manual: page 727
survival(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.
None
Global variables available in reproduction callbacks:
The focal parent that is generating a gamete
The subpopulation to which the focal parent belongs
A logical value indicating SLiM’s preliminary decision (T == survival)
The focal individual’s fitness
SLiM’s random uniform deviate, which determined the preliminary decision
This is documentation for a function in the SLiM software, and has been modified from the official manual, which can be found here: http://benhaller.com/slim/SLiM_Manual.pdf. This documentation is Copyright © 2016-2020 Philipp Messer. All rights reserved. More information about SLiM can be found on the official website: https://messerlab.org/slim/
Other callbacks:
early()
,
first()
,
fitnessEffect()
,
fitness()
,
initialize()
,
interaction()
,
late()
,
mateChoice()
,
modifyChild()
,
mutationEffect()
,
mutation()
,
recombination()
,
reproduction()
,
slim_callbacks()
# From page 461 of the SLiM Manual
slim_block(survival(p1), {
# move dying males into cold storage in case they have mated
if (!surviving) {
if (individual.sex == "M") {
return(p1000);
}
return(NULL);
}
})
#> A slimr_block:
#> <slimr_script[1]>
#> block_1:1:1 survival(p1) {
#> if (!surviving) {
#> if (individual.sex == "M") {
#> return(p1000);
#> }
#> return(NULL);
#> }
#> }