Nemo  2.4.2
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:190
bool _isContinuousEffect
Definition: ttdeletmutations_bitstring.h:297
double * _deletFreqTable
Definition: ttdeletmutations_bitstring.h:295

References _isContinuousEffect, and TProtoDeletMutations_bitstring::get_iscontinuous().

◆ ~TTDeletMutBitstrSH()

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

References _deletFreqTable.

Member Function Documentation

◆ getAdultsLetheq()

double TTDeletMutBitstrSH::getAdultsLetheq ( )
inline
340 {setDeletStats(ADULTS); return _letheq;}
double _letheq
Definition: ttdeletmutations_bitstring.h:293
void setDeletStats(age_t AGE)
Definition: stats_delet_bitstring.cc:209
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:52

References _letheq, ADULTS, and setDeletStats().

◆ getBalpha()

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

References fecWithOtherPatchMate.

◆ getBtheta()

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

References fecWithHomePatchMate.

◆ getDeletAllFreq()

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

References _freq.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getDeletAllHmz()

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

References _Hmz.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getDeletAllHtz()

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

References _Ho.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getDeletAllPerGenome()

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

References _deletAllCount.

◆ getFixedDeletLoci()

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

References _fixloc.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getFixedDeletLociPerPatch()

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

References _fixLocPerPatch.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getFst()

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

References _Fst.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getHeterosis()

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

References getMeanFecWithPatchMate().

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getHs()

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

References _Hs.

◆ getHt()

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

References _Ht.

◆ getLethalEquivalents()

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

References _letheq.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getLoad()

double TTDeletMutBitstrSH::getLoad ( )
164 {
165  unsigned int nb_patch=0;
166  double mean_load=0;
167 
168  for(unsigned int i = 0; i<_pop->getPatchNbr(); i++){
169 
170  if(_pop->getPatch(i)->size(FEM, ADLTx) != 0) {
171 
172  mean_load += getPatchLoad(i);
173 
174  nb_patch++;
175  }
176  }
177 
178  return (nb_patch != 0 ? mean_load/nb_patch : nanf("NULL"));
179 }
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
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
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:59
double getPatchLoad(unsigned int i)
Definition: stats_delet_bitstring.cc:183
@ FEM
Definition: types.h:35
@ ADLTx
Definition: types.h:40

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

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getMeanFecWithPatchMate()

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

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

+ Here is the caller graph for this function:

◆ getMeanViability() [1/2]

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

References _meanViab.

Referenced by setStatRecorders(), and setViabStats().

+ Here is the caller graph for this function:

◆ getMeanViability() [2/2]

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

References _meanViab, and setMeanViability().

◆ getOffsprgLetheq()

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

References _letheq, OFFSPRG, and setDeletStats().

◆ getPatchLoad()

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

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

Referenced by getLoad().

+ Here is the caller graph for this function:

◆ getSegregatingDeletLoci()

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

References _segrloc.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getSegregatingDeletLociPerPatch()

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

References _segrLocPerPatch.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getSibProportions()

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

References _SibProps.

Referenced by setViabStats().

+ Here is the caller graph for this function:

◆ getViability()

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

References _viability.

Referenced by setViabStats().

+ Here is the caller graph for this function:

◆ setAdultDeletStats()

void TTDeletMutBitstrSH::setAdultDeletStats ( )
inline

References ADULTS, and setDeletStats().

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ setAdultViab()

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

References ADLTx, and setViability().

Referenced by setViabStats().

+ Here is the caller graph for this function:

◆ setDeletStats()

