Nemo
2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
Factory of Individual, stores the individual prototype and the trait prototypes, manages the individual garbage collector. More...
#include <indfactory.h>
Public Member Functions | |
IndFactory () | |
virtual | ~IndFactory () |
void | recycle (Individual *ind) |
Put an individual in the recycling pool. More... | |
void | purgeRecyclingPOOL () |
Empty the recycling pool. More... | |
void | makePrototype (map< trait_t, TraitPrototype * > TTlist) |
Creates the individuals prototype from the selected trait prototypes. More... | |
void | clearPrototype () |
Reset the trait prototypes, mostly done to unregister the genetic maps. More... | |
Individual * | getPrototypeClone () |
Return an uninitialized copy of the individual prototype. More... | |
Individual * | getNewIndividual () |
Creates a blank individual which has to be "decorated" later. More... | |
Individual * | makeNewIndividual (Individual *mother, Individual *father, sex_t sex, unsigned short homepatch) |
Creates an individual with pointers to parents, sex and home ID set but no genetic data. More... | |
Individual * | makeOffsprg (Individual *mother, Individual *father, sex_t sex, unsigned short homepatch) |
Completely creates an individual with inheritance and mutations on all traits. More... | |
Individual * | getIndividualProtoype () |
Individual prototype accessor. More... | |
TraitPrototype * | getTraitPrototype (trait_t type) |
Accessor to a TraitPrototype. More... | |
std::map< trait_t, TraitPrototype * > & | getTraitPrototypes () |
Accessor to the list of TraitPrototype's. More... | |
int | getTraitIndex (trait_t type) |
Gives the index of trait with type. More... | |
Protected Attributes | |
std::map< trait_t, TraitPrototype * > | _protoTraits |
Map of the trait prototypes. More... | |
std::map< trait_t, int > | _TraitsIndex |
Table containing the index of each trait. More... | |
Individual | _protoIndividual |
The individuals prototype used to create any new individual in a simulation. More... | |
std::deque< Individual * > | RecyclingPOOL |
Garbage collector for unused Individual's. More... | |
Factory of Individual, stores the individual prototype and the trait prototypes, manages the individual garbage collector.
Provides methods to generate new individuals within the Metapop. Each new individual is created by cloning a prototype itself created at the simulation setup. New individuals are decorated with the appropriate traits as set by the trait prototypes and receives a unique ID (unique within a simulation).
|
inline |
|
virtual |
References _protoIndividual, _protoTraits, _TraitsIndex, Individual::clearTraits(), and purgeRecyclingPOOL().
void IndFactory::clearPrototype | ( | ) |
Reset the trait prototypes, mostly done to unregister the genetic maps.
References TTProtoWithMap::_map, _protoIndividual, _protoTraits, _TraitsIndex, GeneticMap::clear(), Individual::clearTraits(), and message().
Referenced by SimRunner::run().
|
inline |
Individual prototype accessor.
References _protoIndividual.
Referenced by SimRunner::run(), and LCE_Breed_Selection::setNonSelectedTraitTable().
|
inline |
Creates a blank individual which has to be "decorated" later.
ID is set and new traits are allocated but no genetic data is created (i.e. TTrait::init_sequence() is not called). Sex has to be set later too.
References makeNewIndividual(), and MAL.
Referenced by LCE_Breed_base::breed_cloning(), Metapop::fillPatchFromSource(), Metapop::fillPopulationFromSource(), Metapop::loadPopFromBinarySource(), and Metapop::retrieve_data().
|
inline |
Return an uninitialized copy of the individual prototype.
References _protoIndividual, and Individual::clone().
Referenced by LCE_Cross::generatePedigree().
Gives the index of trait with type.
type | the type of the trait (i.e. its "name") |
References _TraitsIndex.
Referenced by LifeCycleEvent::attach_trait(), TTDispersalSH::init(), TTQuantiSH::init(), LCE_FileServicesNotifier::loadFileServices(), SimRunner::run(), LCE_Disperse_EvolDisp::setParameters(), and LCE_Selection_base::setParameters().
TraitPrototype * IndFactory::getTraitPrototype | ( | trait_t | type | ) |
Accessor to a TraitPrototype.
type | the trait name |
References _protoTraits.
Referenced by LCE_QuantiInit::execute(), LCE_Init_BDMI::execute(), LCE_Selection_base::set_sel_model(), LCE_QuantiInit::setParameters(), LCE_QuantiModifier::setParameters(), LCE_Breed_Quanti::setParameters(), LCE_Init_BDMI::setParameters(), and LCE_NtrlInit::setParameters().
|
inline |
Accessor to the list of TraitPrototype's.
References _protoTraits.
Referenced by Metapop::store_data().
Individual * IndFactory::makeNewIndividual | ( | Individual * | mother, |
Individual * | father, | ||
sex_t | sex, | ||
unsigned short | homepatch | ||
) |
Creates an individual with pointers to parents, sex and home ID set but no genetic data.
No inheritance or mutations on the trait sequences are done. Sets the pedigree class of the individual. Calls Individual::init() to allocate traits' sequences memory if individual is cloned from the prototype. Otherwise, calls Individual::reset() if the new individual is coming from the recycling pool.
mother | ptr to the mother |
father | ptr to the father |
sex | gender of the individual |
homepatch | ID of the Patch where this individual is born, usually the current position in the Metapop::vPatch array. |
References _protoIndividual, Individual::clone(), Individual::currentID, Individual::getID(), Individual::init(), RecyclingPOOL, Individual::reset(), Individual::setFather(), Individual::setFatherID(), Individual::setHome(), Individual::setID(), Individual::setMother(), Individual::setMotherID(), Individual::setPedigreeClass(), and Individual::setSex().
Referenced by LCE_Breed_base::breed(), LCE_Breed_base::breed_cloning(), LCE_Cross::create_individual_ancestors(), TTDeletMutBitstrFH::FHread(), TTNeutralGenesFH::FHread(), TTQuantiFH::FHread(), LCE_Resize::fillPatchNoBackup(), getNewIndividual(), makeOffsprg(), LCE_Breed_Disperse::mate_full_selfing(), LCE_Breed_Disperse::mate_random(), LCE_Breed_Disperse::mate_random_hermaphrodite(), LCE_Breed_Disperse::mate_selfing(), and Patch::setNewGeneration().
Individual * IndFactory::makeOffsprg | ( | Individual * | mother, |
Individual * | father, | ||
sex_t | sex, | ||
unsigned short | homepatch | ||
) |
Completely creates an individual with inheritance and mutations on all traits.
Calls makeNewIndividual() to get the new offspring.
mother | ptr to the mother |
father | ptr to the father |
sex | gender of the individual |
homepatch | ID of the Patch where this individual is born, usually the current position in the Patch array |
References Individual::create(), Individual::DidHaveABaby(), Individual::getPedigreeClass(), and makeNewIndividual().
Referenced by LCE_Cross::sampleAmongPop(), LCE_Cross::sampleWithinPop(), LCE_Breed_Wolbachia::wolbachia_model_1(), and LCE_Breed_Wolbachia::wolbachia_model_2().
void IndFactory::makePrototype | ( | map< trait_t, TraitPrototype * > | TTlist | ) |
Creates the individuals prototype from the selected trait prototypes.
Resets the individual's ID counter to 0 and sets the traits index table.
TTlist | the list of the current trait prototype selected from the current simulation parameters. |
References _protoIndividual, _protoTraits, _TraitsIndex, Individual::addTrait(), error(), fatal(), message(), and Individual::setCurrentID().
Referenced by BinaryDataLoader::extractPop(), and SimRunner::init_components().
|
inline |
Empty the recycling pool.
References RecyclingPOOL.
Referenced by Metapop::init(), Metapop::setPopulation(), and ~IndFactory().
|
inline |
Put an individual in the recycling pool.
References error(), and RecyclingPOOL.
Referenced by LCE_Patch_Extinction::do_remove(), LCE_Selection_base::doViabilitySelection(), LCE_Disperse_EvolDisp::evoldisp(), LCE_Disperse_EvolDisp::fixdisp(), Patch::flush(), LCE_Breed_Selection::makeOffspringWithSelection(), LCE_Disperse_ConstDisp::MigratePatch_AbsorbingBorder(), LCE_Resize::regulateAgeClassNoBackup(), LCE_Regulation::regulatePatch(), and LCE_Breed_Wolbachia::wolbachia_model_1().
|
protected |
The individuals prototype used to create any new individual in a simulation.
Referenced by clearPrototype(), getIndividualProtoype(), getPrototypeClone(), makeNewIndividual(), makePrototype(), and ~IndFactory().
|
protected |
Map of the trait prototypes.
Referenced by clearPrototype(), getTraitPrototype(), getTraitPrototypes(), makePrototype(), Metapop::retrieve_data(), and ~IndFactory().
Table containing the index of each trait.
Referenced by clearPrototype(), getTraitIndex(), makePrototype(), and ~IndFactory().
|
protected |
Garbage collector for unused Individual's.
Referenced by makeNewIndividual(), purgeRecyclingPOOL(), and recycle().