Nemo  2.4.2
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 ( )
168  : LifeCycleEvent("breed_wolbachia",WOLB),
170 _writer(0)
171 {
174  add_parameter("wolbachia_fecundity_cost",DBL,true,true,-1,1, updater);
175  add_parameter("wolbachia_incompatibility_cost",DBL,true,true,-1,1, updater);
176  add_parameter("wolbachia_inoculum_size",MAT,true,false,0,0, updater);
177  add_parameter("wolbachia_inoculum_time",INT,true,false,0,0, updater);
178  add_parameter("wolbachia_model",INT,false,true,1,2, updater);
179  add_parameter("wolbachia_output_dir", STR, false, false, 0, 0);
180 }
double _fec_cost
Definition: ttwolbachia.h:207
TTWolbachiaFH * _writer
Definition: ttwolbachia.h:215
TMatrix * _inoculum_size
Definition: ttwolbachia.h:209
double _incomp_cost
Definition: ttwolbachia.h:206
virtual bool setParameters()
Definition: ttwolbachia.cc:189
double _infected_fec
Definition: ttwolbachia.h:208
unsigned int _inoculum_time
Definition: ttwolbachia.h:210
LifeCycleEvent(const char *name, const char *trait_link)
Cstor.
Definition: lifecycleevent.h:96
Implementation of the ParamUpdaterBase interface.
Definition: param.h:371
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:110
#define WOLB
Definition: types.h:71
@ DBL
Definition: types.h:76
@ MAT
Definition: types.h:76
@ STR
Definition: types.h:76
@ INT
Definition: types.h:76

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
183 {
184  if(_writer) delete _writer;
185 }

References _writer.

Member Function Documentation

◆ addAgeClass()

virtual age_t LCE_Breed_Wolbachia::addAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

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

References OFFSPRG.

◆ clone()

virtual LifeCycleEvent* LCE_Breed_Wolbachia::clone ( )
inlinevirtual

Implements LifeCycleEvent.

233  { return new LCE_Breed_Wolbachia(); }
LCE_Breed_Wolbachia()
Definition: ttwolbachia.cc:168

References LCE_Breed_Wolbachia().

◆ execute()

void LCE_Breed_Wolbachia::execute ( )
virtual

Implements LifeCycleEvent.

246 {
247 
248 #ifdef _DEBUG_
249  message("LCE_Breed_Wolbachia::execute\n");
250 #endif
251  double infection_status;
252 
255 
257 
258  infection_status = hasInfectedFemale();
259 
260  if( infection_status == 0 || infection_status == 1) {
262  _popPtr->reset();
263  return;
264  }}
265 
266 
267  if(_popPtr->size(OFFSPRG) != 0) {
268  warning("offspring containers not empty at time of breeding, flushing.\n");
269  _popPtr->flush(OFFSx);
270  }
271 
272  (this->*_breed_func_ptr)();
273 
276  }
277 
278 }
void inoculate_wolbachia()
Definition: ttwolbachia.cc:376
double hasInfectedFemale()
Definition: ttwolbachia.cc:402
void(LCE_Breed_Wolbachia::* _breed_func_ptr)()
Definition: ttwolbachia.h:213
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:79
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together.
Definition: metapop.h:310
unsigned int getCurrentReplicate()
Definition: metapop.h:293
void reset()
Called to empty the patches, individuals are move to the garbage collector.
Definition: metapop.cc:1178
unsigned int getCurrentGeneration()
Definition: metapop.h:294
void flush()
Removes all individual pointers and flush them into the recycling pool.
Definition: metapop.h:847
static unsigned int getGenerations()
Definition: simenv.h:59
void record(unsigned int repl, unsigned int gen, double infection)
Definition: ttwolbachia.cc:425
void warning(const char *str,...)
Definition: output.cc:56
void message(const char *message,...)
Definition: output.cc:38
@ OFFSx
Definition: types.h:40

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
403 {
404  double indNbr = 0, mean = 0, size;
405  Patch* crnt_patch;
406 
407  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); ++i) {
408  crnt_patch = _popPtr->getPatch(i);
409  size = crnt_patch->size(FEM, ADLTx);
410  indNbr += size;
411  for(unsigned int j = 0; j < size; ++j)
412  mean += (double)*(bool*)crnt_patch->get(FEM, ADLTx, j)->getTraitValue(_LCELinkedTraitIndex);
413  }
414 
415  return (indNbr != 0 ? mean/indNbr : nanf("NULL"));
416 }
void * getTraitValue(IDX T)
Accessor to the value (phenotype) of a particular trait.
Definition: individual.h:269
int _LCELinkedTraitIndex
The index in the individual's trait table of the linked trait.
Definition: lifecycleevent.h:87
unsigned int getPatchNbr()
Definition: metapop.h:274
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:255
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:430
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:496
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:532
@ FEM
Definition: types.h:35
@ ADLTx
Definition: types.h:40

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

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.

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

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.

237 {}

◆ removeAgeClass()

virtual age_t LCE_Breed_Wolbachia::removeAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

239 {return 0;}

◆ requiredAgeClass()

virtual age_t LCE_Breed_Wolbachia::requiredAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

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

References ADULTS.

◆ resetParameterFromSource()

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

Implements SimComponent.

238 {return false;}

◆ setParameters()

bool LCE_Breed_Wolbachia::setParameters ( )
virtual

Reimplemented from LCE_Breed_base.

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

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 ( )
283 {
284  Patch* current_patch;
285  unsigned int indexOfMother, nbBaby;
286  Individual* FatherPtr;
287  Individual* MotherPtr;
288  Individual* NewOffsprg;
289 
290  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
291 
292  current_patch = _popPtr->getPatch(i);
293 
294  if(current_patch->size(FEM, ADLTx) == 0 || current_patch->size(MAL, ADLTx) == 0) continue;
295 
296  for(indexOfMother = 0; indexOfMother < current_patch->size(FEM, ADLTx); indexOfMother++) {
297 
298  MotherPtr = current_patch->get(FEM, ADLTx, indexOfMother);
299 
300  if(*(bool*)MotherPtr->getTraitValue(_LCELinkedTraitIndex))
301  nbBaby = (unsigned int)MotherPtr->setFecundity( getFecundity( _infected_fec ) );
302  else
303  nbBaby = (unsigned int)MotherPtr->setFecundity( getFecundity(i) );
304  //-----------------------------------------------------------------------
305  while(nbBaby != 0) {
306 
307  FatherPtr = getFatherPtr(current_patch, MotherPtr, indexOfMother);
308 
309  NewOffsprg = _popPtr->makeOffsprg(MotherPtr,FatherPtr,(sex_t)RAND::RandBool(),i);
310 
311  if(!(*(bool*)NewOffsprg->getTraitValue(_LCELinkedTraitIndex)) &&
312  *(bool*)FatherPtr->getTraitValue(_LCELinkedTraitIndex)) {
313  if(RAND::Uniform() < _incomp_cost) {
314  _popPtr->recycle(NewOffsprg);
315  } else
316  current_patch->add( NewOffsprg->getSex(), OFFSx, NewOffsprg );
317  } else
318  current_patch->add( NewOffsprg->getSex(), OFFSx, NewOffsprg );
319 
320  nbBaby--;
321  }//_END_WHILE nbBaby
322  }//end_for indexOfMother
323  }//end_for patch
324 }
void recycle(Individual *ind)
Put an individual in the recycling pool.
Definition: indfactory.h:60
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:232
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:47
double setFecundity(double value)
Sets the fecundity to the value given and returns it.
Definition: individual.h:205
sex_t getSex()
Definition: individual.h:127
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:80
double getFecundity(unsigned int patch)
Definition: LCEbreed.h:110
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:549
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:125
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:170
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:34

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

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.2 by  doxygen 1.9.1

Catalogued on GSR