Nemo  2.3.46
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< TTDeletMutBitstrSH >
 StatHandler ()
 
virtual ~StatHandler ()
 
virtual void clear ()
 Empties the _recorders list, they are destroyed in StatHandlerBase::reset(). More...
 
virtual StatRecorder
< TTDeletMutBitstrSH > * 
add (std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(TTDeletMutBitstrSH::*getStatNoArg)(void), double(TTDeletMutBitstrSH::*getStatOneArg)(unsigned int), double(TTDeletMutBitstrSH::*getStatTwoArg)(unsigned int, unsigned int), void(TTDeletMutBitstrSH::*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< TTDeletMutBitstrSH >
typedef std::list
< StatRecorder
< TTDeletMutBitstrSH >
* >::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< TTDeletMutBitstrSH >
std::list< StatRecorder
< TTDeletMutBitstrSH > * > 
_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 ( TProtoDeletMutations_bitstring TP)
inline

References TProtoDeletMutations_bitstring::get_iscontinuous().

double * _deletFreqTable
Definition: ttdeletmutations_bitstring.h:265
bool get_iscontinuous()
Definition: ttdeletmutations_bitstring.h:193
bool _isContinuousEffect
Definition: ttdeletmutations_bitstring.h:267
virtual TTDeletMutBitstrSH::~TTDeletMutBitstrSH ( )
inlinevirtual

References _deletFreqTable.

275 {if(_deletFreqTable != 0) delete [] _deletFreqTable;}
double * _deletFreqTable
Definition: ttdeletmutations_bitstring.h:265

Member Function Documentation

double TTDeletMutBitstrSH::getAdultsLetheq ( )
inline

References _letheq, ADULTS, and setDeletStats().

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

References fecWithOtherPatchMate.

294 {return fecWithOtherPatchMate;}
double fecWithOtherPatchMate
Definition: ttdeletmutations_bitstring.h:255
double TTDeletMutBitstrSH::getBtheta ( )
inline

References fecWithHomePatchMate.

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

References _freq.

Referenced by setStatsForDeletMutations().

298 {return _freq;}
double _freq
Definition: ttdeletmutations_bitstring.h:263
double TTDeletMutBitstrSH::getDeletAllHmz ( )
inline

References _Hmz.

Referenced by setStatsForDeletMutations().

299 {return _Hmz;}
double _Hmz
Definition: ttdeletmutations_bitstring.h:263
double TTDeletMutBitstrSH::getDeletAllHtz ( )
inline

References _Ho.

Referenced by setStatsForDeletMutations().

300 {return _Ho;}
double _Ho
Definition: ttdeletmutations_bitstring.h:263
double TTDeletMutBitstrSH::getDeletAllPerGenome ( )
inline

References _deletAllCount.

305 {return _deletAllCount;}
double _deletAllCount
Definition: ttdeletmutations_bitstring.h:263
double TTDeletMutBitstrSH::getFixedDeletLoci ( )
inline

References _fixloc.

Referenced by setStatsForDeletMutations().

301 {return _fixloc;}
double _fixloc
Definition: ttdeletmutations_bitstring.h:263
double TTDeletMutBitstrSH::getFixedDeletLociPerPatch ( )
inline

References _fixLocPerPatch.

Referenced by setStatsForDeletMutations().

302 {return _fixLocPerPatch;}
double _fixLocPerPatch
Definition: ttdeletmutations_bitstring.h:262
double TTDeletMutBitstrSH::getFst ( )
inline

References _Fst.

Referenced by setStatsForDeletMutations().

308 {return _Fst;}
double _Fst
Definition: ttdeletmutations_bitstring.h:263
double TTDeletMutBitstrSH::getHeterosis ( )

References getMeanFecWithPatchMate().

Referenced by setStatsForDeletMutations().

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
double TTDeletMutBitstrSH::getHs ( )
inline

References _Hs.

306 {return _Hs;}
double _Hs
Definition: ttdeletmutations_bitstring.h:263
double TTDeletMutBitstrSH::getHt ( )
inline

References _Ht.

307 {return _Ht;}
double _Ht
Definition: ttdeletmutations_bitstring.h:263
double TTDeletMutBitstrSH::getLethalEquivalents ( )
inline

References _letheq.

Referenced by setStatsForDeletMutations().

309 {return _letheq;}
double _letheq
Definition: ttdeletmutations_bitstring.h:263
double TTDeletMutBitstrSH::getLoad ( )

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

Referenced by setStatsForDeletMutations().

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 size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
Definition: types.h:42
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
Definition: types.h:37
double getPatchLoad(unsigned int i)
Definition: stats_delet_bitstring.cc:185
double TTDeletMutBitstrSH::getMeanFecWithPatchMate ( bool  HOME)

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

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 }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
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:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
Definition: types.h:42
double getFecWithHomePatchMate()
Returns the proportion of succesfull local matings (i.e.
Definition: individual.h:229
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
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
This class contains traits along with other individual information (sex, pedigree, etc. ).
Definition: individual.h:49
Definition: types.h:37
double getFecWithOtherPatchMate()
Returns the proportion of successfull remote matings.
Definition: individual.h:237
double TTDeletMutBitstrSH::getMeanViability ( )
inline

References _meanViab.

Referenced by setStatRecorders(), and setViabStats().

314 {return _meanViab;}
double _meanViab
Definition: ttdeletmutations_bitstring.h:257
double TTDeletMutBitstrSH::getMeanViability ( unsigned int  a)
inline

References _meanViab, and setMeanViability().

315 {setMeanViability(static_cast<age_idx> (a)); return _meanViab;}
double _meanViab
Definition: ttdeletmutations_bitstring.h:257
void setMeanViability(age_idx agex)
Definition: stats_delet_bitstring.cc:139
double TTDeletMutBitstrSH::getOffsprgLetheq ( )
inline

References _letheq, OFFSPRG, and setDeletStats().

311 {setDeletStats(OFFSPRG); return _letheq;}
void setDeletStats(age_t AGE)
Definition: stats_delet_bitstring.cc:211
double _letheq
Definition: ttdeletmutations_bitstring.h:263
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
double TTDeletMutBitstrSH::getPatchLoad ( unsigned int  i)

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

Referenced by getLoad().

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 getTotRealizedFecundity()
Gives the total number of surviving offspring for all categories of mating.
Definition: individual.h:176
unsigned int getTotMatings()
Gives the total number of matings of an individual.
Definition: individual.h:152
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
Definition: types.h:42
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
This class contains traits along with other individual information (sex, pedigree, etc. ).
Definition: individual.h:49
Definition: types.h:37
double TTDeletMutBitstrSH::getSegregatingDeletLoci ( )
inline

References _segrloc.

Referenced by setStatsForDeletMutations().

303 {return _segrloc;}
double _segrloc
Definition: ttdeletmutations_bitstring.h:263
double TTDeletMutBitstrSH::getSegregatingDeletLociPerPatch ( )
inline

References _segrLocPerPatch.

Referenced by setStatsForDeletMutations().

304 {return _segrLocPerPatch;}
double _segrLocPerPatch
Definition: ttdeletmutations_bitstring.h:262
double TTDeletMutBitstrSH::getSibProportions ( unsigned int  i)
inline

Referenced by setViabStats().

317 {return _SibProps[i];}
double _SibProps[5]
Definition: ttdeletmutations_bitstring.h:257
double TTDeletMutBitstrSH::getViability ( unsigned int  v)
inline

Referenced by setViabStats().

313 {return _viability[v];}
double _viability[5]
Definition: ttdeletmutations_bitstring.h:257
void TTDeletMutBitstrSH::setAdultDeletStats ( )
inline

References ADULTS, and setDeletStats().

Referenced by setStatsForDeletMutations().

#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
void setDeletStats(age_t AGE)
Definition: stats_delet_bitstring.cc:211
void TTDeletMutBitstrSH::setAdultViab ( )
inline

References ADLTx, and setViability().

Referenced by setViabStats().

void setViability(age_idx agex)
Definition: stats_delet_bitstring.cc:86
Definition: types.h:42
void TTDeletMutBitstrSH::setDeletStats ( age_t  AGE)

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

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 }
void setLethalEquivalents(age_t AGE)
Definition: stats_delet_bitstring.cc:343
unsigned int get_nb_hmz_mutations()
Definition: ttdeletmutations_bitstring.h:114
double _fixLocPerPatch
Definition: ttdeletmutations_bitstring.h:262
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
age_idx
Array index of the age classes in the patch sizes and containers arrays.
Definition: types.h:41
double _deletHtzLoci
Definition: ttdeletmutations_bitstring.h:262
double _freq
Definition: ttdeletmutations_bitstring.h:263
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
TTrait * getTrait(IDX T)
Trait accessor.
Definition: individual.h:277
TProtoDeletMutations_bitstring * _SHLinkedTrait
Pointer to a TraitProtoype object.
Definition: stathandler.h:171
void setFst(age_t AGE)
Definition: stats_delet_bitstring.cc:361
double _deletAllCount
Definition: ttdeletmutations_bitstring.h:263
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
int _SHLinkedTraitIndex
Index of the trait in the Individual::Traits table.
Definition: stathandler.h:173
Definition: types.h:42
double _Hs
Definition: ttdeletmutations_bitstring.h:263
double _deletHmzLoci
Definition: ttdeletmutations_bitstring.h:262
Bitstring implementation of TTDeletMutations with recombination.
Definition: ttdeletmutations_bitstring.h:47
double _fixloc
Definition: ttdeletmutations_bitstring.h:263
double * _deletFreqTable
Definition: ttdeletmutations_bitstring.h:265
double _segrloc
Definition: ttdeletmutations_bitstring.h:263
Definition: types.h:37
Definition: types.h:42
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int get_nb_mut_atLocus(unsigned int loc)
Definition: ttdeletmutations_bitstring.h:112
unsigned int get_nb_htz_mutations()
Definition: ttdeletmutations_bitstring.h:113
double _Ho
Definition: ttdeletmutations_bitstring.h:263
int get_nb_locus()
Definition: ttdeletmutations_bitstring.h:188
double _segrLocPerPatch
Definition: ttdeletmutations_bitstring.h:262
double _Hmz
Definition: ttdeletmutations_bitstring.h:263
Definition: types.h:37
double _Ht
Definition: ttdeletmutations_bitstring.h:263
void TTDeletMutBitstrSH::setFst ( age_t  AGE)

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

Referenced by setDeletStats().

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 }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
double _Hs
Definition: ttdeletmutations_bitstring.h:263
double _Fst
Definition: ttdeletmutations_bitstring.h:263
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double _Ho
Definition: ttdeletmutations_bitstring.h:263
double _Ht
Definition: ttdeletmutations_bitstring.h:263
void TTDeletMutBitstrSH::setLethalEquivalents ( age_t  AGE)

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

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 }
float * get_s_continous()
Definition: ttdeletmutations_bitstring.h:199
double _deletHtzLoci
Definition: ttdeletmutations_bitstring.h:262
TProtoDeletMutations_bitstring * _SHLinkedTrait
Pointer to a TraitProtoype object.
Definition: stathandler.h:171
void fatal(const char *str,...)
Definition: output.cc:90
double get_strength()
Definition: ttdeletmutations_bitstring.h:190
double _deletHmzLoci
Definition: ttdeletmutations_bitstring.h:262
double * _deletFreqTable
Definition: ttdeletmutations_bitstring.h:265
double _letheq
Definition: ttdeletmutations_bitstring.h:263
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
int get_nb_locus()
Definition: ttdeletmutations_bitstring.h:188
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
bool _isContinuousEffect
Definition: ttdeletmutations_bitstring.h:267
void TTDeletMutBitstrSH::setMeanViability ( age_idx  agex)

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

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
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
double _meanViab
Definition: ttdeletmutations_bitstring.h:257
int _SHLinkedTraitIndex
Index of the trait in the Individual::Traits table.
Definition: stathandler.h:173
Definition: types.h:42
Definition: types.h:37
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
Definition: types.h:37
void TTDeletMutBitstrSH::setOffsprgDeletStats ( )
inline

References OFFSPRG, and setDeletStats().

Referenced by setStatsForDeletMutations().

void setDeletStats(age_t AGE)
Definition: stats_delet_bitstring.cc:211
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
void TTDeletMutBitstrSH::setOffsprgViab ( )
inline

References OFFSx, and setViability().

Referenced by setViabStats().

void setViability(age_idx agex)
Definition: stats_delet_bitstring.cc:86
Definition: types.h:42
bool TTDeletMutBitstrSH::setStatRecorders ( std::string &  token)
virtual

Implements StatHandlerBase.

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

821 {
822 #ifdef _DEBUG_
823  message("-TTDeletMutBitstrSH::setStatRecorders ");
824 #endif
825  if(token.compare("delet") == 0) {
826 
828 
829  }else if(token.compare("adlt.delet") == 0) {
830 
832 
833 
834  }else if(token.compare("off.delet") == 0) {
835 
837 
838 
839  } else if(token.compare("viability") == 0) {
840 
841  setViabStats(ALL);
842 
843  } else if(token.compare("off.viability") == 0) {
844 
846 
847  } else if(token.compare("adlt.viability") == 0) {
848 
850 
851  } else if(token.compare("meanviab") == 0) {
852 
853  add("Offspring Viability","off.viab",OFFSPRG, static_cast<unsigned int> (OFFSx),
855  add("Adults Viability","adlt.viab",ADULTS, static_cast<unsigned int> (ADLTx),
857 
858  } else
859  return false;
860 
861  return true;
862 }
void message(const char *message,...)
Definition: output.cc:40
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
void setStatsForDeletMutations(age_t AGE)
Definition: ttdeletmutations_bitstring.cc:864
Definition: types.h:42
virtual StatRecorder< TTDeletMutBitstrSH > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(TTDeletMutBitstrSH::*getStatNoArg)(void), double(TTDeletMutBitstrSH::*getStatOneArg)(unsigned int), double(TTDeletMutBitstrSH::*getStatTwoArg)(unsigned int, unsigned int), void(TTDeletMutBitstrSH::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
#define ALL
All ages age class flag.
Definition: types.h:56
double getMeanViability()
Definition: ttdeletmutations_bitstring.h:314
Definition: types.h:42
void setViabStats(age_t AGE)
Definition: ttdeletmutations_bitstring.cc:912
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
void TTDeletMutBitstrSH::setStatsForDeletMutations ( age_t  AGE)

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

Referenced by setStatRecorders().

865 {
866  if(AGE == ALL) {
868  return;
869  }
870 
871  string prefix = (AGE == ADULTS ? "adlt." : "off.");
872  void (TTDeletMutBitstrSH::* setter) () = (AGE == ADULTS ?
875 
876  add("Frequency of deleterious alleles", prefix + "delfreq", AGE,0,0,
878  setter);
879 
880  add("Homozygosity of delet. allele", prefix + "delhmz", AGE,0,0,
882 
883  add("Heterozygosity of delet. allele", prefix + "delhtz", AGE,0,0,
885 
886  add("Fixed Delet Mutations - Global", prefix + "delfix", AGE,0,0,
888 
889  add("Fixed Delet Mutations - Local", prefix + "delfixp", AGE,0,0,
891 
892  add("Segregating Delet Mutations - Global", prefix + "delsegr", AGE,0,0,
894 
895  add("Segregating Delet Mutations - Local", prefix + "delsegrp", AGE,0,0,
897 
898  add("Delet Fst", prefix + "delfst", AGE,0,0,
900 
901  add("Lethal Equivalents", prefix + "lethequ", AGE,0,0,
903 
904  add("Heterosis", "heterosis", ADULTS,0,0,
906 
907  add("Genetic Load", "load", ADULTS,0,0,
909 
910 }
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
void setStatsForDeletMutations(age_t AGE)
Definition: ttdeletmutations_bitstring.cc:864
double getHeterosis()
Definition: stats_delet_bitstring.cc:72
double getFixedDeletLoci()
Definition: ttdeletmutations_bitstring.h:301
double getFixedDeletLociPerPatch()
Definition: ttdeletmutations_bitstring.h:302
void setOffsprgDeletStats()
Definition: ttdeletmutations_bitstring.h:285
double getDeletAllHmz()
Definition: ttdeletmutations_bitstring.h:299
virtual StatRecorder< TTDeletMutBitstrSH > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(TTDeletMutBitstrSH::*getStatNoArg)(void), double(TTDeletMutBitstrSH::*getStatOneArg)(unsigned int), double(TTDeletMutBitstrSH::*getStatTwoArg)(unsigned int, unsigned int), void(TTDeletMutBitstrSH::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
double getDeletAllFreq()
Definition: ttdeletmutations_bitstring.h:298
double getFst()
Definition: ttdeletmutations_bitstring.h:308
double getSegregatingDeletLociPerPatch()
Definition: ttdeletmutations_bitstring.h:304
double getLethalEquivalents()
Definition: ttdeletmutations_bitstring.h:309
#define ALL
All ages age class flag.
Definition: types.h:56
double getDeletAllHtz()
Definition: ttdeletmutations_bitstring.h:300
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
The StatHandler for TTDeletMutations_bitstring.
Definition: ttdeletmutations_bitstring.h:253
double getSegregatingDeletLoci()
Definition: ttdeletmutations_bitstring.h:303
double getLoad()
Definition: stats_delet_bitstring.cc:165
void setAdultDeletStats()
Definition: ttdeletmutations_bitstring.h:284
void TTDeletMutBitstrSH::setViability ( age_idx  agex)

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

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 size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
TTrait * getTrait(IDX T)
Trait accessor.
Definition: individual.h:277
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
double _meanViab
Definition: ttdeletmutations_bitstring.h:257
int _SHLinkedTraitIndex
Index of the trait in the Individual::Traits table.
Definition: stathandler.h:173
virtual void * getValue() const =0
Genotype to phenotype mapper.
unsigned int getPedigreeClass()
Returns the pedigree class of the individual, as set during offspring creation.
Definition: individual.h:179
Definition: types.h:37
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double _SibProps[5]
Definition: ttdeletmutations_bitstring.h:257
This class contains traits along with other individual information (sex, pedigree, etc. ).
Definition: individual.h:49
Definition: types.h:37
double _viability[5]
Definition: ttdeletmutations_bitstring.h:257
void TTDeletMutBitstrSH::setViabStats ( age_t  AGE)

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

Referenced by setStatRecorders().

913 {
914  if(AGE == ALL) {
916  return;
917  }
918 
919  string prefix = (AGE == ADULTS ? "adlt." : "off.");
920  void (TTDeletMutBitstrSH::* setter) () = (AGE == ADULTS ?
923 
924  add("Average Viability", prefix + "viab", AGE, 0, 0,
926  setter);
927 
928  add("Outbreds Viability", prefix + "viab.outb", AGE, 0,0,0,
930 
931  add("Inbreds Viability", prefix + "viab.outw", AGE, 1,0,0,
933 
934  add("Half Sibs Viability", prefix + "viab.hsib", AGE, 2,0,0,
936 
937  add("Full Sibs Viability", prefix + "viab.fsib", AGE, 3,0,0,
939 
940  add("Selfed Viability", prefix + "viab.self", AGE, 4,0,0,
942 
943  add("Outbred btw Proportion", prefix + "prop.outb", AGE, 0,0,0,
945 
946  add("Outbred wtn Proportion", prefix + "prop.outw", AGE, 1,0,0,
948 
949  add("Half Sibs Proportion", prefix + "prop.hsibs", AGE, 2,0,0,
951 
952  add("Full Sibs Proportion", prefix + "prop.fsibs", AGE, 3,0,0,
954 
955  add("Selfed Proportion", prefix + "prop.self", AGE, 4,0,0,
957 }
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
void setAdultViab()
Definition: ttdeletmutations_bitstring.h:287
virtual StatRecorder< TTDeletMutBitstrSH > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(TTDeletMutBitstrSH::*getStatNoArg)(void), double(TTDeletMutBitstrSH::*getStatOneArg)(unsigned int), double(TTDeletMutBitstrSH::*getStatTwoArg)(unsigned int, unsigned int), void(TTDeletMutBitstrSH::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
double getViability(unsigned int v)
Definition: ttdeletmutations_bitstring.h:313
#define ALL
All ages age class flag.
Definition: types.h:56
double getMeanViability()
Definition: ttdeletmutations_bitstring.h:314
void setViabStats(age_t AGE)
Definition: ttdeletmutations_bitstring.cc:912
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
void setOffsprgViab()
Definition: ttdeletmutations_bitstring.h:288
The StatHandler for TTDeletMutations_bitstring.
Definition: ttdeletmutations_bitstring.h:253
double getSibProportions(unsigned int i)
Definition: ttdeletmutations_bitstring.h:317

Member Data Documentation

double TTDeletMutBitstrSH::_deletAllCount
private
double* TTDeletMutBitstrSH::_deletFreqTable
private
double TTDeletMutBitstrSH::_deletHmzLoci
private
double TTDeletMutBitstrSH::_deletHtzLoci
private
double TTDeletMutBitstrSH::_fixloc
private

Referenced by getFixedDeletLoci(), and setDeletStats().

double TTDeletMutBitstrSH::_fixLocPerPatch
private
double TTDeletMutBitstrSH::_freq
private

Referenced by getDeletAllFreq(), and setDeletStats().

double TTDeletMutBitstrSH::_Fst
private

Referenced by getFst(), and setFst().

double TTDeletMutBitstrSH::_Hmz
private

Referenced by getDeletAllHmz(), and setDeletStats().

double TTDeletMutBitstrSH::_Ho
private
double TTDeletMutBitstrSH::_Hs
private

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

double TTDeletMutBitstrSH::_Ht
private

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

bool TTDeletMutBitstrSH::_isContinuousEffect
private

Referenced by setLethalEquivalents().

double TTDeletMutBitstrSH::_letheq
private
double TTDeletMutBitstrSH::_meanViab
private
double TTDeletMutBitstrSH::_segrloc
private
double TTDeletMutBitstrSH::_segrLocPerPatch
private
double TTDeletMutBitstrSH::_SibProps[5]
private

Referenced by setViability().

double TTDeletMutBitstrSH::_viability[5]
private

Referenced by setViability().

double TTDeletMutBitstrSH::fecWithHomePatchMate
private

Referenced by getBtheta().

double TTDeletMutBitstrSH::fecWithOtherPatchMate
private

Referenced by getBalpha().


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

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