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

The StatHandler for TTDeletMutations_bitstring. More...

#include <ttdeletmutations_bitstring.h>

+ Inheritance diagram for TTDeletMutBitstrSH:
+ Collaboration diagram for TTDeletMutBitstrSH:

Public Member Functions

 TTDeletMutBitstrSH (TProtoDeletMutations_bitstring *TP)
 
virtual ~TTDeletMutBitstrSH ()
 
virtual bool setStatRecorders (std::string &token)
 
void setStatsForDeletMutations (age_t AGE)
 
void setViabStats (age_t AGE)
 
void setDeletStats (age_t AGE)
 
void setLethalEquivalents (age_t AGE)
 
void setFst (age_t AGE)
 
void setAdultDeletStats ()
 
void setOffsprgDeletStats ()
 
void setViability (age_idx agex)
 
void setAdultViab ()
 
void setOffsprgViab ()
 
void setMeanViability (age_idx agex)
 
double getMeanFecWithPatchMate (bool HOME)
 
double getBtheta ()
 
double getBalpha ()
 
double getHeterosis ()
 
double getLoad ()
 
double getPatchLoad (unsigned int i)
 
double getDeletAllFreq ()
 
double getDeletAllHmz ()
 
double getDeletAllHtz ()
 
double getFixedDeletLoci ()
 
double getFixedDeletLociPerPatch ()
 
double getSegregatingDeletLoci ()
 
double getSegregatingDeletLociPerPatch ()
 
double getDeletAllPerGenome ()
 
double getHs ()
 
double getHt ()
 
double getFst ()
 
double getLethalEquivalents ()
 
double getAdultsLetheq ()
 
double getOffsprgLetheq ()
 
double getViability (unsigned int v)
 
double getMeanViability ()
 
double getMeanViability (unsigned int a)
 
double getSibProportions (unsigned int i)
 
- Public Member Functions inherited from TraitStatHandler< TProtoDeletMutations_bitstring, TTDeletMutBitstrSH >
 TraitStatHandler (TProtoDeletMutations_bitstring *trait_proto)
 
virtual ~TraitStatHandler ()
 
- Public Member Functions inherited from StatHandler< SH >
 StatHandler ()
 
virtual ~StatHandler ()
 
virtual void clear ()
 Empties the _recorders list, they are destroyed in StatHandlerBase::reset(). More...
 
virtual StatRecorder< SH > * add (std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(SH::*getStatNoArg)(void), double(SH::*getStatOneArg)(unsigned int), double(SH::*getStatTwoArg)(unsigned int, unsigned int), void(SH::*setStat)(void))
 Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list. More...
 
- Public Member Functions inherited from StatHandlerBase
 StatHandlerBase ()
 
virtual ~StatHandlerBase ()
 
virtual void reset ()
 Empties the _stats list and calls clear() (defined in the derived class). More...
 
Metapopget_pop_ptr ()
 
void set_service (StatServices *srv)
 
StatServicesget_service ()
 
unsigned int getOccurrence ()
 
unsigned int getNumOccurrences ()
 
unsigned int getCurrentOccurrence ()
 
unsigned int getNbRecorders ()
 
std::list< StatRecBase * > & getStats ()
 
virtual void add (StatRecBase *rec)
 
virtual void init ()
 
virtual void update ()
 This function is left empty as the StatServices calls StatRecorder::setVal directly. More...
 
- Public Member Functions inherited from Handler
virtual ~Handler ()
 

Private Attributes

double fecWithHomePatchMate
 
double fecWithOtherPatchMate
 
double _SibProps [5]
 
double _viability [5]
 
double _meanViab
 
double _deletHtzLoci
 
double _deletHmzLoci
 
double _fixLocPerPatch
 
double _segrLocPerPatch
 
double _Ho
 
double _Hs
 
double _Ht
 
double _Fst
 
double _Hmz
 
double _deletAllCount
 
double _freq
 
double _fixloc
 
double _segrloc
 
double _letheq
 
double * _deletFreqTable
 
bool _isContinuousEffect
 

Additional Inherited Members

- Protected Types inherited from StatHandler< SH >
typedef std::list< StatRecorder< SH > * >::iterator REC_IT
 
- Protected Attributes inherited from TraitStatHandler< TProtoDeletMutations_bitstring, TTDeletMutBitstrSH >
TProtoDeletMutations_bitstring_SHLinkedTrait
 Pointer to a TraitProtoype object. More...
 
int _SHLinkedTraitIndex
 Index of the trait in the Individual::Traits table. More...
 
- Protected Attributes inherited from StatHandler< SH >
std::list< StatRecorder< SH > * > _recorders
 The list of stat recorders. More...
 
- Protected Attributes inherited from StatHandlerBase
Metapop_pop
 Link to the current population, set through the link to the StatService. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ TTDeletMutBitstrSH()

TTDeletMutBitstrSH::TTDeletMutBitstrSH ( TProtoDeletMutations_bitstring TP)
inline
bool get_iscontinuous()
Definition: ttdeletmutations_bitstring.h:185
bool _isContinuousEffect
Definition: ttdeletmutations_bitstring.h:286
double * _deletFreqTable
Definition: ttdeletmutations_bitstring.h:284

