Nemo  2.4.0
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:191
bool _isContinuousEffect
Definition: ttdeletmutations_bitstring.h:298
double * _deletFreqTable
Definition: ttdeletmutations_bitstring.h:296

References _isContinuousEffect, and TProtoDeletMutations_bitstring::get_iscontinuous().

◆ ~TTDeletMutBitstrSH()

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

References _deletFreqTable.

Member Function Documentation

◆ getAdultsLetheq()

double TTDeletMutBitstrSH::getAdultsLetheq ( )
inline
341 {setDeletStats(ADULTS); return _letheq;}
double _letheq
Definition: ttdeletmutations_bitstring.h:294
void setDeletStats(age_t AGE)
Definition: stats_delet_bitstring.cc:210
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:53

References _letheq, ADULTS, and setDeletStats().

◆ getBalpha()

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

References fecWithOtherPatchMate.

◆ getBtheta()

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

References fecWithHomePatchMate.

◆ getDeletAllFreq()

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

References _freq.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getDeletAllHmz()

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

References _Hmz.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getDeletAllHtz()

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

References _Ho.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getDeletAllPerGenome()

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

References _deletAllCount.

◆ getFixedDeletLoci()

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

References _fixloc.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getFixedDeletLociPerPatch()

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

References _fixLocPerPatch.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getFst()

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

References _Fst.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getHeterosis()

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

References getMeanFecWithPatchMate().

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getHs()

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

References _Hs.

◆ getHt()

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

References _Ht.

◆ getLethalEquivalents()

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

References _letheq.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getLoad()

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

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

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
345 {return _meanViab;}
double _meanViab
Definition: ttdeletmutations_bitstring.h:288

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
346 {setMeanViability(static_cast<age_idx> (a)); return _meanViab;}
void setMeanViability(age_idx agex)
Definition: stats_delet_bitstring.cc:138
age_idx
Array index of the age classes in the patch sizes and containers arrays.
Definition: types.h:40

References _meanViab, and setMeanViability().

◆ getOffsprgLetheq()

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

References _letheq, OFFSPRG, and setDeletStats().

◆ getPatchLoad()

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

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
334 {return _segrloc;}
double _segrloc
Definition: ttdeletmutations_bitstring.h:294

References _segrloc.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getSegregatingDeletLociPerPatch()

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

References _segrLocPerPatch.

Referenced by setStatsForDeletMutations().

+ Here is the caller graph for this function:

◆ getSibProportions()

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

References _SibProps.

Referenced by setViabStats().

+ Here is the caller graph for this function:

◆ getViability()

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

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:85

References ADLTx, and setViability().

Referenced by setViabStats().

+ Here is the caller graph for this function:

◆ setDeletStats()

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

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

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

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

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.

1048 {
1049 #ifdef _DEBUG_
1050  message("-TTDeletMutBitstrSH::setStatRecorders ");
1051 #endif
1052  if(token.compare("delet") == 0) {
1053 
1055 
1056  }else if(token.compare("adlt.delet") == 0) {
1057 
1059 
1060 
1061  }else if(token.compare("off.delet") == 0) {
1062 
1064 
1065 
1066  } else if(token.compare("viability") == 0) {
1067 
1068  setViabStats(ALL);
1069 
1070  } else if(token.compare("off.viability") == 0) {
1071 
1073 
1074  } else if(token.compare("adlt.viability") == 0) {
1075 
1077 
1078  } else if(token.compare("meanviab") == 0) {
1079 
1080  add("Offspring Viability","off.viab",OFFSPRG, static_cast<unsigned int> (OFFSx),
1082  add("Adults Viability","adlt.viab",ADULTS, static_cast<unsigned int> (ADLTx),
1084 
1085  } else
1086  return false;
1087 
1088  return true;
1089 }
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:143
void setStatsForDeletMutations(age_t AGE)
Definition: ttdeletmutations_bitstring.cc:1091
double getMeanViability()
Definition: ttdeletmutations_bitstring.h:345
void setViabStats(age_t AGE)
Definition: ttdeletmutations_bitstring.cc:1139
void message(const char *message,...)
Definition: output.cc:39
#define ALL
All ages age class flag.
Definition: types.h:55

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

◆ setStatsForDeletMutations()

void TTDeletMutBitstrSH::setStatsForDeletMutations ( age_t  AGE)
1092 {
1093  if(AGE == ALL) {
1095  return;
1096  }
1097 
1098  string prefix = (AGE == ADULTS ? "adlt." : "off.");
1099  void (TTDeletMutBitstrSH::* setter) () = (AGE == ADULTS ?
1102 
1103  add("Frequency of deleterious alleles", prefix + "delfreq", AGE,0,0,
1105  setter);
1106 
1107  add("Homozygosity of delet. allele", prefix + "delhmz", AGE,0,0,
1109 
1110  add("Heterozygosity of delet. allele", prefix + "delhtz", AGE,0,0,
1112 
1113  add("Fixed Delet Mutations - Global", prefix + "delfix", AGE,0,0,
1115 
1116  add("Fixed Delet Mutations - Local", prefix + "delfixp", AGE,0,0,
1118 
1119  add("Segregating Delet Mutations - Global", prefix + "delsegr", AGE,0,0,
1121 
1122  add("Segregating Delet Mutations - Local", prefix + "delsegrp", AGE,0,0,
1124 
1125  add("Delet Fst", prefix + "delfst", AGE,0,0,
1127 
1128  add("Lethal Equivalents", prefix + "lethequ", AGE,0,0,
1130 
1131  add("Heterosis", "heterosis", ADULTS,0,0,
1133 
1134  add("Genetic Load", "load", ADULTS,0,0,
1136 
1137 }
The StatHandler for TTDeletMutations_bitstring.
Definition: ttdeletmutations_bitstring.h:284
double getDeletAllFreq()
Definition: ttdeletmutations_bitstring.h:329
double getDeletAllHmz()
Definition: ttdeletmutations_bitstring.h:330
double getDeletAllHtz()
Definition: ttdeletmutations_bitstring.h:331
double getFst()
Definition: ttdeletmutations_bitstring.h:339
double getLoad()
Definition: stats_delet_bitstring.cc:164
double getLethalEquivalents()
Definition: ttdeletmutations_bitstring.h:340
double getFixedDeletLociPerPatch()
Definition: ttdeletmutations_bitstring.h:333
double getFixedDeletLoci()
Definition: ttdeletmutations_bitstring.h:332
double getSegregatingDeletLociPerPatch()
Definition: ttdeletmutations_bitstring.h:335
void setOffsprgDeletStats()
Definition: ttdeletmutations_bitstring.h:316
double getHeterosis()
Definition: stats_delet_bitstring.cc:71
double getSegregatingDeletLoci()
Definition: ttdeletmutations_bitstring.h:334
void setAdultDeletStats()
Definition: ttdeletmutations_bitstring.h:315

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)
86 {
87  Individual *ind;
88  unsigned int ped_class;
89  Patch *patch;
90 
91  for(unsigned i = 0; i < 5; i++) {
92  _viability[i] = 0;
93  _SibProps[i] = 0;
94  }
95 
96  for(unsigned int i = 0; i < _pop->getPatchNbr(); ++i) {
97 
98  patch = _pop->getPatch(i);
99 
100  for(unsigned int j = 0, size = patch->size(MAL, agex); j < size; ++j) {
101 
102  ind = patch->get(MAL, agex, j);
103 
104  ped_class = ind->getPedigreeClass();
105 
106  _viability[ped_class] += *(double*)ind->getTrait(_SHLinkedTraitIndex)->getValue();
107 
108  _SibProps[ped_class]++;
109  }
110 
111  for(unsigned int j = 0, size = patch->size(FEM, agex); j < size; ++j) {
112 
113  ind = patch->get(FEM, agex, j);
114 
115  ped_class = ind->getPedigreeClass();
116 
117  _viability[ped_class] += *(double*)ind->getTrait(_SHLinkedTraitIndex)->getValue();
118 
119  _SibProps[ped_class]++;
120  }
121 
122  }
123 
124  double tot_ind = _SibProps[0] + _SibProps[1] + _SibProps[2] + _SibProps[3] + _SibProps[4];
126  _meanViab /= tot_ind;
127 
128  for(unsigned i = 0; i < 5; i++)
129  _viability[i] = (_SibProps[i] != 0 ? _viability[i] / _SibProps[i] : nanf("NULL"));
130 
131  for(unsigned i = 0; i < 5; i++)
132  _SibProps[i] /= tot_ind;
133 
134 }
unsigned int getPedigreeClass()
Returns the pedigree class of the individual, as set during offspring creation.
Definition: individual.h:178
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)
1140 {
1141  if(AGE == ALL) {
1143  return;
1144  }
1145 
1146  string prefix = (AGE == ADULTS ? "adlt." : "off.");
1147  void (TTDeletMutBitstrSH::* setter) () = (AGE == ADULTS ?
1150 
1151  add("Average Viability", prefix + "viab", AGE, 0, 0,
1153  setter);
1154 
1155  add("Outbreds Viability", prefix + "viab.outb", AGE, 0,0,0,
1157 
1158  add("Inbreds Viability", prefix + "viab.outw", AGE, 1,0,0,
1160 
1161  add("Half Sibs Viability", prefix + "viab.hsib", AGE, 2,0,0,
1163 
1164  add("Full Sibs Viability", prefix + "viab.fsib", AGE, 3,0,0,
1166 
1167  add("Selfed Viability", prefix + "viab.self", AGE, 4,0,0,
1169 
1170  add("Outbred btw Proportion", prefix + "prop.outb", AGE, 0,0,0,
1172 
1173  add("Outbred wtn Proportion", prefix + "prop.outw", AGE, 1,0,0,
1175 
1176  add("Half Sibs Proportion", prefix + "prop.hsibs", AGE, 2,0,0,
1178 
1179  add("Full Sibs Proportion", prefix + "prop.fsibs", AGE, 3,0,0,
1181 
1182  add("Selfed Proportion", prefix + "prop.self", AGE, 4,0,0,
1184 }
void setAdultViab()
Definition: ttdeletmutations_bitstring.h:318
void setOffsprgViab()
Definition: ttdeletmutations_bitstring.h:319
double getViability(unsigned int v)
Definition: ttdeletmutations_bitstring.h:344
double getSibProportions(unsigned int i)
Definition: ttdeletmutations_bitstring.h:348

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.0 by  doxygen 1.9.1 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR