Documentation for Community class from SLiM

Details

This class represents the top level of a SLiM simulation: a community containing one or more species (represented by class Species). The community, represented by a global Community object with the variable name community, is responsible for execution of the tick cycle for active species in each tick, management of the script blocks associated with a simulation, and creation of log files (by creating and owning instances of the LogFile class). The community exists even in singlespecies models. This class has the following methods (functions):

This class has the following properties:

allGenomicElementTypes

A property of type GenomicElementType object. This property is a constant, so it is not modifiable. Property Description: All of the GenomicElementType objects defined in the simulation.

allInteractionTypes

A property of type InteractionType object. This property is a constant, so it is not modifiable. Property Description: All of the InteractionType objects defined in the simulation.

allMutationTypes

A property of type MutationType object. This property is a constant, so it is not modifiable. Property Description: All of the MutationType objects defined in the simulation.

allScriptBlocks

A property of type SLiMEidosBlock object. This property is a constant, so it is not modifiable. Property Description: All registered SLiMEidosBlock objects in the simulation.

allSpecies

A property of type Species object. This property is a constant, so it is not modifiable. Property Description: All of the Species objects defined in the simulation (in species declaration order).

allSubpopulations

A property of type Subpopulation object. This property is a constant, so it is not modifiable. Property Description: All of the Subpopulation objects defined in the simulation.

cycleStage

A property of type string. It is of length one (a singleton). This property is a constant, so it is not modifiable. Property Description: The current cycle stage, as a string. The values of this property essentially mirror the cycle stages of WF and nonWF models (see chapters 23 and 24). Common values include "first" (during execution of first() events), "early" (during execution of early() events), "reproduction" (during offspring generation), "fitness" (during fitness evaluation), "survival" (while applying selection and mortality in nonWF models), and "late" (during execution of late() events). Other possible values include "begin" (during internal setup before each cycle), "tally" (while tallying mutation reference counts and removing fixed mutations), "swap" (while swapping the offspring generation into the parental generation in WF models), "end" (during internal bookkeeping after each cycle), and "console" (during the in-between-ticks state in which commands in SLiMgui's Eidos console are executed). It would probably be a good idea not to use this latter set of values; they are probably not user-visible during ordinary model execution anyway. During execution of initialize() callbacks, no Community object yet exists and so this property cannot be accessed. To detect this state, use exists("community"); if that is F, community does not exist, and therefore your code is executing during initialize() callbacks (or outside of SLiM entirely, in some other Eidos-based context).

logFiles

A property of type LogFile object. This property is a constant, so it is not modifiable. Property Description: The LogFile objects being used in the simulation.

modelType

A property of type string. It is of length one (a singleton). This property is a constant, so it is not modifiable. Property Description: The type of model being simulated, as specified in initializeSLiMModelType(). This will be "WF" for WF models (Wright-Fisher models, the default), or "nonWF" for nonWF models (non-Wright-Fisher models; see section 1.6 for discussion). This must be the same for all species in the community; it is therefore a property on Community, not Species.

tag

A property of type integer. It is of length one (a singleton). This property is a variable, so it is modifiable. Property Description: A user-defined integer value. The value of tag is initially undefined, and it is an error to try to read it; if you wish it to have a defined value, you must arrange that yourself by explicitly setting its value prior to using it elsewhere in your code. The value of tag is not used by SLiM; it is free for you to use. See also the getValue() and setValue() methods (provided by the Dictionary class; see the Eidos manual), for another way of attaching state to the simulation.

tick

A property of type integer. It is of length one (a singleton). This property is a variable, so it is modifiable. Property Description: The current tick number.

verbosity

A property of type integer. It is of length one (a singleton). This property is a variable, so it is modifiable. Property Description: The verbosity level, for SLiM's logging of information about the simulation. This is 1 by default, but can be changed at the command line with the -l[ong] option. It is provided here so that scripts can consult it to govern the level of verbosity of their own output, or set the verbosity level for particular sections of their code. A verbosity level of 0 suppresses most of SLiM's optional output; 2 adds some extra output beyond SLiM's standard output. See sections 20.3 and 21.4 for more information.