Documentation for SLiM function calcHeterozygosity, 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.

calcHeterozygosity(genomes, muts, start, end)

Arguments

genomes

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 heterozygosity for a vector of genomes, based upon the frequencies of mutations in the genomes. The result is the expected heterozygosity, for the individuals to which the genomes belong, assuming that they are under Hardy-Weinberg equilibrium; this can be compared to the observed heterozygosity of an individual, as calculated by calcPairHeterozygosity(). Often genomes will be all of the genomes in a subpopulation, or in the entire population, but any genome vector may be used. By default, with muts=NULL, the calculation is based upon all mutations in the simulation; the calculation can instead be based upon a subset of mutations, such as mutations of a specific mutation type, by passing the desired vector of mutations for muts. FST = 1 − HS HT 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 heterozygosity. The implementation of calcHeterozygosity(), viewable with functionSource(), treats every mutation as independent in the heterozygosity calculations. One could regard this choice 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 this choice will be negligible; however, in some models this distinction may be important. See calcPairHeterozygosity() for further discussion.

Author

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

Examples

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