References _isContinuousEffect, and TProtoDeletMutations_bitstring::get_iscontinuous().

◆ ~TTDeletMutBitstrSH()

virtual TTDeletMutBitstrSH::~TTDeletMutBitstrSH ( )
inlinevirtual
294 {if(_deletFreqTable != 0) delete [] _deletFreqTable;}

References _deletFreqTable.

Member Function Documentation

◆ getAdultsLetheq()

double TTDeletMutBitstrSH::getAdultsLetheq ( )
inline
329 {setDeletStats(ADULTS); return _letheq;}
double _letheq
Definition: ttdeletmutations_bitstring.h:282
void setDeletStats(age_t AGE)
Definition: stats_delet_bitstring.cc:211
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54

References _letheq, ADULTS, and setDeletStats().

◆ getBalpha()

double TTDeletMutBitstrSH::getBalpha ( )
inline
313 {return fecWithOtherPatchMate;}
double fecWithOtherPatchMate
Definition: ttdeletmutations_bitstring.h:274

References fecWithOtherPatchMate.

◆ getBtheta()

double TTDeletMutBitstrSH::getBtheta ( )
inline
312 {return fecWithHomePatchMate;}
double fecWithHomePatchMate
Definition: ttdeletmutations_bitstring.h:274

References fecWithHomePatchMate.

◆ getDeletAllFreq()

double TTDeletMutBitstrSH::getDeletAllFreq ( )
inline
317 {return _freq;}
double _freq
Definition: ttdeletmutations_bitstring.h:282

References _freq.

Referenced by setStatsForDeletMutations().

◆ getDeletAllHmz()

double TTDeletMutBitstrSH::getDeletAllHmz ( )
inline
318 {return _Hmz;}
double _Hmz
Definition: ttdeletmutations_bitstring.h:282

References _Hmz.

Referenced by setStatsForDeletMutations().

◆ getDeletAllHtz()

double TTDeletMutBitstrSH::getDeletAllHtz ( )
inline
319 {return _Ho;}
double _Ho
Definition: ttdeletmutations_bitstring.h:282

References _Ho.

Referenced by setStatsForDeletMutations().

◆ getDeletAllPerGenome()

double TTDeletMutBitstrSH::getDeletAllPerGenome ( )
inline
324 {return _deletAllCount;}
double _deletAllCount
Definition: ttdeletmutations_bitstring.h:282

References _deletAllCount.

◆ getFixedDeletLoci()

double TTDeletMutBitstrSH::getFixedDeletLoci ( )
inline
320 {return _fixloc;}
double _fixloc
Definition: ttdeletmutations_bitstring.h:282

References _fixloc.

Referenced by setStatsForDeletMutations().

◆ getFixedDeletLociPerPatch()

double TTDeletMutBitstrSH::getFixedDeletLociPerPatch ( )
inline
321 {return _fixLocPerPatch;}
double _fixLocPerPatch
Definition: ttdeletmutations_bitstring.h:281

References _fixLocPerPatch.

Referenced by setStatsForDeletMutations().

◆ getFst()

double TTDeletMutBitstrSH::getFst ( )
inline
327 {return _Fst;}
double _Fst
Definition: ttdeletmutations_bitstring.h:282

References _Fst.

Referenced by setStatsForDeletMutations().

◆ getHeterosis()

double TTDeletMutBitstrSH::getHeterosis ( )
73 {
74  double Btheta = getMeanFecWithPatchMate(true);
75  double Balpha = getMeanFecWithPatchMate(false);
76 
77  return (Balpha != 0 ? (1 - (Btheta/Balpha)): nanf("NULL"));
78 }
double getMeanFecWithPatchMate(bool HOME)
Definition: stats_delet_bitstring.cc:41

References getMeanFecWithPatchMate().

Referenced by setStatsForDeletMutations().

◆ getHs()

double TTDeletMutBitstrSH::getHs ( )
inline
325 {return _Hs;}
double _Hs
Definition: ttdeletmutations_bitstring.h:282

References _Hs.

◆ getHt()

double TTDeletMutBitstrSH::getHt ( )
inline
326 {return _Ht;}
double _Ht
Definition: ttdeletmutations_bitstring.h:282

References _Ht.

◆ getLethalEquivalents()

double TTDeletMutBitstrSH::getLethalEquivalents ( )
inline
328 {return _letheq;}

References _letheq.

Referenced by setStatsForDeletMutations().

◆ getLoad()

double TTDeletMutBitstrSH::getLoad ( )
166 {
167  unsigned int nb_patch=0;
168  double mean_load=0;
169 
170  for(unsigned int i = 0; i<_pop->getPatchNbr(); i++){
171 
172  if(_pop->getPatch(i)->size(FEM, ADLTx) != 0) {
173 
174  mean_load += getPatchLoad(i);
175 
176  nb_patch++;
177  }
178  }
179 
180  return (nb_patch != 0 ? mean_load/nb_patch : nanf("NULL"));
181 }
unsigned int getPatchNbr()
Definition: metapop.h:276
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:257
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:498
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double getPatchLoad(unsigned int i)
Definition: stats_delet_bitstring.cc:185
@ FEM
Definition: types.h:37
@ ADLTx
Definition: types.h:42

References StatHandlerBase::_pop, ADLTx, FEM, Metapop::getPatch(), getPatchLoad(), Metapop::getPatchNbr(), and Patch::size().

Referenced by setStatsForDeletMutations().

◆ getMeanFecWithPatchMate()

double TTDeletMutBitstrSH::getMeanFecWithPatchMate ( bool  HOME)
42 {
43  double m_fec = 0;
44  unsigned int nbfem = 0;
45  Patch* patch;
46  Individual* fem;
47 
48  if(HOME) {
49  for(unsigned int i = 0, pnb = _pop->getPatchNbr(); i < pnb; ++i) {
50  patch = _pop->getPatch(i);
51  for(unsigned int j = 0, size = patch->size(FEM, ADLTx); j < size; ++j) {
52  fem = patch->get(FEM, ADLTx, j);
53  m_fec += fem->getFecWithHomePatchMate();
54  nbfem += (fem->getLocalMatings() != 0);
55  }
56  }
57  } else {
58  for(unsigned int i = 0, pnb = _pop->getPatchNbr(); i < pnb; ++i) {
59  patch = _pop->getPatch(i);
60  for(unsigned int j = 0, size = _pop->getPatch(i)->size(FEM, ADLTx); j < size; ++j) {
61  fem = patch->get(FEM, ADLTx, j);
62  m_fec += fem->getFecWithOtherPatchMate();
63  nbfem += (fem->getMatings(0) != 0);
64  }
65  }
66  }
67  return (nbfem != 0 ? (double) m_fec/nbfem : 0.0);
68 }
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:49
double getFecWithHomePatchMate()
Returns the proportion of succesfull local matings (i.e.
Definition: individual.h:229
double getFecWithOtherPatchMate()
Returns the proportion of successfull remote matings.
Definition: individual.h:237
unsigned short getMatings(unsigned int cat)
Gives the number of matings that individual had with mates from a given pedigree class.
Definition: individual.h:142
unsigned short getLocalMatings()
Gives the number of times an individual mated with an individual from the same patch.
Definition: individual.h:147
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:432
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:534

References StatHandlerBase::_pop, ADLTx, FEM, Patch::get(), Individual::getFecWithHomePatchMate(), Individual::getFecWithOtherPatchMate(), Individual::getLocalMatings(), Individual::getMatings(), Metapop::getPatch(), Metapop::getPatchNbr(), and Patch::size().

Referenced by getHeterosis().

◆ getMeanViability() [1/2]

double TTDeletMutBitstrSH::getMeanViability ( )
inline
333 {return _meanViab;}
double _meanViab
Definition: ttdeletmutations_bitstring.h:276

References _meanViab.

Referenced by setStatRecorders(), and setViabStats().

◆ getMeanViability() [2/2]

double TTDeletMutBitstrSH::getMeanViability ( unsigned int  a)
inline
334 {setMeanViability(static_cast<age_idx> (a)); return _meanViab;}
void setMeanViability(age_idx agex)
Definition: stats_delet_bitstring.cc:139
age_idx
Array index of the age classes in the patch sizes and containers arrays.
Definition: types.h:41

References _meanViab, and setMeanViability().

◆ getOffsprgLetheq()

double TTDeletMutBitstrSH::getOffsprgLetheq ( )
inline
330 {setDeletStats(OFFSPRG); return _letheq;}
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50

References _letheq, OFFSPRG, and setDeletStats().

◆ getPatchLoad()

double TTDeletMutBitstrSH::getPatchLoad ( unsigned int  i)
186 {
187  Individual *ind;
188  double fec, matings;
189  double rel_fec, max_fec = 0, mean_patch_fec = 0;
190 
191  for(unsigned int j = 0, size = _pop->getPatch(i)->size(FEM, ADLTx); j < size; j++) {
192  ind = _pop->getPatch(i)->get(FEM, ADLTx, j);
193  fec = (double)ind->getTotRealizedFecundity();
194  matings = (double)ind->getTotMatings();
195  rel_fec = (matings != 0 ? fec/matings : 0.0);
196  mean_patch_fec += rel_fec;
197  if(rel_fec > max_fec) max_fec = rel_fec;
198  }
199 
200  mean_patch_fec /= _pop->getPatch(i)->size(FEM, ADLTx);
201 
202  return ( max_fec != 0 ? (max_fec - mean_patch_fec)/max_fec : nanf("NULL"));
203 }
unsigned int getTotMatings()
Gives the total number of matings of an individual.
Definition: individual.h:152
unsigned int getTotRealizedFecundity()
Gives the total number of surviving offspring for all categories of mating.
Definition: individual.h:176

References StatHandlerBase::_pop, ADLTx, FEM, Patch::get(), Metapop::getPatch(), Individual::getTotMatings(), Individual::getTotRealizedFecundity(), and Patch::size().

Referenced by getLoad().

◆ getSegregatingDeletLoci()

double TTDeletMutBitstrSH::getSegregatingDeletLoci ( )
inline
322 {return _segrloc;}
double _segrloc
Definition: ttdeletmutations_bitstring.h:282

References _segrloc.

Referenced by setStatsForDeletMutations().

◆ getSegregatingDeletLociPerPatch()

double TTDeletMutBitstrSH::getSegregatingDeletLociPerPatch ( )
inline
323 {return _segrLocPerPatch;}
double _segrLocPerPatch
Definition: ttdeletmutations_bitstring.h:281

References _segrLocPerPatch.

Referenced by setStatsForDeletMutations().

◆ getSibProportions()

double TTDeletMutBitstrSH::getSibProportions ( unsigned int  i)
inline
336 {return _SibProps[i];}
double _SibProps[5]
Definition: ttdeletmutations_bitstring.h:276

References _SibProps.

Referenced by setViabStats().

◆ getViability()

double TTDeletMutBitstrSH::getViability ( unsigned int  v)
inline
332 {return _viability[v];}
double _viability[5]
Definition: ttdeletmutations_bitstring.h:276

References _viability.

Referenced by setViabStats().

◆ setAdultDeletStats()

void TTDeletMutBitstrSH::setAdultDeletStats ( )
inline

References ADULTS, and setDeletStats().

Referenced by setStatsForDeletMutations().

◆ setAdultViab()

void TTDeletMutBitstrSH::setAdultViab ( )
inline
void setViability(age_idx agex)
Definition: stats_delet_bitstring.cc:86

References ADLTx, and setViability().

Referenced by setViabStats().

◆ setDeletStats()

void TTDeletMutBitstrSH::setDeletStats ( age_t  AGE)
212 {
213  unsigned int i, j, k, nb_ind = 0, nb_patch = 0;
214  unsigned int nb_locus = _SHLinkedTrait->get_nb_locus();
215  unsigned int psize=0;
217  Patch* current_patch;
218  age_idx agex = (AGE == ADULTS ? ADLTx : OFFSx);
219 
220  _deletHtzLoci = 0;
221  _deletHmzLoci = 0;
222  _deletAllCount = 0;
223  _Hs = 0;
224  _Ht = 0;
225  _fixLocPerPatch = 0;
226  _segrLocPerPatch = 0;
227 
228  if(_deletFreqTable != NULL)
229  delete [] _deletFreqTable;
230 
231  _deletFreqTable = new double [nb_locus];
232 
233  double patch_freqbylocus[nb_locus];
234 
235  for(i = 0; i < nb_locus; ++i)
236  _deletFreqTable[i] = 0;
237 
238 
239  for(i = 0; i < _pop->getPatchNbr(); ++i) {
240 
241  current_patch = _pop->getPatch(i);
242 
243  if( (psize = current_patch->size(AGE)) == 0) continue;
244 
245  nb_patch++;
246 
247  nb_ind += psize;
248 
249  for(j = 0; j < nb_locus; ++j)
250  patch_freqbylocus[j] = 0;
251 
252  //Females
253  for(j = 0; j < current_patch->size(FEM, agex); ++j) {
254 
255  trait = dynamic_cast< TTDeletMutations_bitstring* > ( current_patch->get( FEM, agex, j )->getTrait( _SHLinkedTraitIndex ) );
256 
258 
260 
261  for(k = 0; k < nb_locus; ++k)
262  patch_freqbylocus[k] += trait->get_nb_mut_atLocus(k);
263 
264  }//end for females
265 
266  //Males
267  for(j = 0; j < current_patch->size(MAL, agex); ++j) {
268 
269  trait = dynamic_cast< TTDeletMutations_bitstring* > ( current_patch->get( MAL, agex, j )->getTrait( _SHLinkedTraitIndex ) );
270 
272 
274 
275  for(k = 0; k < nb_locus; ++k)
276  patch_freqbylocus[k] += trait->get_nb_mut_atLocus(k);
277 
278  }//end for males
279 
280  double dipl_size = psize*2.0;
281  for(j = 0; j < nb_locus; ++j) {
282  //aggregate for the pop freq by locus:
283  _deletFreqTable[j] += patch_freqbylocus[j];
284  //aggregate mut nbr for the population tot mut nbr:
285  _deletAllCount += patch_freqbylocus[j];
286  //get the local Patch mut freq by locus:
287  patch_freqbylocus[j] /= dipl_size;
288  //compute the expected local htz = 2pq:
289  _Hs += patch_freqbylocus[j] * (1.0 - patch_freqbylocus[j]);
290  }
291 
292  for(j = 0; j < nb_locus; ++j) {
293  //segregating and fixed loci in the Patch:
294  if(patch_freqbylocus[j] == 1.0)
295  _fixLocPerPatch++;
296  else if(patch_freqbylocus[j] != 0)
298  }
299 
300  }//end for Patch
301 
302  double dipl_size = nb_ind*2.0;
303 
304  _freq = 0;
305  _fixloc = _segrloc = 0;
306 
307  for(i = 0; i < nb_locus; ++i){
308 
309  _deletFreqTable[i] /= dipl_size;
310 
311  _Ht += _deletFreqTable[i] * (1.0 - _deletFreqTable[i]);//2pq: expected htz
312 
313  _freq += _deletFreqTable[i];
314 
315  _fixloc += (_deletFreqTable[i] == 1);
316 
317  _segrloc += (_deletFreqTable[i] < 1 && _deletFreqTable[i] != 0);
318  }
319 
320  //factorization not done in previous loops:
321  _Hs *= 2;
322  _Ht *= 2;
323 
324  _deletAllCount /= nb_ind;
325  _freq /= nb_locus;
326  _Hs /= nb_locus * nb_patch;
327  _Ht /= nb_locus;
328  _Ho = _deletHtzLoci / (nb_ind * nb_locus);
329  _Hmz = _deletHmzLoci/ (nb_ind * nb_locus);
330  _fixLocPerPatch /= nb_patch;
331  _segrLocPerPatch /= nb_patch;
332 
334 
335  setFst(AGE);
336 
337  delete [] _deletFreqTable;
338  _deletFreqTable = 0;
339 }
TTrait * getTrait(IDX T)
Trait accessor.
Definition: individual.h:277
int get_nb_locus()
Definition: ttdeletmutations_bitstring.h:179
double _deletHmzLoci
Definition: ttdeletmutations_bitstring.h:281
double _deletHtzLoci
Definition: ttdeletmutations_bitstring.h:281
void setFst(age_t AGE)
Definition: stats_delet_bitstring.cc:361
void setLethalEquivalents(age_t AGE)
Definition: stats_delet_bitstring.cc:343
Bitstring implementation of TTDeletMutations with recombination.
Definition: ttdeletmutations_bitstring.h:47
unsigned int get_nb_mut_atLocus(unsigned int loc) const
Definition: ttdeletmutations_bitstring.h:105
unsigned int get_nb_htz_mutations() const
Definition: ttdeletmutations_bitstring.h:106
unsigned int get_nb_hmz_mutations() const
Definition: ttdeletmutations_bitstring.h:107
int _SHLinkedTraitIndex
Index of the trait in the Individual::Traits table.
Definition: stathandler.h:173
TProtoDeletMutations_bitstring * _SHLinkedTrait
Pointer to a TraitProtoype object.
Definition: stathandler.h:171
@ MAL
Definition: types.h:37
@ OFFSx
Definition: types.h:42

References _deletAllCount, _deletFreqTable, _deletHmzLoci, _deletHtzLoci, _fixloc, _fixLocPerPatch, _freq, _Hmz, _Ho, _Hs, _Ht, StatHandlerBase::_pop, _segrloc, _segrLocPerPatch, TraitStatHandler< TProtoDeletMutations_bitstring, TTDeletMutBitstrSH >::_SHLinkedTrait, TraitStatHandler< TProtoDeletMutations_bitstring, TTDeletMutBitstrSH >::_SHLinkedTraitIndex, ADLTx, ADULTS, FEM, Patch::get(), TTDeletMutations_bitstring::get_nb_hmz_mutations(), TTDeletMutations_bitstring::get_nb_htz_mutations(), TProtoDeletMutations_bitstring::get_nb_locus(), TTDeletMutations_bitstring::get_nb_mut_atLocus(), Metapop::getPatch(), Metapop::getPatchNbr(), Individual::getTrait(), MAL, OFFSx, setFst(), setLethalEquivalents(), and Patch::size().

Referenced by getAdultsLetheq(), getOffsprgLetheq(), setAdultDeletStats(), and setOffsprgDeletStats().

◆ setFst()

void TTDeletMutBitstrSH::setFst ( age_t  AGE)
362 {
363  unsigned i, nbpatch = 0;
364  double Hsnei, Htnei, harmonic = 0, size;
365  Patch* current_patch;
366 
367  for (i = 0; i < _pop->getPatchNbr(); ++i){
368 
369  current_patch = _pop->getPatch(i);
370 
371  if( (size = (double)current_patch->size(AGE)) != 0){
372  nbpatch++;
373  harmonic += 1.0/size;
374  }
375  }
376 
377  harmonic = (double)nbpatch/harmonic;
378 
379  Hsnei = harmonic/(harmonic-1.0)*(_Hs - ( _Ho/(2.0*harmonic) ) );
380  Htnei = _Ht + ( Hsnei/(harmonic*nbpatch) ) - ( _Ho/(2.0*harmonic*nbpatch) );
381 
382  _Fst = 1.0 - (Hsnei/Htnei);
383 }

References _Fst, _Ho, _Hs, _Ht, StatHandlerBase::_pop, Metapop::getPatch(), Metapop::getPatchNbr(), and Patch::size().

Referenced by setDeletStats().

◆ setLethalEquivalents()

void TTDeletMutBitstrSH::setLethalEquivalents ( age_t  AGE)
344 {
345  _letheq = 0;
346 
347  if(_deletFreqTable == 0)
348  fatal("allele frequency table not set when computing lethal equivalents\n");
349 
350  if(_isContinuousEffect) {
351  float* s = _SHLinkedTrait->get_s_continous();
352  for(int i = 0, nloc = _SHLinkedTrait->get_nb_locus(); i < nloc; i++)
353  _letheq += _deletFreqTable[i] * s[i];
354  } else
356  / _pop->size(AGE);
357 }
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together.
Definition: metapop.h:312
float * get_s_continous()
Definition: ttdeletmutations_bitstring.h:188
double get_strength()
Definition: ttdeletmutations_bitstring.h:182
void fatal(const char *str,...)
Definition: output.cc:96

References _deletFreqTable, _deletHmzLoci, _deletHtzLoci, _isContinuousEffect, _letheq, StatHandlerBase::_pop, TraitStatHandler< TProtoDeletMutations_bitstring, TTDeletMutBitstrSH >::_SHLinkedTrait, fatal(), TProtoDeletMutations_bitstring::get_nb_locus(), TProtoDeletMutations_bitstring::get_s_continous(), TProtoDeletMutations_bitstring::get_strength(), and Metapop::size().

Referenced by setDeletStats().

◆ setMeanViability()

void TTDeletMutBitstrSH::setMeanViability ( age_idx  agex)
140 {
141  unsigned int ind_cnt = 0;
142  Patch *patch;
143  _meanViab = 0;
144  for(unsigned int i = 0; i<_pop->getPatchNbr(); ++i) {
145  patch = _pop->getPatch(i);
146  for(unsigned int j = 0, size = patch->size(FEM, agex); j < size; ++j) {
147  _meanViab += *(double*)patch->get(FEM, ADLTx, j)->getTraitValue(_SHLinkedTraitIndex);
148  ind_cnt++;
149  }
150  for(unsigned int j = 0, size = patch->size(MAL, agex); j < size; ++j) {
151  _meanViab += *(double*)patch->get(MAL, ADLTx, j)->getTraitValue(_SHLinkedTraitIndex);
152  ind_cnt++;
153  }
154  }
155 
156  _meanViab = ( ind_cnt != 0 ? _meanViab/ind_cnt : nanf("NULL"));
157 }
void * getTraitValue(IDX T)
Accessor to the value (phenotype) of a particular trait.
Definition: individual.h:271

References _meanViab, StatHandlerBase::_pop, TraitStatHandler< TProtoDeletMutations_bitstring, TTDeletMutBitstrSH >::_SHLinkedTraitIndex, ADLTx, FEM, Patch::get(), Metapop::getPatch(), Metapop::getPatchNbr(), Individual::getTraitValue(), MAL, and Patch::size().

Referenced by getMeanViability().

◆ setOffsprgDeletStats()

void TTDeletMutBitstrSH::setOffsprgDeletStats ( )
inline

References OFFSPRG, and setDeletStats().

Referenced by setStatsForDeletMutations().

◆ setOffsprgViab()

void TTDeletMutBitstrSH::setOffsprgViab ( )
inline

References OFFSx, and setViability().

Referenced by setViabStats().

◆ setStatRecorders()

bool TTDeletMutBitstrSH::setStatRecorders ( std::string &  token)
virtual

Implements StatHandlerBase.

965 {
966 #ifdef _DEBUG_
967  message("-TTDeletMutBitstrSH::setStatRecorders ");
968 #endif
969  if(token.compare("delet") == 0) {
970 
972 
973  }else if(token.compare("adlt.delet") == 0) {
974 
976 
977 
978  }else if(token.compare("off.delet") == 0) {
979 
981 
982 
983  } else if(token.compare("viability") == 0) {
984 
985  setViabStats(ALL);
986 
987  } else if(token.compare("off.viability") == 0) {
988 
990 
991  } else if(token.compare("adlt.viability") == 0) {
992 
994 
995  } else if(token.compare("meanviab") == 0) {
996 
997  add("Offspring Viability","off.viab",OFFSPRG, static_cast<unsigned int> (OFFSx),
999  add("Adults Viability","adlt.viab",ADULTS, static_cast<unsigned int> (ADLTx),
1001 
1002  } else
1003  return false;
1004 
1005  return true;
1006 }
virtual StatRecorder< SH > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(SH::*getStatNoArg)(void), double(SH::*getStatOneArg)(unsigned int), double(SH::*getStatTwoArg)(unsigned int, unsigned int), void(SH::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
void setStatsForDeletMutations(age_t AGE)
Definition: ttdeletmutations_bitstring.cc:1008
double getMeanViability()
Definition: ttdeletmutations_bitstring.h:333
void setViabStats(age_t AGE)
Definition: ttdeletmutations_bitstring.cc:1056
void message(const char *message,...)
Definition: output.cc:40
#define ALL
All ages age class flag.
Definition: types.h:56

References StatHandler< SH >::add(), ADLTx, ADULTS, ALL, getMeanViability(), message(), OFFSPRG, OFFSx, setStatsForDeletMutations(), and setViabStats().

◆ setStatsForDeletMutations()

void TTDeletMutBitstrSH::setStatsForDeletMutations ( age_t  AGE)
1009 {
1010  if(AGE == ALL) {
1012  return;
1013  }
1014 
1015  string prefix = (AGE == ADULTS ? "adlt." : "off.");
1016  void (TTDeletMutBitstrSH::* setter) () = (AGE == ADULTS ?
1019 
1020  add("Frequency of deleterious alleles", prefix + "delfreq", AGE,0,0,
1022  setter);
1023 
1024  add("Homozygosity of delet. allele", prefix + "delhmz", AGE,0,0,
1026 
1027  add("Heterozygosity of delet. allele", prefix + "delhtz", AGE,0,0,
1029 
1030  add("Fixed Delet Mutations - Global", prefix + "delfix", AGE,0,0,
1032 
1033  add("Fixed Delet Mutations - Local", prefix + "delfixp", AGE,0,0,
1035 
1036  add("Segregating Delet Mutations - Global", prefix + "delsegr", AGE,0,0,
1038 
1039  add("Segregating Delet Mutations - Local", prefix + "delsegrp", AGE,0,0,
1041 
1042  add("Delet Fst", prefix + "delfst", AGE,0,0,
1044 
1045  add("Lethal Equivalents", prefix + "lethequ", AGE,0,0,
1047 
1048  add("Heterosis", "heterosis", ADULTS,0,0,
1050 
1051  add("Genetic Load", "load", ADULTS,0,0,
1053 
1054 }
The StatHandler for TTDeletMutations_bitstring.
Definition: ttdeletmutations_bitstring.h:272
double getDeletAllFreq()
Definition: ttdeletmutations_bitstring.h:317
double getDeletAllHmz()
Definition: ttdeletmutations_bitstring.h:318
double getDeletAllHtz()
Definition: ttdeletmutations_bitstring.h:319
double getFst()
Definition: ttdeletmutations_bitstring.h:327
double getLoad()
Definition: stats_delet_bitstring.cc:165
double getLethalEquivalents()
Definition: ttdeletmutations_bitstring.h:328
double getFixedDeletLociPerPatch()
Definition: ttdeletmutations_bitstring.h:321
double getFixedDeletLoci()
Definition: ttdeletmutations_bitstring.h:320
double getSegregatingDeletLociPerPatch()
Definition: ttdeletmutations_bitstring.h:323
void setOffsprgDeletStats()
Definition: ttdeletmutations_bitstring.h:304
double getHeterosis()
Definition: stats_delet_bitstring.cc:72
double getSegregatingDeletLoci()
Definition: ttdeletmutations_bitstring.h:322
void setAdultDeletStats()
Definition: ttdeletmutations_bitstring.h:303

References StatHandler< SH >::add(), ADULTS, ALL, getDeletAllFreq(), getDeletAllHmz(), getDeletAllHtz(), getFixedDeletLoci(), getFixedDeletLociPerPatch(), getFst(), getHeterosis(), getLethalEquivalents(), getLoad(), getSegregatingDeletLoci(), getSegregatingDeletLociPerPatch(), OFFSPRG, setAdultDeletStats(), and setOffsprgDeletStats().

Referenced by setStatRecorders().

◆ setViability()

void TTDeletMutBitstrSH::setViability ( age_idx  agex)
87 {
88  Individual *ind;
89  unsigned int ped_class;
90  Patch *patch;
91 
92  for(unsigned i = 0; i < 5; i++) {
93  _viability[i] = 0;
94  _SibProps[i] = 0;
95  }
96 
97  for(unsigned int i = 0; i < _pop->getPatchNbr(); ++i) {
98 
99  patch = _pop->getPatch(i);
100 
101  for(unsigned int j = 0, size = patch->size(MAL, agex); j < size; ++j) {
102 
103  ind = patch->get(MAL, agex, j);
104 
105  ped_class = ind->getPedigreeClass();
106 
107  _viability[ped_class] += *(double*)ind->getTrait(_SHLinkedTraitIndex)->getValue();
108 
109  _SibProps[ped_class]++;
110  }
111 
112  for(unsigned int j = 0, size = patch->size(FEM, agex); j < size; ++j) {
113 
114  ind = patch->get(FEM, agex, j);
115 
116  ped_class = ind->getPedigreeClass();
117 
118  _viability[ped_class] += *(double*)ind->getTrait(_SHLinkedTraitIndex)->getValue();
119 
120  _SibProps[ped_class]++;
121  }
122 
123  }
124 
125  double tot_ind = _SibProps[0] + _SibProps[1] + _SibProps[2] + _SibProps[3] + _SibProps[4];
127  _meanViab /= tot_ind;
128 
129  for(unsigned i = 0; i < 5; i++)
130  _viability[i] = (_SibProps[i] != 0 ? _viability[i] / _SibProps[i] : nanf("NULL"));
131 
132  for(unsigned i = 0; i < 5; i++)
133  _SibProps[i] /= tot_ind;
134 
135 }
unsigned int getPedigreeClass()
Returns the pedigree class of the individual, as set during offspring creation.
Definition: individual.h:179
virtual void * getValue() const =0
Genotype to phenotype mapper.

References _meanViab, StatHandlerBase::_pop, TraitStatHandler< TProtoDeletMutations_bitstring, TTDeletMutBitstrSH >::_SHLinkedTraitIndex, _SibProps, _viability, FEM, Patch::get(), Metapop::getPatch(), Metapop::getPatchNbr(), Individual::getPedigreeClass(), Individual::getTrait(), TTrait::getValue(), MAL, and Patch::size().

Referenced by setAdultViab(), and setOffsprgViab().

◆ setViabStats()

void TTDeletMutBitstrSH::setViabStats ( age_t  AGE)
1057 {
1058  if(AGE == ALL) {
1060  return;
1061  }
1062 
1063  string prefix = (AGE == ADULTS ? "adlt." : "off.");
1064  void (TTDeletMutBitstrSH::* setter) () = (AGE == ADULTS ?
1067 
1068  add("Average Viability", prefix + "viab", AGE, 0, 0,
1070  setter);
1071 
1072  add("Outbreds Viability", prefix + "viab.outb", AGE, 0,0,0,
1074 
1075  add("Inbreds Viability", prefix + "viab.outw", AGE, 1,0,0,
1077 
1078  add("Half Sibs Viability", prefix + "viab.hsib", AGE, 2,0,0,
1080 
1081  add("Full Sibs Viability", prefix + "viab.fsib", AGE, 3,0,0,
1083 
1084  add("Selfed Viability", prefix + "viab.self", AGE, 4,0,0,
1086 
1087  add("Outbred btw Proportion", prefix + "prop.outb", AGE, 0,0,0,
1089 
1090  add("Outbred wtn Proportion", prefix + "prop.outw", AGE, 1,0,0,
1092 
1093  add("Half Sibs Proportion", prefix + "prop.hsibs", AGE, 2,0,0,
1095 
1096  add("Full Sibs Proportion", prefix + "prop.fsibs", AGE, 3,0,0,
1098 
1099  add("Selfed Proportion", prefix + "prop.self", AGE, 4,0,0,
1101 }
void setAdultViab()
Definition: ttdeletmutations_bitstring.h:306
void setOffsprgViab()
Definition: ttdeletmutations_bitstring.h:307
double getViability(unsigned int v)
Definition: ttdeletmutations_bitstring.h:332
double getSibProportions(unsigned int i)
Definition: ttdeletmutations_bitstring.h:336

References StatHandler< SH >::add(), ADULTS, ALL, getMeanViability(), getSibProportions(), getViability(), OFFSPRG, setAdultViab(), and setOffsprgViab().

Referenced by setStatRecorders().

Member Data Documentation

◆ _deletAllCount

double TTDeletMutBitstrSH::_deletAllCount
private

◆ _deletFreqTable

double* TTDeletMutBitstrSH::_deletFreqTable
private

◆ _deletHmzLoci

double TTDeletMutBitstrSH::_deletHmzLoci
private

◆ _deletHtzLoci

double TTDeletMutBitstrSH::_deletHtzLoci
private

◆ _fixloc

double TTDeletMutBitstrSH::_fixloc
private

Referenced by getFixedDeletLoci(), and setDeletStats().

◆ _fixLocPerPatch

double TTDeletMutBitstrSH::_fixLocPerPatch
private

◆ _freq

double TTDeletMutBitstrSH::_freq
private

Referenced by getDeletAllFreq(), and setDeletStats().

◆ _Fst

double TTDeletMutBitstrSH::_Fst
private

Referenced by getFst(), and setFst().

◆ _Hmz

double TTDeletMutBitstrSH::_Hmz
private

Referenced by getDeletAllHmz(), and setDeletStats().

◆ _Ho

double TTDeletMutBitstrSH::_Ho
private

◆ _Hs

double TTDeletMutBitstrSH::_Hs
private

Referenced by getHs(), setDeletStats(), and setFst().

◆ _Ht

double TTDeletMutBitstrSH::_Ht
private

Referenced by getHt(), setDeletStats(), and setFst().

◆ _isContinuousEffect

bool TTDeletMutBitstrSH::_isContinuousEffect
private

◆ _letheq

double TTDeletMutBitstrSH::_letheq
private

◆ _meanViab

double TTDeletMutBitstrSH::_meanViab
private

◆ _segrloc

double TTDeletMutBitstrSH::_segrloc
private

◆ _segrLocPerPatch

double TTDeletMutBitstrSH::_segrLocPerPatch
private

◆ _SibProps

double TTDeletMutBitstrSH::_SibProps[5]
private

Referenced by getSibProportions(), and setViability().

◆ _viability

double TTDeletMutBitstrSH::_viability[5]
private

Referenced by getViability(), and setViability().

◆ fecWithHomePatchMate

double TTDeletMutBitstrSH::fecWithHomePatchMate
private

Referenced by getBtheta().

◆ fecWithOtherPatchMate

double TTDeletMutBitstrSH::fecWithOtherPatchMate
private

Referenced by getBalpha().


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

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

Locations of visitors to this page
Catalogued on GSR