void TTDeletMutBitstrSH::setDeletStats ( age_t  AGE)
210 {
211  unsigned int i, j, k, nb_ind = 0, nb_patch = 0;
212  unsigned int nb_locus = _SHLinkedTrait->get_nb_locus();
213  unsigned int psize=0;
215  Patch* current_patch;
216  age_idx agex = (AGE == ADULTS ? ADLTx : OFFSx);
217 
218  _deletHtzLoci = 0;
219  _deletHmzLoci = 0;
220  _deletAllCount = 0;
221  _Hs = 0;
222  _Ht = 0;
223  _fixLocPerPatch = 0;
224  _segrLocPerPatch = 0;
225 
226  if(_deletFreqTable != NULL)
227  delete [] _deletFreqTable;
228 
229  _deletFreqTable = new double [nb_locus];
230 
231  double* patch_freqbylocus = new double[nb_locus];
232 
233  for(i = 0; i < nb_locus; ++i)
234  _deletFreqTable[i] = 0;
235 
236 
237  for(i = 0; i < _pop->getPatchNbr(); ++i) {
238 
239  current_patch = _pop->getPatch(i);
240 
241  if( (psize = current_patch->size(AGE)) == 0) continue;
242 
243  nb_patch++;
244 
245  nb_ind += psize;
246 
247  for(j = 0; j < nb_locus; ++j)
248  patch_freqbylocus[j] = 0;
249 
250  //Females
251  for(j = 0; j < current_patch->size(FEM, agex); ++j) {
252 
253  trait = static_cast< TTDeletMutations_bitstring* > ( current_patch->get( FEM, agex, j )->getTrait( _SHLinkedTraitIndex ) );
254 
256 
258 
259  //sparse iteration over set bits in both chromosomes
260  bitstring** seq = (bitstring**)trait->get_sequence();
261  for (unsigned int c = 0; c < 2; ++c) {
262  for (size_t w = 0; w < seq[c]->nb_words(); ++w) {
263  auto word = *seq[c]->getword_atIdx(w);
264  while (word) {
265  unsigned int bit = __builtin_ctzl(word);
266  patch_freqbylocus[w * BITS_PER_WORD + bit] += 1;
267  word &= word - 1;
268  }
269  }
270  }
271 
272  }//end for females
273 
274  //Males
275  for(j = 0; j < current_patch->size(MAL, agex); ++j) {
276 
277  trait = static_cast< TTDeletMutations_bitstring* > ( current_patch->get( MAL, agex, j )->getTrait( _SHLinkedTraitIndex ) );
278 
280 
282 
283  //sparse iteration over set bits in both chromosomes
284  bitstring** seq = (bitstring**)trait->get_sequence();
285  for (unsigned int c = 0; c < 2; ++c) {
286  for (size_t w = 0; w < seq[c]->nb_words(); ++w) {
287  auto word = *seq[c]->getword_atIdx(w);
288  while (word) {
289  unsigned int bit = __builtin_ctzl(word);
290  patch_freqbylocus[w * BITS_PER_WORD + bit] += 1;
291  word &= word - 1;
292  }
293  }
294  }
295 
296  }//end for males
297 
298  double dipl_size = psize*2.0;
299  for(j = 0; j < nb_locus; ++j) {
300  //aggregate for the pop freq by locus:
301  _deletFreqTable[j] += patch_freqbylocus[j];
302  //aggregate mut nbr for the population tot mut nbr:
303  _deletAllCount += patch_freqbylocus[j];
304  //get the local Patch mut freq by locus:
305  patch_freqbylocus[j] /= dipl_size;
306  //compute the expected local htz = 2pq:
307  _Hs += patch_freqbylocus[j] * (1.0 - patch_freqbylocus[j]);
308  }
309 
310  for(j = 0; j < nb_locus; ++j) {
311  //segregating and fixed loci in the Patch:
312  if(patch_freqbylocus[j] == 1.0)
313  _fixLocPerPatch++;
314  else if(patch_freqbylocus[j] != 0)
316  }
317 
318  }//end for Patch
319 
320  double dipl_size = nb_ind*2.0;
321 
322  _freq = 0;
323  _fixloc = _segrloc = 0;
324 
325  for(i = 0; i < nb_locus; ++i){
326 
327  _deletFreqTable[i] /= dipl_size;
328 
329  _Ht += _deletFreqTable[i] * (1.0 - _deletFreqTable[i]);//2pq: expected htz
330 
331  _freq += _deletFreqTable[i];
332 
333  _fixloc += (_deletFreqTable[i] == 1);
334 
335  _segrloc += (_deletFreqTable[i] < 1 && _deletFreqTable[i] != 0);
336  }
337 
338  //factorization not done in previous loops:
339  _Hs *= 2;
340  _Ht *= 2;
341 
342  _deletAllCount /= nb_ind;
343  _freq /= nb_locus;
344  _Hs /= nb_locus * nb_patch;
345  _Ht /= nb_locus;
346  _Ho = _deletHtzLoci / (nb_ind * nb_locus);
347  _Hmz = _deletHmzLoci/ (nb_ind * nb_locus);
348  _fixLocPerPatch /= nb_patch;
349  _segrLocPerPatch /= nb_patch;
350 
352 
353  setFst(AGE);
354 
355  delete [] patch_freqbylocus;
356  delete [] _deletFreqTable;
357  _deletFreqTable = 0;
358 }
#define BITS_PER_WORD
Definition: bitstring.h:39
TTrait * getTrait(IDX T)
Trait accessor.
Definition: individual.h:275
int get_nb_locus()
Definition: ttdeletmutations_bitstring.h:184
double _deletHmzLoci
Definition: ttdeletmutations_bitstring.h:292
double _deletHtzLoci
Definition: ttdeletmutations_bitstring.h:292
void setFst(age_t AGE)
Definition: stats_delet_bitstring.cc:380
void setLethalEquivalents(age_t AGE)
Definition: stats_delet_bitstring.cc:362
Bitstring implementation of TTDeletMutations with recombination.
Definition: ttdeletmutations_bitstring.h:45
virtual void ** get_sequence() const
Definition: ttdeletmutations_bitstring.h:147
unsigned int get_nb_htz_mutations() const
Definition: ttdeletmutations_bitstring.h:109
unsigned int get_nb_hmz_mutations() const
Definition: ttdeletmutations_bitstring.h:110
int _SHLinkedTraitIndex
Index of the trait in the Individual::Traits table.
Definition: stathandler.h:171
TProtoDeletMutations_bitstring * _SHLinkedTrait
Pointer to a TraitProtoype object.
Definition: stathandler.h:169
Non-template and faster implementation of std::bitset.
Definition: bitstring.h:53
_ul * getword_atIdx(size_t index) const
Definition: bitstring.h:155
size_t nb_words() const
Definition: bitstring.h:160
@ MAL
Definition: types.h:35
@ OFFSx
Definition: types.h:40

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, BITS_PER_WORD, FEM, Patch::get(), TTDeletMutations_bitstring::get_nb_hmz_mutations(), TTDeletMutations_bitstring::get_nb_htz_mutations(), TProtoDeletMutations_bitstring::get_nb_locus(), TTDeletMutations_bitstring::get_sequence(), Metapop::getPatch(), Metapop::getPatchNbr(), Individual::getTrait(), bitstring::getword_atIdx(), MAL, bitstring::nb_words(), OFFSx, setFst(), setLethalEquivalents(), and Patch::size().

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

