Nemo  2.3.46
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 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...
 
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...
 
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 getFecundity (unsigned int patch)
 
double getFecundity (double mean)
 
sex_t getOffsprgSex ()
 
sex_t getOffsprgSexRandom ()
 
sex_t getOffsprgSexFixed ()
 
sex_t getOffsprgSexSelfing ()
 
sex_t getOffsprgSexCloning ()
 
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...
 

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
 
- 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 ( )

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

Referenced by clone().

170  : LifeCycleEvent("breed_wolbachia",WOLB),
172 _writer(0)
173 {
176  add_parameter("wolbachia_fecundity_cost",DBL,true,true,-1,1, updater);
177  add_parameter("wolbachia_incompatibility_cost",DBL,true,true,-1,1, updater);
178  add_parameter("wolbachia_inoculum_size",MAT,true,false,0,0, updater);
179  add_parameter("wolbachia_inoculum_time",INT,true,false,0,0, updater);
180  add_parameter("wolbachia_model",INT,false,true,1,2, updater);
181  add_parameter("wolbachia_output_dir", STR, false, false, 0, 0);
182 }
double _incomp_cost
Definition: ttwolbachia.h:192
Implementation of the ParamUpdaterBase interface.
Definition: param.h:348
LifeCycleEvent(const char *name, const char *trait_link)
Cstor.
Definition: lifecycleevent.h:98
TTWolbachiaFH * _writer
Definition: ttwolbachia.h:201
Definition: types.h:78
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:112
double _fec_cost
Definition: ttwolbachia.h:193
Definition: types.h:78
double _infected_fec
Definition: ttwolbachia.h:194
unsigned int _inoculum_time
Definition: ttwolbachia.h:196
#define WOLB
Definition: types.h:73
virtual bool setParameters()
Definition: ttwolbachia.cc:191
Definition: types.h:78
TMatrix * _inoculum_size
Definition: ttwolbachia.h:195
Definition: types.h:78
LCE_Breed_Wolbachia::~LCE_Breed_Wolbachia ( )
virtual

References _writer.

185 {
186  if(_writer) delete _writer;
187 }
TTWolbachiaFH * _writer
Definition: ttwolbachia.h:201

Member Function Documentation

virtual age_t LCE_Breed_Wolbachia::addAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

References OFFSPRG.

225 {return OFFSPRG;}
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
virtual LifeCycleEvent* LCE_Breed_Wolbachia::clone ( )
inlinevirtual

Implements LifeCycleEvent.

References LCE_Breed_Wolbachia().

219  { return new LCE_Breed_Wolbachia(); }
LCE_Breed_Wolbachia()
Definition: ttwolbachia.cc:170
void LCE_Breed_Wolbachia::execute ( )
virtual

Implements LifeCycleEvent.

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().

248 {
249 
250 #ifdef _DEBUG_
251  message("LCE_Breed_Wolbachia::execute\n");
252 #endif
253  double infection_status;
254 
257 
259 
260  infection_status = hasInfectedFemale();
261 
262  if( infection_status == 0 || infection_status == 1) {
264  _popPtr->reset();
265  return;
266  }}
267 
268 
269  if(_popPtr->size(OFFSPRG) != 0) {
270  warning("offspring containers not empty at time of breeding, flushing.\n");
271  _popPtr->flush(OFFSx);
272  }
273 
274  (this->*_breed_func_ptr)();
275 
278  }
279 
280 }
void inoculate_wolbachia()
Definition: ttwolbachia.cc:378
void message(const char *message,...)
Definition: output.cc:40
unsigned int getCurrentGeneration()
Definition: metapop.h:286
TTWolbachiaFH * _writer
Definition: ttwolbachia.h:201
unsigned int getCurrentReplicate()
Definition: metapop.h:285
double hasInfectedFemale()
Definition: ttwolbachia.cc:404
unsigned int _inoculum_time
Definition: ttwolbachia.h:196
void warning(const char *str,...)
Definition: output.cc:56
void flush()
Removes all individual pointers and flush them into the recycling pool.
Definition: metapop.h:796
Definition: types.h:42
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
void(LCE_Breed_Wolbachia::* _breed_func_ptr)()
Definition: ttwolbachia.h:199
void reset()
Called to empty the patches, individuals are move to the garbage collector.
Definition: metapop.cc:1004
static unsigned int getGenerations()
Definition: simenv.h:61
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
void record(unsigned int repl, unsigned int gen, double infection)
Definition: ttwolbachia.cc:427
double LCE_Breed_Wolbachia::hasInfectedFemale ( )
private

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

Referenced by execute().

405 {
406  double indNbr = 0, mean = 0, size;
407  Patch* crnt_patch;
408 
409  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); ++i) {
410  crnt_patch = _popPtr->getPatch(i);
411  size = crnt_patch->size(FEM, ADLTx);
412  indNbr += size;
413  for(unsigned int j = 0; j < size; ++j)
414  mean += (double)*(bool*)crnt_patch->get(FEM, ADLTx, j)->getTraitValue(_LCELinkedTraitIndex);
415  }
416 
417  return (indNbr != 0 ? mean/indNbr : nanf("NULL"));
418 }
void * getTraitValue(IDX T)
Accessor to the value (phenotype) of a particular trait.
Definition: individual.h:271
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
Definition: types.h:42
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:523
int _LCELinkedTraitIndex
The index in the individual's trait table of the linked trait.
Definition: lifecycleevent.h:89
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
Definition: types.h:37
void LCE_Breed_Wolbachia::inoculate_wolbachia ( )
private

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

