Template Class popbase

Class Documentation

template<typename MutationType, typename mcont, typename gcont, typename mvector, typename ftvector, typename lookup_table_type>
class fwdpp::poptypes::popbase

Base class for population objects.

Note

Added in fwdpp 0.5.0. Changed in 0.6.0 to be independent of ploidy.

Version

0.9.0 Remove construction from containers of low-level types

Public Types

using mutation_type = MutationType

Mutation type.

using type = MutationType
using haploid_genome_type = typename gcont::value_type

Gamete type.

using haploid_genome_type = typename gcont::value_type
using mutation_container = mcont

Container type for mutation objects.

using mutation_container = mcont
using mcount_t = std::vector<uint_t>

Mutation count vector type.

using genome_container = gcont

Container type for haploid_genome_base objects.

using genome_container = gcont
using lookup_table_t = lookup_table_type

Lookup table type for recording mutation positions, etc.

using mutation_container = mvector
using ftvector_t = ftvector

container type for fixation times

Public Functions

~popbase() = default
popbase(popbase&&) = default
popbase(const popbase&) = default
popbase &operator=(popbase&&) = default
popbase &operator=(const popbase&) = default
popbase(const uint_t &initial_haploid_genome_count, typename haploid_genome_t::mutation_container::size_type reserve_size = 100)

Constructor.

bool is_equal(const popbase &rhs) const
void clear_containers()

Empty all the containers.

Public Members

mutation_container mutations
mcount_t mcounts

Contains number of times each mutation exists.

Used to keep track of mutation frequencies.

Should have memory reserved externally, based on some good guess.

mcount_t mcounts_from_preserved_nodes

Contains the contribution of ancient samples to mutation counts. This is place within population classes out of convienience. Be aware of the following issue regarding serialization: mcounts/mcounts_from_preserved_nodes are NOT serialized in fwdpp::serialize_population. Further, when pops are deserialized, mcounts is filled by a call to fwdpp_internal::process_haploid_genomes. This behavior is generally incorrect for simulations involving tree sequence recording, and a call to fwdpp::ts::count_mutations will be needed upon deserialization.

Version

0.7.3 Added to library

genome_container haploid_genomes

Container of haploid_genomes.

haploid_genome_t::mutation_container neutral

Containers that can be used as intermediates during the generation of new haploid_genomes.

The requirement to declare these was introduced in fwdpp 0.3.3.

In previous versions of the library, vectors like this had to be allocated for every crossover event for every generation. The result was an excessive number of requests for memory allocation.

Now, we create the vector once per replicate. Further, we will reserve memory here, to minimize reallocs, etc., within fwdpp.

Internally, fwdpp’s job is to make sure that this vector is appropriately and efficiently cleared, but only when needed.

haploid_genome_t::mutation_container selected
lookup_table_type mut_lookup

Can be used to track positions of segregating mutations.

Note

Must have interface like std::map or std::unordered_set

mutation_container fixations

Vector of mutation_t to track fixations.

ftvector fixation_times

vector<uint_t> records times when mutation_ts were added to mut_lookup