template<typename Space, typename DispersalPolicy, typename CoalescencePolicy, typename Memory = quetzal::demography::memory_policy::on_RAM>
class quetzal::simulator::ForwardBackwardSpatiallyExplicit< Space, DispersalPolicy, CoalescencePolicy, Memory >
Discrete-time coalescence simulator in a discrete spatially explicit landscape.
This simulator consists in a forward demographic simulation of population growth and migration, after what a backward coalescent simulation is performed that traces back the ancestry of a sample of gene copies sampled in one or more populations. Most Recent Common ancestor is not always fond in the time span of the spatial history, so if the chosen CoalescencePolicy implements the required behavior, ancestry can be simulated in the more distant past using another model like the DiscreteTimeWrightFisher model, to find the MRCA. Details concerning the mergers (binary mergers, simultaneous multiple mergers) can be controlled using the relevant Merger policy class when calling a coalescence function of the class interface.
- Template Parameters
-
Space | deme identifiers (like the populations geographic coordinates) |
Strategy | a template class argument (e.g. mass_based, individual_based) that indicates how dispersal should be defined in terms of demographic expansion algorithms. Strategy class implements the details (computing migrations probabilites as a function of the distance for example) whereas template specialization of the internal history_type class defines different migration algorithms. |
CoalescencePolicy | a policy class for the demographic expansion. |
|
| ForwardBackwardSpatiallyExplicit (coord_type x_0, N_value_type N_0, unsigned int nb_generations) |
| Constructor.
|
|
auto | distribution_area (unsigned int t) const |
| Return demes with non-zero population size.
|
|
auto | get_functor_N () const noexcept |
| Read-only access to the population size history.
|
|
template<typename Generator , typename Growth , typename Dispersal > |
void | simulate_forward_demography (Growth growth, Dispersal kernel, Generator &gen) |
| Simulate the forward-in-time demographic expansion.
|
|
template<typename Merger , typename Generator > |
auto | make_forest_and_coalesce_along_spatial_history (std::map< coord_type, unsigned int > sample, Generator &gen) |
| Initlize a forest based on sample counts then coalesce the forest along the spatial history, then stops and return an incomplete forest.
|
|
template<typename Merger , typename Generator > |
auto | make_forest_using_sampling_time_and_coalesce_along_spatial_history (std::map< coord_type, unsigned int > sample, unsigned int sampling_time, Generator &gen) |
| Initialize a forest based on sample counts, forwarding the sampling time to the forest contructor. Then coalesce the forest along the spatial history, then stops and return a possibly incomplete forest.
|
|
template<typename Merger , typename Generator , typename F , typename Tree , typename U > |
auto | coalesce_along_spatial_history (forest_type< Tree > forest, F binary_op, Generator &gen, U make_tree) |
| Coalesce a forest of nodes conditionally to the simulated demography.
|
|
template<typename Merger = quetzal::coalescence::merger_policy::SimultaneousMultipleMerger< quetzal::coalescence::occupancy_spectrum::sampling_policy::on_the_fly>, typename Generator > |
auto | coalesce_to_mrca (std::map< coord_type, unsigned int > sample, unsigned int sampling_time, Generator &gen) |
| Create a forest from a sample and coalesce it conditionally to the simulated demography.
|
|
template<typename Merger = quetzal::coalescence::merger_policy::SimultaneousMultipleMerger< quetzal::coalescence::occupancy_spectrum::sampling_policy::on_the_fly>, typename Generator > |
auto | coalesce_to_mrca (std::map< coord_type, unsigned int > sample, Generator &gen) |
| Create a forest from a sample and coalesce it conditionally to the simulated demography.
|
|
template<typename Merger = quetzal::coalescence::merger_policy::SimultaneousMultipleMerger< quetzal::coalescence::occupancy_spectrum::sampling_policy::on_the_fly>, typename Generator , typename F > |
auto | coalesce_to_mrca (std::map< coord_type, unsigned int > sample, unsigned int sampling_time, F leaf_name, Generator &gen) |
| Create a forest from a sample giving name to tips, then coalesce them conditionally to the simulated demography.
|
|
template<typename Merger = quetzal::coalescence::merger_policy::SimultaneousMultipleMerger< quetzal::coalescence::occupancy_spectrum::sampling_policy::on_the_fly>, typename T , typename F1 , typename F2 , typename Generator > |
auto | coalesce_to_mrca (std::vector< T > sample, unsigned int sampling_time, F1 get_location, F2 get_name, Generator &gen) |
| Create a forest from a sample then coalesce them conditionally to the simulated demography.
|
|
template<typename Space , typename DispersalPolicy , typename CoalescencePolicy , typename Memory = quetzal::demography::memory_policy::on_RAM>
template<typename Merger = quetzal::coalescence::merger_policy::SimultaneousMultipleMerger< quetzal::coalescence::occupancy_spectrum::sampling_policy::on_the_fly>, typename Generator , typename F >
Create a forest from a sample giving name to tips, then coalesce them conditionally to the simulated demography.
- Template Parameters
-
Generator | a random number Generator |
F | a unary operation with signature equivalent to 'std::string fun(coord_type const& x,
unsigned int t)' |
- Parameters
-
sample | the number of gene copies at each location |
sampling_time | the time of sampling_time |
leaf_name | a functor assigning a name to a tip as a function of its location and of sampling time. @gen a random number generator |
template<typename Space , typename DispersalPolicy , typename CoalescencePolicy , typename Memory = quetzal::demography::memory_policy::on_RAM>
template<typename Merger = quetzal::coalescence::merger_policy::SimultaneousMultipleMerger< quetzal::coalescence::occupancy_spectrum::sampling_policy::on_the_fly>, typename T , typename F1 , typename F2 , typename Generator >
Create a forest from a sample then coalesce them conditionally to the simulated demography.
- Template Parameters
-
T | type of an individual |
F1 | a unary operation with signature equivalent to 'coord_type fun(const T& i)' |
F2 | a unary operation with signature equivalent to 'std::string fun(const T& i)' |
Generator | a random number Generator |
- Parameters
-
sample | a collection of individuals (gene copies) |
sampling_time | the time of sampling_time |
get_location | a unary operation taking a sampled individual of type T as an argument and returning its geographic location |
get_name | a functor taking a sampled individual of type T as an argument and returning an identifier @gen a random number generator |