Referenced by execute().

379 {
380  Patch* current_patch;
381  bool T = 1;
382 
383  for (unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
384 
385  current_patch = _popPtr->getPatch(i);
386 
387  if(current_patch->get_isExtinct()) continue;
388 
389  for (unsigned int j = 0;
390  j < _inoculum_size->get(i, 0) && j < current_patch->size(FEM, ADLTx); j++) {
391  current_patch->get(FEM, ADLTx, j)->setTrait(_LCELinkedTraitIndex, &T);
392  }
393 
394  for (unsigned int j = 0;
395  j < _inoculum_size->get(i, 1) && j < current_patch->size(MAL, ADLTx); j++) {
396  current_patch->get(MAL, ADLTx, j)->setTrait(_LCELinkedTraitIndex, &T);
397  }
398  }
399 // if(!ok) fatal("could not inoculate wolbachia, check the inoculum size!\n");
400 }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
void * setTrait(IDX T, void *value)
Sets the phenotype/value of a trait to a particular value.
Definition: individual.h:256
double get(unsigned int i, unsigned int j)
Accessor to element at row i and column j.
Definition: tmatrix.h:120
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
bool get_isExtinct()
Definition: metapop.h:475
unsigned int getPatchNbr()
Definition: metapop.h:270
Definition: types.h:42
Definition: types.h:37
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:523
int _LCELinkedTraitIndex
The index in the individual's trait table of the linked trait.
Definition: lifecycleevent.h:89
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
Definition: types.h:37
TMatrix * _inoculum_size
Definition: ttwolbachia.h:195
void LCE_Breed_Wolbachia::loadFileServices ( FileServices loader)
virtual

Implements SimComponent.

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

234 {
235  if(_writer != NULL) delete _writer;
236 
237  _writer = new TTWolbachiaFH(this);
238 
240  get_parameter("wolbachia_output_dir")->getArg(), this);
241 
242  loader->attach(_writer);
243 }
static unsigned int getReplicates()
Definition: simenv.h:63
virtual void attach(Handler *FH)
Attaches the FileHandler to the current list (_writers) of the FileServices.
Definition: fileservices.cc:57
TTWolbachiaFH * _writer
Definition: ttwolbachia.h:201
virtual void set(bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path, LCE *event)
Definition: filehandler.h:265
FileHandler of the Wolbachia trait.
Definition: ttwolbachia.h:238
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
static unsigned int getGenerations()
Definition: simenv.h:61
virtual void LCE_Breed_Wolbachia::loadStatServices ( StatServices loader)
inlinevirtual

Implements SimComponent.

223 {}
virtual age_t LCE_Breed_Wolbachia::removeAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

224 {return 0;}
virtual age_t LCE_Breed_Wolbachia::requiredAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

References ADULTS.

226 {return ADULTS;}
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
bool LCE_Breed_Wolbachia::setParameters ( )
virtual

Reimplemented from LCE_Breed_base.

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(), Param::isSet(), TMatrix::ncols(), TMatrix::nrows(), LCE_Breed_base::setParameters(), setSpatialMatrix(), wolbachia_model_1(), and wolbachia_model_2().

Referenced by LCE_Breed_Wolbachia().

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

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().

285 {
286  Patch* current_patch;
287  unsigned int indexOfMother, nbBaby;
288  Individual* FatherPtr;
289  Individual* MotherPtr;
290  Individual* NewOffsprg;
291 
292  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
293 
294  current_patch = _popPtr->getPatch(i);
295 
296  if(current_patch->size(FEM, ADLTx) == 0 || current_patch->size(MAL, ADLTx) == 0) continue;
297 
298  for(indexOfMother = 0; indexOfMother < current_patch->size(FEM, ADLTx); indexOfMother++) {
299 
300  MotherPtr = current_patch->get(FEM, ADLTx, indexOfMother);
301 
302  if(*(bool*)MotherPtr->getTraitValue(_LCELinkedTraitIndex))
303  nbBaby = (unsigned int)MotherPtr->setFecundity( getFecundity( _infected_fec ) );
304  else
305  nbBaby = (unsigned int)MotherPtr->setFecundity( getFecundity(i) );
306  //-----------------------------------------------------------------------
307  while(nbBaby != 0) {
308 
309  FatherPtr = getFatherPtr(current_patch, MotherPtr, indexOfMother);
310 
311  NewOffsprg = _popPtr->makeOffsprg(MotherPtr,FatherPtr,(sex_t)RAND::RandBool(),i);
312 
313  if(!(*(bool*)NewOffsprg->getTraitValue(_LCELinkedTraitIndex)) &&
314  *(bool*)FatherPtr->getTraitValue(_LCELinkedTraitIndex)) {
315  if(RAND::Uniform() < _incomp_cost) {
316  _popPtr->recycle(NewOffsprg);
317  } else
318  current_patch->add( NewOffsprg->getSex(), OFFSx, NewOffsprg );
319  } else
320  current_patch->add( NewOffsprg->getSex(), OFFSx, NewOffsprg );
321 
322  nbBaby--;
323  }//_END_WHILE nbBaby
324  }//end_for indexOfMother
325  }//end_for patch
326 }
void recycle(Individual *ind)
Put an individual in the recycling pool.
Definition: indfactory.h:62
double _incomp_cost
Definition: ttwolbachia.h:192
void * getTraitValue(IDX T)
Accessor to the value (phenotype) of a particular trait.
Definition: individual.h:271
double getFecundity(unsigned int patch)
Definition: LCEbreed.h:102
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:184
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
virtual Individual * getFatherPtr(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.
Definition: LCEbreed.h:75
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
double _infected_fec
Definition: ttwolbachia.h:194
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36
Definition: types.h:42
double setFecundity(double value)
Sets the fecundity to the value given and returns it.
Definition: individual.h:207
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
Definition: types.h:37
Definition: types.h:42
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:523
int _LCELinkedTraitIndex
The index in the individual's trait table of the linked trait.
Definition: lifecycleevent.h:89
sex_t getSex()
Definition: individual.h:129
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:139
This class contains traits along with other individual information (sex, pedigree, etc. ).
Definition: individual.h:49
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:540
Definition: types.h:37
void LCE_Breed_Wolbachia::wolbachia_model_2 ( )

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().

331 {
332  Patch* current_patch;
333  unsigned int indexOfMother, nbBaby;
334  double fec;
335  Individual* FatherPtr;
336  Individual* MotherPtr;
337  Individual* NewOffsprg;
338 
339  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
340 
341  current_patch = _popPtr->getPatch(i);
342 
343  if(current_patch->size(FEM, ADLTx) == 0 || current_patch->size(MAL, ADLTx) == 0) continue;
344 
345  for(indexOfMother = 0; indexOfMother < current_patch->size(FEM, ADLTx); indexOfMother++) {
346 
347  MotherPtr = current_patch->get(FEM, ADLTx, indexOfMother);
348 
349  FatherPtr = getFatherPtr(current_patch, MotherPtr, indexOfMother);
350 
351  if(*(bool*)MotherPtr->getTraitValue(_LCELinkedTraitIndex)) {
352  if(*(bool*)FatherPtr->getTraitValue(_LCELinkedTraitIndex))
353  fec = _infected_fec * (1 - _incomp_cost);
354  else
355  fec = _infected_fec;
356  } else if (*(bool*)FatherPtr->getTraitValue(_LCELinkedTraitIndex)) {
357  fec = getMeanFecundity(i) * (1 - _incomp_cost);
358  } else {
359  fec = getMeanFecundity(i);
360  }
361 
362  nbBaby = (unsigned int)MotherPtr->setFecundity( getFecundity( fec ) );
363 
364  //-----------------------------------------------------------------------
365  for(;nbBaby != 0;nbBaby--) {
366 
367  NewOffsprg = _popPtr->makeOffsprg(MotherPtr,FatherPtr,(sex_t)RAND::RandBool(),i);
368 
369  current_patch->add( NewOffsprg->getSex(), OFFSx, NewOffsprg );
370 
371  }//end_for nbBaby
372  }//end_for indexOfMother
373  }//end_for patch
374 }
double _incomp_cost
Definition: ttwolbachia.h:192
void * getTraitValue(IDX T)
Accessor to the value (phenotype) of a particular trait.
Definition: individual.h:271
double getFecundity(unsigned int patch)
Definition: LCEbreed.h:102
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:184
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
virtual Individual * getFatherPtr(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.
Definition: LCEbreed.h:75
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
double _infected_fec
Definition: ttwolbachia.h:194
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36
Definition: types.h:42
double getMeanFecundity(unsigned int patch)
Definition: LCEbreed.h:94
double setFecundity(double value)
Sets the fecundity to the value given and returns it.
Definition: individual.h:207
Definition: types.h:37
Definition: types.h:42
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:523
int _LCELinkedTraitIndex
The index in the individual's trait table of the linked trait.
Definition: lifecycleevent.h:89
sex_t getSex()
Definition: individual.h:129
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:139
This class contains traits along with other individual information (sex, pedigree, etc. ).
Definition: individual.h:49
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:540
Definition: types.h:37

Member Data Documentation

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

Referenced by execute(), and setParameters().

double LCE_Breed_Wolbachia::_fec_cost
private

Referenced by setParameters().

double LCE_Breed_Wolbachia::_incomp_cost
private
double LCE_Breed_Wolbachia::_infected_fec
private
TMatrix* LCE_Breed_Wolbachia::_inoculum_size
private
unsigned int LCE_Breed_Wolbachia::_inoculum_time
private

Referenced by execute(), and setParameters().

unsigned int LCE_Breed_Wolbachia::_model
private

Referenced by setParameters().

TTWolbachiaFH* LCE_Breed_Wolbachia::_writer
private

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

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR