Documentation for SLiM function calcFST, which is a method of the SLiM class SLiMBuiltin. Note that the R function is a stub, it does not do anything in R (except bring up this documentation). It will only do anything useful when used inside a slim_block function further nested in a slim_script function call, where it will be translated into valid SLiM code as part of a full SLiM script.

calcFST(genomes1, genomes2, muts, start, end)

Arguments

genomes1

An object of type Genome object. See details for description.

genomes2

An object of type Genome object. See details for description.

muts

An object of type null or Mutation object. The default value is NULL. See details for description.

start

An object of type null or integer. Must be of length 1 (a singleton). The default value is NULL. See details for description.

end

An object of type null or integer. Must be of length 1 (a singleton). The default value is NULL. See details for description.

Value

An object of type float. Return will be of length 1 (a singleton)

Details

Documentation for this function can be found in the official SLiM manual: page 751.

Calculates the FST between two Genome vectors - typically, but not necessarily, the genomes that constitute two different subpopulations (which we will assume for the purposes of this discussion). In general, higher FST indicates greater genetic divergence between subpopulations. The calculation is done using only the mutations in muts; if muts is NULL, all mutations are used. The muts parameter can therefore be used to calculate the FST only for a particular mutation type (by passing only mutations of that type). The calculation can be narrowed to apply to only a window - a subrange of the full chromosome - by passing the interval bounds [start, end] for the desired window. In this case, the vector of mutations used for the calculation will be subset to include only mutations within the specified window. The default behavior, with start and end of NULL, provides the genome-wide FST, which is often used to assess the overall level of genetic divergence between sister species or allopatric subpopulations. The code for calcFST() is, roughly, an Eidos implementation of Wright's definition of FST (but see below for further discussion and clarification): where HS is the average heterozygosity in the two subpopulations, and HT is the total heterozygosity when both subpopulations are combined. In this implementation, the two genome vectors are weighted equally, not weighted by their size. In SLiM 3, the implementation followed Wright's definition closely, and returned the average of ratios: mean(1.0 - H_s/H_t), in the Eidos code. In SLiM 4, it returns the ratio of averages instead: 1.0 - mean(H_s)/mean(H_t). In other words, the FST value reported by SLiM 4 is an average across the specified mutations in the two sets of genomes, where H_s and H_t are first averaged across all specified mutations prior to taking the ratio of the two. This ratio of averages is less biased than the average of ratios, and and is generally considered to be best practice (see, e.g., Bhatia et al., 2013). This means that the behavior of calcFST() differs between SLiM 3 and SLiM 4. The implementation of calcFST(), viewable with functionSource(), treats every mutation in muts as independent in the heterozygosity calculations; in other words, if mutations are stacked, the heterozygosity calculated is by mutation, not by site. Similarly, if multiple Mutation objects exist in different genomes at the same site (whether representing different genetic states, or multiple mutational lineages for the same genetic state), each Mutation object is treated separately for purposes of the heterozygosity calculation, just as if they were at different sites. One could regard these choices as embodying an infinite-sites interpretation of the segregating mutations. In most biologically realistic models, such genetic states will be quite rare, and so the impact of these choices will be negligible; however, in some models these distinctions may be important.

Author

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

Examples

## This just brings up the documentation:
calcFST()