Nemo  2.4.0
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
LCE_Breed_Wolbachia Class Reference

Breeding LCE when individuals carry the Wolbachia endosymbiotic parasite. More...

#include <ttwolbachia.h>

+ Inheritance diagram for LCE_Breed_Wolbachia:
+ Collaboration diagram for LCE_Breed_Wolbachia:

Public Member Functions

 LCE_Breed_Wolbachia ()
 
virtual ~LCE_Breed_Wolbachia ()
 
void wolbachia_model_1 ()
 
void wolbachia_model_2 ()
 
virtual bool setParameters ()
 
virtual void execute ()
 
virtual LifeCycleEventclone ()
 
virtual void loadFileServices (FileServices *loader)
 
virtual void loadStatServices (StatServices *loader)
 
virtual bool resetParameterFromSource (std::string param, SimComponent *cmpt)
 
virtual age_t removeAgeClass ()
 
virtual age_t addAgeClass ()
 
virtual age_t requiredAgeClass ()
 
- Public Member Functions inherited from LCE_Breed_base
 LCE_Breed_base ()
 
virtual ~LCE_Breed_base ()
 
virtual IndividualgetFatherPtr (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Calls the mating function according to the model chosen using the function pointer, used to get the father from the mother in a patch. More...
 
void NonWrightFisherPopulation ()
 
void WrightFisherPopulation ()
 
void doAgingInWFpop ()
 
Individualbreed (Individual *mother, Individual *father, unsigned int LocalPatch)
 Makes a new individual with the right parents. More...
 
Individualbreed_cloning (Individual *mother, Individual *father, unsigned int LocalPatch)
 Makes a new individual by doing a deep copy of the mother (copies the mother's genes into the offspring). More...
 
IndividualmakeOffspring (Individual *ind)
 Last step of the breeding process, does inheritance and mutation of the parents' genes. More...
 
IndividualmakeOffspring (Individual *newind, Individual *mother, Individual *father, unsigned int natalPatch)
 Overloads previous function when a new offspring is created "in-place", that is from existing pointer in a patch. More...
 
Individualdo_breed (Individual *mother, Individual *father, unsigned int LocalPatch)
 Calls the breeding function unsing its pointer. More...
 
bool checkMatingCondition (Patch *thePatch)
 Checks if any mating will take place in the patch passed as argument. More...
 
bool checkNoSelfing (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is not selfing or cloning. More...
 
bool checkPolygyny (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is polygynous. More...
 
bool checkSelfing (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is selfing. More...
 
bool checkCloning (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is cloning. More...
 
bool setMatingSystem ()
 
bool setFecundity ()
 
bool setSexRatio ()
 
double getMatingProportion ()
 
double getMeanFecundity (unsigned int patch)
 
int getMatingSystem ()
 
bool doInheritance ()
 
double getPoissonFecundity (double mean)
 
double getFixedFecundity (double mean)
 
double getGaussianFecundity (double mean)
 
double getLogNormalFecundity (double mean)
 
double getFecundity (unsigned int patch)
 
double getFecundity (double mean)
 
sex_t getOffsprgSex ()
 
sex_t getOffsprgSexRandom ()
 
sex_t getOffsprgSexFixed ()
 
sex_t getOffsprgSexSelfing ()
 
sex_t getOffsprgSexCloning ()
 
bool isWrightFisher ()
 
IndividualRandomMating (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male drawn randomly from a patch. More...
 
IndividualfullPolyginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to the alpha male of the patch. More...
 
IndividualfullPolyginy_manyMales (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to one of the first _mating_males males of the patch. More...
 
IndividualpartialPolyginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1, or the first male otherwise. More...
 
IndividualpartialPolyginy_manyMales (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1, or one of the _mating_males first males otherwise. More...
 
IndividualfullMonoginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male with same index as mother (if available) from the focal patch. More...
 
IndividualpartialMonoginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male with same index as mother (if available) from the focal patch. More...
 
IndividualfullSelfing (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns the mother pointer. More...
 
IndividualpartialSelfing (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns the mother pointer or a random female if _mating_proportion != 1. More...
 
Individualrandom_hermaphrodite (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a random female from the patch, will be the same mother with probability 1/N (Wright-Fisher model). More...
 
- Public Member Functions inherited from LifeCycleEvent
 LifeCycleEvent (const char *name, const char *trait_link)
 Cstor. More...
 
virtual ~LifeCycleEvent ()
 
virtual void init (Metapop *popPtr)
 Sets the pointer to the current Metapop and the trait link if applicable. More...
 
virtual bool attach_trait (string trait)
 
virtual void set_paramset (std::string name, bool required, SimComponent *owner)
 
virtual void set_event_name (std::string &name)
 Set the name of the event (name of the ParamSet) and add the corresponding parameter to the set. More...
 
virtual void set_event_name (const char *name)
 
virtual string & get_event_name ()
 Accessor to the LCE's name. More...
 
virtual int get_rank ()
 Accessor to the LCE rank in the life cycle. More...
 
virtual void set_pop_ptr (Metapop *popPtr)
 Accessors for the population pointer. More...
 
virtual Metapopget_pop_ptr ()
 
- Public Member Functions inherited from SimComponent
 SimComponent ()
 
virtual ~SimComponent ()
 
virtual void loadUpdaters (UpdaterServices *loader)
 Loads the parameters and component updater onto the updater manager. More...
 
virtual void set_paramset (ParamSet *paramset)
 Sets the ParamSet member. More...
 
virtual void set_paramsetFromCopy (const ParamSet &PSet)
 Reset the set of parameters from a another set. More...
 
virtual ParamSetget_paramset ()
 ParamSet accessor. More...
 
virtual void add_parameter (Param *param)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd, ParamUpdaterBase *updater)
 Interface to add a parameter and its updater to the set. More...
 
virtual Paramget_parameter (std::string name)
 Param getter. More...
 
virtual double get_parameter_value (std::string name)
 Param value getter. More...
 
virtual string get_name ()
 Returnd the name of the ParamSet, i.e. More...
 
virtual bool has_parameter (std::string name)
 Param getter. More...
 

Private Member Functions

void inoculate_wolbachia ()
 
double hasInfectedFemale ()
 

Private Attributes

double _incomp_cost
 
double _fec_cost
 
double _infected_fec
 
TMatrix_inoculum_size
 
unsigned int _inoculum_time
 
unsigned int _model
 
void(LCE_Breed_Wolbachia::* _breed_func_ptr )()
 
TTWolbachiaFH_writer
 

Additional Inherited Members

- Protected Attributes inherited from LCE_Breed_base
TMatrix _mean_fecundity
 
Individual *(LCE_Breed_base::* MatingFuncPtr )(Patch *, Individual *, unsigned int)
 
Individual *(LCE_Breed_base::* DoBreedFuncPtr )(Individual *mother, Individual *father, unsigned int LocalPatch)
 
double(LCE_Breed_base::* FecundityFuncPtr )(double mean)
 
bool(LCE_Breed_base::* CheckMatingConditionFuncPtr )(Patch *thePatch)
 
sex_t(LCE_Breed_base::* GetOffsprgSex )()
 
void(LCE_Breed_base::* PopModelFuncPtr )(void)
 
- Protected Attributes inherited from LifeCycleEvent
std::string _event_name
 The param name to be read in the init file. More...
 
Metapop_popPtr
 The ptr to the current Metapop. More...
 
std::string _LCELinkedTraitType
 The name of the linked trait. More...
 
int _LCELinkedTraitIndex
 The index in the individual's trait table of the linked trait. More...
 
- Protected Attributes inherited from SimComponent
ParamSet_paramSet
 The parameters container. More...
 

Detailed Description

Breeding LCE when individuals carry the Wolbachia endosymbiotic parasite.

See the user manual for an explanation of the parameters defined here.

Constructor & Destructor Documentation

◆ LCE_Breed_Wolbachia()

LCE_Breed_Wolbachia::LCE_Breed_Wolbachia ( )
169  : LifeCycleEvent("breed_wolbachia",WOLB),
171 _writer(0)
172 {
175  add_parameter("wolbachia_fecundity_cost",DBL,true,true,-1,1, updater);
176  add_parameter("wolbachia_incompatibility_cost",DBL,true,true,-1,1, updater);
177  add_parameter("wolbachia_inoculum_size",MAT,true,false,0,0, updater);
178  add_parameter("wolbachia_inoculum_time",INT,true,false,0,0, updater);
179  add_parameter("wolbachia_model",INT,false,true,1,2, updater);
180  add_parameter("wolbachia_output_dir", STR, false, false, 0, 0);
181 }
double _fec_cost
Definition: ttwolbachia.h:208
TTWolbachiaFH * _writer
Definition: ttwolbachia.h:216
TMatrix * _inoculum_size
Definition: ttwolbachia.h:210
double _incomp_cost
Definition: ttwolbachia.h:207
virtual bool setParameters()
Definition: ttwolbachia.cc:190
double _infected_fec
Definition: ttwolbachia.h:209
unsigned int _inoculum_time
Definition: ttwolbachia.h:211
LifeCycleEvent(const char *name, const char *trait_link)
Cstor.
Definition: lifecycleevent.h:97
Implementation of the ParamUpdaterBase interface.
Definition: param.h:362
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:111
#define WOLB
Definition: types.h:72
@ DBL
Definition: types.h:77
@ MAT
Definition: types.h:77
@ STR
Definition: types.h:77
@ INT
Definition: types.h:77

References SimComponent::add_parameter(), DBL, INT, MAT, setParameters(), and STR.

Referenced by clone().

+ Here is the caller graph for this function:

◆ ~LCE_Breed_Wolbachia()

LCE_Breed_Wolbachia::~LCE_Breed_Wolbachia ( )
virtual
184 {
185  if(_writer) delete _writer;
186 }

References _writer.

Member Function Documentation

◆ addAgeClass()

virtual age_t LCE_Breed_Wolbachia::addAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

241 {return OFFSPRG;}
#define OFFSPRG
Offspring age class flag.
Definition: types.h:49

References OFFSPRG.

◆ clone()

virtual LifeCycleEvent* LCE_Breed_Wolbachia::clone ( )
inlinevirtual

Implements LifeCycleEvent.

234  { return new LCE_Breed_Wolbachia(); }
LCE_Breed_Wolbachia()
Definition: ttwolbachia.cc:169

References LCE_Breed_Wolbachia().

◆ execute()

void LCE_Breed_Wolbachia::execute ( )
virtual

Implements LifeCycleEvent.

247 {
248 
249 #ifdef _DEBUG_
250  message("LCE_Breed_Wolbachia::execute\n");
251 #endif
252  double infection_status;
253 
256 
258 
259  infection_status = hasInfectedFemale();
260 
261  if( infection_status == 0 || infection_status == 1) {
263  _popPtr->reset();
264  return;
265  }}
266 
267 
268  if(_popPtr->size(OFFSPRG) != 0) {
269  warning("offspring containers not empty at time of breeding, flushing.\n");
270  _popPtr->flush(OFFSx);
271  }
272 
273  (this->*_breed_func_ptr)();
274 
277  }
278 
279 }
void inoculate_wolbachia()
Definition: ttwolbachia.cc:377
double hasInfectedFemale()
Definition: ttwolbachia.cc:403
void(LCE_Breed_Wolbachia::* _breed_func_ptr)()
Definition: ttwolbachia.h:214
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:80
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together.
Definition: metapop.h:311
unsigned int getCurrentReplicate()
Definition: metapop.h:294
void reset()
Called to empty the patches, individuals are move to the garbage collector.
Definition: metapop.cc:1179
unsigned int getCurrentGeneration()
Definition: metapop.h:295
void flush()
Removes all individual pointers and flush them into the recycling pool.
Definition: metapop.h:848
static unsigned int getGenerations()
Definition: simenv.h:60
void record(unsigned int repl, unsigned int gen, double infection)
Definition: ttwolbachia.cc:426
void warning(const char *str,...)
Definition: output.cc:57
void message(const char *message,...)
Definition: output.cc:39
@ OFFSx
Definition: types.h:41

References _breed_func_ptr, _inoculum_time, LifeCycleEvent::_popPtr, _writer, Metapop::flush(), Metapop::getCurrentGeneration(), Metapop::getCurrentReplicate(), SIMenv::getGenerations(), hasInfectedFemale(), inoculate_wolbachia(), message(), OFFSPRG, OFFSx, TTWolbachiaFH::record(), Metapop::reset(), Metapop::size(), and warning().

◆ hasInfectedFemale()

double LCE_Breed_Wolbachia::hasInfectedFemale ( )
private
404 {
405  double indNbr = 0, mean = 0, size;
406  Patch* crnt_patch;
407 
408  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); ++i) {
409  crnt_patch = _popPtr->getPatch(i);
410  size = crnt_patch->size(FEM, ADLTx);
411  indNbr += size;
412  for(unsigned int j = 0; j < size; ++j)
413  mean += (double)*(bool*)crnt_patch->get(FEM, ADLTx, j)->getTraitValue(_LCELinkedTraitIndex);
414  }
415 
416  return (indNbr != 0 ? mean/indNbr : nanf("NULL"));
417 }
void * getTraitValue(IDX T)
Accessor to the value (phenotype) of a particular trait.
Definition: individual.h:270
int _LCELinkedTraitIndex
The index in the individual's trait table of the linked trait.
Definition: lifecycleevent.h:88
unsigned int getPatchNbr()
Definition: metapop.h:275
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:256
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:431
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:497
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:533
@ FEM
Definition: types.h:36
@ ADLTx
Definition: types.h:41

References LifeCycleEvent::_LCELinkedTraitIndex, LifeCycleEvent::_popPtr, ADLTx, FEM, Patch::get(), Metapop::getPatch(), Metapop::getPatchNbr(), Individual::getTraitValue(), and Patch::size().

Referenced by execute().

+ Here is the caller graph for this function:

◆ inoculate_wolbachia()

void LCE_Breed_Wolbachia::inoculate_wolbachia ( )
private
378 {
379  Patch* current_patch;
380  bool T = 1;
381 
382  for (unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
383 
384  current_patch = _popPtr->getPatch(i);
385 
386  if(current_patch->get_isExtinct()) continue;
387 
388  for (unsigned int j = 0;
389  j < _inoculum_size->get(i, 0) && j < current_patch->size(FEM, ADLTx); j++) {
390  current_patch->get(FEM, ADLTx, j)->setTrait(_LCELinkedTraitIndex, &T);
391  }
392 
393  for (unsigned int j = 0;
394  j < _inoculum_size->get(i, 1) && j < current_patch->size(MAL, ADLTx); j++) {
395  current_patch->get(MAL, ADLTx, j)->setTrait(_LCELinkedTraitIndex, &T);
396  }
397  }
398 // if(!ok) fatal("could not inoculate wolbachia, check the inoculum size!\n");
399 }
void * setTrait(IDX T, void *value)
Sets the phenotype/value of a trait to a particular value.
Definition: individual.h:255
bool get_isExtinct()
Definition: metapop.h:485
double get(unsigned int i, unsigned int j) const
Accessor to element at row i and column j.
Definition: tmatrix.h:192
@ MAL
Definition: types.h:36

References _inoculum_size, LifeCycleEvent::_LCELinkedTraitIndex, LifeCycleEvent::_popPtr, ADLTx, FEM, Patch::get(), TMatrix::get(), Patch::get_isExtinct(), Metapop::getPatch(), Metapop::getPatchNbr(), MAL, and Individual::setTrait().

Referenced by execute().

+ Here is the caller graph for this function:

◆ loadFileServices()

void LCE_Breed_Wolbachia::loadFileServices ( FileServices loader)
virtual

Implements SimComponent.

233 {
234  if(_writer != NULL) delete _writer;
235 
236  _writer = new TTWolbachiaFH(this);
237 
239  get_parameter("wolbachia_output_dir")->getArg(), this);
240 
241  loader->attach(_writer);
242 }
virtual void set(bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path, LCE *event)
Definition: filehandler.h:275
virtual void attach(Handler *FH)
Attaches the FileHandler to the current list (_writers) of the FileServices.
Definition: fileservices.cc:60
static unsigned int getReplicates()
Definition: simenv.h:62
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:138
FileHandler of the Wolbachia trait.
Definition: ttwolbachia.h:254

References _writer, FileServices::attach(), SimComponent::get_parameter(), SIMenv::getGenerations(), SIMenv::getReplicates(), and EventFileHandler< LCE >::set().

◆ loadStatServices()

virtual void LCE_Breed_Wolbachia::loadStatServices ( StatServices loader)
inlinevirtual

Implements SimComponent.

238 {}

◆ removeAgeClass()

virtual age_t LCE_Breed_Wolbachia::removeAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

240 {return 0;}

◆ requiredAgeClass()

virtual age_t LCE_Breed_Wolbachia::requiredAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

242 {return ADULTS;}
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:53

References ADULTS.

◆ resetParameterFromSource()

virtual bool LCE_Breed_Wolbachia::resetParameterFromSource ( std::string  param,
SimComponent cmpt 
)
inlinevirtual

Implements SimComponent.

239 {return false;}

◆ setParameters()

bool LCE_Breed_Wolbachia::setParameters ( )
virtual

Reimplemented from LCE_Breed_base.

191 {
192  if(!LCE_Breed_base::setParameters( )) return false;
193 
194  _fec_cost = this->get_parameter_value("wolbachia_fecundity_cost");
195  _infected_fec = this->getMeanFecundity(0) * (1 - _fec_cost);
196  _incomp_cost = this->get_parameter_value("wolbachia_incompatibility_cost");
197  _inoculum_time = (unsigned int)this->get_parameter_value("wolbachia_inoculum_time");
198 
199  TMatrix tmp;
200 
201  get_parameter("wolbachia_inoculum_size")->getMatrix(&tmp);
202 
203  if( !_inoculum_size ) _inoculum_size = new TMatrix();
204 
205  if(tmp.ncols() == 2 && tmp.nrows() == _popPtr->getPatchNbr())
206  _inoculum_size->copy(tmp);
207  else
208  setSpatialMatrix("wolbachia_inoculum_size", "2", &tmp, _inoculum_size, 2, _popPtr->getPatchNbr());
209 
210  if (get_parameter("wolbachia_model")->isSet()) {
211  _model = (unsigned int)get_parameter_value("wolbachia_model");
212  } else
213  _model = 1;
214 
215 
216  switch(_model) {
217  case 1:
219  break;
220  case 2:
222  break;
224  }
225 
226 
227  return true;
228 }
unsigned int _model
Definition: ttwolbachia.h:212
void wolbachia_model_1()
Definition: ttwolbachia.cc:283
void wolbachia_model_2()
Definition: ttwolbachia.cc:329
double getMeanFecundity(unsigned int patch)
Definition: LCEbreed.h:100
virtual bool setParameters()
Definition: LCEbreed.cc:76
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:377
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:142
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
unsigned int ncols() const
Definition: tmatrix.h:215
void copy(const TMatrix &mat)
Copy a matrix.
Definition: tmatrix.h:77
unsigned int nrows() const
Definition: tmatrix.h:212
bool setSpatialMatrix(string param, string numColCondition, TMatrix *inMat, TMatrix *outMat, unsigned int nVal, unsigned int patchNbr, bool doRandomize)
Definition: utils.cc:114

References _breed_func_ptr, _fec_cost, _incomp_cost, _infected_fec, _inoculum_size, _inoculum_time, _model, LifeCycleEvent::_popPtr, TMatrix::copy(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), LCE_Breed_base::getMeanFecundity(), Metapop::getPatchNbr(), TMatrix::ncols(), TMatrix::nrows(), LCE_Breed_base::setParameters(), setSpatialMatrix(), wolbachia_model_1(), and wolbachia_model_2().

Referenced by LCE_Breed_Wolbachia().

+ Here is the caller graph for this function:

◆ wolbachia_model_1()

void LCE_Breed_Wolbachia::wolbachia_model_1 ( )
284 {
285  Patch* current_patch;
286  unsigned int indexOfMother, nbBaby;
287  Individual* FatherPtr;
288  Individual* MotherPtr;
289  Individual* NewOffsprg;
290 
291  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
292 
293  current_patch = _popPtr->getPatch(i);
294 
295  if(current_patch->size(FEM, ADLTx) == 0 || current_patch->size(MAL, ADLTx) == 0) continue;
296 
297  for(indexOfMother = 0; indexOfMother < current_patch->size(FEM, ADLTx); indexOfMother++) {
298 
299  MotherPtr = current_patch->get(FEM, ADLTx, indexOfMother);
300 
301  if(*(bool*)MotherPtr->getTraitValue(_LCELinkedTraitIndex))
302  nbBaby = (unsigned int)MotherPtr->setFecundity( getFecundity( _infected_fec ) );
303  else
304  nbBaby = (unsigned int)MotherPtr->setFecundity( getFecundity(i) );
305  //-----------------------------------------------------------------------
306  while(nbBaby != 0) {
307 
308  FatherPtr = getFatherPtr(current_patch, MotherPtr, indexOfMother);
309 
310  NewOffsprg = _popPtr->makeOffsprg(MotherPtr,FatherPtr,(sex_t)RAND::RandBool(),i);
311 
312  if(!(*(bool*)NewOffsprg->getTraitValue(_LCELinkedTraitIndex)) &&
313  *(bool*)FatherPtr->getTraitValue(_LCELinkedTraitIndex)) {
314  if(RAND::Uniform() < _incomp_cost) {
315  _popPtr->recycle(NewOffsprg);
316  } else
317  current_patch->add( NewOffsprg->getSex(), OFFSx, NewOffsprg );
318  } else
319  current_patch->add( NewOffsprg->getSex(), OFFSx, NewOffsprg );
320 
321  nbBaby--;
322  }//_END_WHILE nbBaby
323  }//end_for indexOfMother
324  }//end_for patch
325 }
void recycle(Individual *ind)
Put an individual in the recycling pool.
Definition: indfactory.h:61
Individual * makeOffsprg(Individual *mother, Individual *father, sex_t sex, unsigned short homepatch)
Completely creates an individual with inheritance and mutations on all traits.
Definition: indfactory.cc:233
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:48
double setFecundity(double value)
Sets the fecundity to the value given and returns it.
Definition: individual.h:206
sex_t getSex()
Definition: individual.h:128
virtual Individual * getFatherPtr(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Calls the mating function according to the model chosen using the function pointer,...
Definition: LCEbreed.h:81
double getFecundity(unsigned int patch)
Definition: LCEbreed.h:111
void add(sex_t SEX, age_idx AGE, Individual *ind)
Adds an individual to the appropriate container, increments its size, eventually resizing it.
Definition: metapop.h:550
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:126
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:164
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:35

References _incomp_cost, _infected_fec, LifeCycleEvent::_LCELinkedTraitIndex, LifeCycleEvent::_popPtr, Patch::add(), ADLTx, FEM, Patch::get(), LCE_Breed_base::getFatherPtr(), LCE_Breed_base::getFecundity(), Metapop::getPatch(), Metapop::getPatchNbr(), Individual::getSex(), Individual::getTraitValue(), IndFactory::makeOffsprg(), MAL, OFFSx, RAND::RandBool(), IndFactory::recycle(), Individual::setFecundity(), Patch::size(), and RAND::Uniform().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ wolbachia_model_2()

void LCE_Breed_Wolbachia::wolbachia_model_2 ( )
330 {
331  Patch* current_patch;
332  unsigned int indexOfMother, nbBaby;
333  double fec;
334  Individual* FatherPtr;
335  Individual* MotherPtr;
336  Individual* NewOffsprg;
337 
338  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
339 
340  current_patch = _popPtr->getPatch(i);
341 
342  if(current_patch->size(FEM, ADLTx) == 0 || current_patch->size(MAL, ADLTx) == 0) continue;
343 
344  for(indexOfMother = 0; indexOfMother < current_patch->size(FEM, ADLTx); indexOfMother++) {
345 
346  MotherPtr = current_patch->get(FEM, ADLTx, indexOfMother);
347 
348  FatherPtr = getFatherPtr(current_patch, MotherPtr, indexOfMother);
349 
350  if(*(bool*)MotherPtr->getTraitValue(_LCELinkedTraitIndex)) {
351  if(*(bool*)FatherPtr->getTraitValue(_LCELinkedTraitIndex))
352  fec = _infected_fec * (1 - _incomp_cost);
353  else
354  fec = _infected_fec;
355  } else if (*(bool*)FatherPtr->getTraitValue(_LCELinkedTraitIndex)) {
356  fec = getMeanFecundity(i) * (1 - _incomp_cost);
357  } else {
358  fec = getMeanFecundity(i);
359  }
360 
361  nbBaby = (unsigned int)MotherPtr->setFecundity( getFecundity( fec ) );
362 
363  //-----------------------------------------------------------------------
364  for(;nbBaby != 0;nbBaby--) {
365 
366  NewOffsprg = _popPtr->makeOffsprg(MotherPtr,FatherPtr,(sex_t)RAND::RandBool(),i);
367 
368  current_patch->add( NewOffsprg->getSex(), OFFSx, NewOffsprg );
369 
370  }//end_for nbBaby
371  }//end_for indexOfMother
372  }//end_for patch
373 }

References _incomp_cost, _infected_fec, LifeCycleEvent::_LCELinkedTraitIndex, LifeCycleEvent::_popPtr, Patch::add(), ADLTx, FEM, Patch::get(), LCE_Breed_base::getFatherPtr(), LCE_Breed_base::getFecundity(), LCE_Breed_base::getMeanFecundity(), Metapop::getPatch(), Metapop::getPatchNbr(), Individual::getSex(), Individual::getTraitValue(), IndFactory::makeOffsprg(), MAL, OFFSx, RAND::RandBool(), Individual::setFecundity(), and Patch::size().

Referenced by setParameters().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _breed_func_ptr

void(LCE_Breed_Wolbachia::* LCE_Breed_Wolbachia::_breed_func_ptr) ()
private

Referenced by execute(), and setParameters().

◆ _fec_cost

double LCE_Breed_Wolbachia::_fec_cost
private

Referenced by setParameters().

◆ _incomp_cost

double LCE_Breed_Wolbachia::_incomp_cost
private

◆ _infected_fec

double LCE_Breed_Wolbachia::_infected_fec
private

◆ _inoculum_size

TMatrix* LCE_Breed_Wolbachia::_inoculum_size
private

◆ _inoculum_time

unsigned int LCE_Breed_Wolbachia::_inoculum_time
private

Referenced by execute(), and setParameters().

◆ _model

unsigned int LCE_Breed_Wolbachia::_model
private

Referenced by setParameters().

◆ _writer

TTWolbachiaFH* LCE_Breed_Wolbachia::_writer
private

The documentation for this class was generated from the following files:

Generated for Nemo v2.4.0 by  doxygen 1.9.1 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR