Template Function fwdpp::mutation_keys

Function Documentation

template<typename poptype>
std::pair<std::vector<std::pair<std::size_t, uint_t>>, std::vector<std::pair<std::size_t, uint_t>>> fwdpp::mutation_keys(const poptype &pop, const std::vector<std::size_t> &individuals, const bool include_neutral, const bool include_selected)

For a sample defined by a set of diploids, obtain the keys corresponding to all mutations in that sample.

Several comments are required:

Return

A pair of vectors representing neutral and selected keys, respectively. The value type of each vector is std::pair<std::size_t,fwdpp::uint_t>. The first value is the mutation key, and the second is its frequency in the sample.

Parameters
  • pop: The population object

  • individuals: The indexes of individuals in the sample

  • include_neutral: If true, obtain keys for neutral sites

  • include_selected: If true, obtain keys for selected sites

  1. Return values are unsorted with respect to anything meaningful. If you wish to sort on position, etc., do so yourself.

  2. In general, any manipulation of the keys is possible. For example, removing mutations that are fixed in the sample, or whose frequency is or is not within some desired range, is easily doable via the “erase/remove” idiom.

  3. Keys from multiple samples can be merged to form new vectors where the key elements are unique and the frequencies are summed, all using standard C++.