Template Function fwdpp::ts::remove_fixations_from_haploid_genomes

Function Documentation

template<typename GenomeContainerType, typename MutationContainerType, typename mutation_count_container>
void fwdpp::ts::remove_fixations_from_haploid_genomes(GenomeContainerType &haploid_genomes, const MutationContainerType &mutations, const mutation_count_container &mcounts, const mutation_count_container &mcounts_from_preserved_nodes, const fwdpp::uint_t twoN, const bool preserve_selected_fixations)

Removed fixed variants from haploid_genomes.

This function should be called immediately after simplification and mutation counting.

A mutation is removed from a haploid_genome if one of the following conditions holds:

  1. The sum of mcounts and mcounts_from_preserved_nodes is zero.

  2. mcounts == twoN, mcounts_from_preserved_nodes is zero, and preserve_selected_fixations is false or the mutation is neutral.

Parameters
  • haploid_genomes: A haploid_genome container

  • mutations: A mutation container

  • mcounts: A container stating how many times each element in mutations is present in the currently-alive population

  • mcounts_from_preserved_nodes: A container recording the counts of each mutation in ancient samples

  • twoN: Twice the current population size

  • preserve_selected_fixations: If true, do not mark selected fixations for recycling.

When preserve_selected_fixations is true, selected fixations are retained in the population. We do this because simulations of phenotypes (as opposed to relative fitness) require tracking the contribution of fixation to trait values.

Todo:

Improve treatment of fixations by allowing for variants fixed in alive AND ancient samples to be detected.

Note

When simulating a trait and never simulating neutral mutations, the most efficient thing is to skip calling this function entirely.

Warning

The value passed to preserve_selected_fixations needs to be coordinated with the preserve argument of flag_mutations_for_recycling.