+ Here is the caller graph for this function:

◆ setFst()

void TTDeletMutBitstrSH::setFst ( age_t  AGE)
381 {
382  unsigned i, nbpatch = 0;
383  double Hsnei, Htnei, harmonic = 0, size;
384  Patch* current_patch;
385 
386  for (i = 0; i < _pop->getPatchNbr(); ++i){
387 
388  current_patch = _pop->getPatch(i);
389 
390  if( (size = (double)current_patch->size(AGE)) != 0){
391  nbpatch++;
392  harmonic += 1.0/size;
393  }
394  }
395 
396  harmonic = (double)nbpatch/harmonic;
397 
398  Hsnei = harmonic/(harmonic-1.0)*(_Hs - ( _Ho/(2.0*harmonic) ) );
399  Htnei = _Ht + ( Hsnei/(harmonic*nbpatch) ) - ( _Ho/(2.0*harmonic*nbpatch) );
400 
401  _Fst = 1.0 - (Hsnei/Htnei);
402 }

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

Referenced by setDeletStats().

+ Here is the caller graph for this function:

◆ setLethalEquivalents()

void TTDeletMutBitstrSH::setLethalEquivalents ( age_t  AGE)
363 {
364  _letheq = 0;
365 
366  if(_deletFreqTable == 0)
367  fatal("allele frequency table not set when computing lethal equivalents\n");
368 
369  if(_isContinuousEffect) {
370  float* s = _SHLinkedTrait->get_s_continous();
371  for(int i = 0, nloc = _SHLinkedTrait->get_nb_locus(); i < nloc; i++)
372  _letheq += _deletFreqTable[i] * s[i];
373  } else
375  / _pop->size(AGE);
376 }
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together.
Definition: metapop.h:310
float * get_s_continous()
Definition: ttdeletmutations_bitstring.h:193
double get_strength()
Definition: ttdeletmutations_bitstring.h:187
void fatal(const char *str,...)
Definition: output.cc:98

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

+ Here is the caller graph for this function:

◆ setMeanViability()

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

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

+ Here is the caller graph for this function:

◆ setOffsprgDeletStats()

void TTDeletMutBitstrSH::setOffsprgDeletStats ( )
inline

References OFFSPRG, and setDeletStats().

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ setOffsprgViab()

void TTDeletMutBitstrSH::setOffsprgViab ( )
inline

References OFFSx, and setViability().

Referenced by setViabStats().

+ Here is the caller graph for this function:

◆ setStatRecorders()

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

Implements StatHandlerBase.

1047 {
1048 #ifdef _DEBUG_
1049  message("-TTDeletMutBitstrSH::setStatRecorders ");
1050 #endif
1051  if(token.compare("delet") == 0) {
1052 
1054 
1055  }else if(token.compare("adlt.delet") == 0) {
1056 
1058 
1059 
1060  }else if(token.compare("off.delet") == 0) {
1061 
1063 
1064 
1065  } else if(token.compare("viability") == 0) {
1066 
1067  setViabStats(ALL);
1068 
1069  } else if(token.compare("off.viability") == 0) {
1070 
1072 
1073  } else if(token.compare("adlt.viability") == 0) {
1074 
1076 
1077  } else if(token.compare("meanviab") == 0) {
1078 
1079  add("Offspring Viability","off.viab",OFFSPRG, static_cast<unsigned int> (OFFSx),
1081  add("Adults Viability","adlt.viab",ADULTS, static_cast<unsigned int> (ADLTx),
1083 
1084  } else
1085  return false;
1086 
1087  return true;
1088 }
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:142
void setStatsForDeletMutations(age_t AGE)
Definition: ttdeletmutations_bitstring.cc:1090
double getMeanViability()
Definition: ttdeletmutations_bitstring.h:344
void setViabStats(age_t AGE)
Definition: ttdeletmutations_bitstring.cc:1138
void message(const char *message,...)
Definition: output.cc:38
#define ALL
All ages age class flag.
Definition: types.h:54

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

◆ setStatsForDeletMutations()

void TTDeletMutBitstrSH::setStatsForDeletMutations ( age_t  AGE)
1091 {
1092  if(AGE == ALL) {
1094  return;
1095  }
1096 
1097  string prefix = (AGE == ADULTS ? "adlt." : "off.");
1098  void (TTDeletMutBitstrSH::* setter) () = (AGE == ADULTS ?
1101 
1102  add("Frequency of deleterious alleles", prefix + "delfreq", AGE,0,0,
1104  setter);
1105 
1106  add("Homozygosity of delet. allele", prefix + "delhmz", AGE,0,0,
1108 
1109  add("Heterozygosity of delet. allele", prefix + "delhtz", AGE,0,0,
1111 
1112  add("Fixed Delet Mutations - Global", prefix + "delfix", AGE,0,0,
1114 
1115  add("Fixed Delet Mutations - Local", prefix + "delfixp", AGE,0,0,
1117 
1118  add("Segregating Delet Mutations - Global", prefix + "delsegr", AGE,0,0,
1120 
1121  add("Segregating Delet Mutations - Local", prefix + "delsegrp", AGE,0,0,
1123 
1124  add("Delet Fst", prefix + "delfst", AGE,0,0,
1126 
1127  add("Lethal Equivalents", prefix + "lethequ", AGE,0,0,
1129 
1130  add("Heterosis", "heterosis", ADULTS,0,0,
1132 
1133  add("Genetic Load", "load", ADULTS,0,0,
1135 
1136 }
The StatHandler for TTDeletMutations_bitstring.
Definition: ttdeletmutations_bitstring.h:283
double getDeletAllFreq()
Definition: ttdeletmutations_bitstring.h:328
double getDeletAllHmz()
Definition: ttdeletmutations_bitstring.h:329
double getDeletAllHtz()
Definition: ttdeletmutations_bitstring.h:330
double getFst()
Definition: ttdeletmutations_bitstring.h:338
double getLoad()
Definition: stats_delet_bitstring.cc:163
double getLethalEquivalents()
Definition: ttdeletmutations_bitstring.h:339
double getFixedDeletLociPerPatch()
Definition: ttdeletmutations_bitstring.h:332
double getFixedDeletLoci()
Definition: ttdeletmutations_bitstring.h:331
double getSegregatingDeletLociPerPatch()
Definition: ttdeletmutations_bitstring.h:334
void setOffsprgDeletStats()
Definition: ttdeletmutations_bitstring.h:315
double getHeterosis()
Definition: stats_delet_bitstring.cc:70
double getSegregatingDeletLoci()
Definition: ttdeletmutations_bitstring.h:333
void setAdultDeletStats()
Definition: ttdeletmutations_bitstring.h:314

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

Referenced by setStatRecorders().

+ Here is the caller graph for this function:

◆ setViability()

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

+ Here is the caller graph for this function:

◆ setViabStats()

void TTDeletMutBitstrSH::setViabStats ( age_t  AGE)
1139 {
1140  if(AGE == ALL) {
1142  return;
1143  }
1144 
1145  string prefix = (AGE == ADULTS ? "adlt." : "off.");
1146  void (TTDeletMutBitstrSH::* setter) () = (AGE == ADULTS ?
1149 
1150  add("Average Viability", prefix + "viab", AGE, 0, 0,
1152  setter);
1153 
1154  add("Outbreds Viability", prefix + "viab.outb", AGE, 0,0,0,
1156 
1157  add("Inbreds Viability", prefix + "viab.outw", AGE, 1,0,0,
1159 
1160  add("Half Sibs Viability", prefix + "viab.hsib", AGE, 2,0,0,
1162 
1163  add("Full Sibs Viability", prefix + "viab.fsib", AGE, 3,0,0,
1165 
1166  add("Selfed Viability", prefix + "viab.self", AGE, 4,0,0,
1168 
1169  add("Outbred btw Proportion", prefix + "prop.outb", AGE, 0,0,0,
1171 
1172  add("Outbred wtn Proportion", prefix + "prop.outw", AGE, 1,0,0,
1174 
1175  add("Half Sibs Proportion", prefix + "prop.hsibs", AGE, 2,0,0,
1177 
1178  add("Full Sibs Proportion", prefix + "prop.fsibs", AGE, 3,0,0,
1180 
1181  add("Selfed Proportion", prefix + "prop.self", AGE, 4,0,0,
1183 }
void setAdultViab()
Definition: ttdeletmutations_bitstring.h:317
void setOffsprgViab()
Definition: ttdeletmutations_bitstring.h:318
double getViability(unsigned int v)
Definition: ttdeletmutations_bitstring.h:343
double getSibProportions(unsigned int i)
Definition: ttdeletmutations_bitstring.h:347

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

Referenced by setStatRecorders().

+ Here is the caller graph for this function:

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

Catalogued on GSR