Nemo  2.3.46
TT_BDMI Class Reference

#include <ttbdmi.h>

+ Inheritance diagram for TT_BDMI:
+ Collaboration diagram for TT_BDMI:

Public Member Functions

 TT_BDMI ()
 
 TT_BDMI (const TT_BDMI &T)
 
virtual ~TT_BDMI ()
 
void set_sequence (bitstring **seq)
 
void inherit_haplo (TTrait *mother, TTrait *father)
 
void inherit_diplo (TTrait *mother, TTrait *father)
 
void mutate_haplo ()
 
void mutate_diplo ()
 
double viability_haplo ()
 
double viability_diplo ()
 
unsigned int get_num_mut_haplo (unsigned int loc)
 
unsigned int get_num_mut_diplo (unsigned int loc)
 
Setters:
void set_nb_locus (int val)
 
void set_mut_rate (double val)
 
void set_geno_rate (double val)
 
void set_recomb_rate (double val)
 
void set_isHaploid (bool val)
 
void set_inherit_func_ptr (void(TT_BDMI::*theFunc)(TTrait *, TTrait *))
 
void set_mutation_func_ptr (void(TT_BDMI::*theFunc)(void))
 
void set_viability_func_ptr (double(TT_BDMI::*theFunc)(void))
 
void set_proto (TProtoBDMI *proto)
 
Implementations
virtual void init ()
 
virtual void init_sequence ()
 
virtual void reset ()
 
virtual void inherit (TTrait *mother, TTrait *father)
 
virtual void mutate ()
 
virtual void * set_trait (void *value)
 
virtual void set_sequence (void **seq)
 
virtual void set_value ()
 
virtual void * getValue () const
 
virtual trait_t get_type () const
 
virtual void ** get_sequence () const
 
virtual double get_allele_value (int loc, int all)
 
virtual void set_allele_value (unsigned int locus, unsigned int allele, double value)
 
virtual void show_up ()
 
virtual TT_BDMIclone ()
 
virtual TT_BDMIoperator= (const TTrait &)
 
virtual bool operator== (const TTrait &)
 
virtual bool operator!= (const TTrait &)
 
virtual void store_data (BinaryStorageBuffer *saver)
 
virtual bool retrieve_data (BinaryStorageBuffer *reader)
 
- Public Member Functions inherited from TTrait
virtual ~TTrait ()
 
- Public Member Functions inherited from StorableComponent
virtual ~StorableComponent ()
 

Private Attributes

TProtoBDMI_myProto
 
bitstring_sequence [2]
 
double _phenotype
 
bool _isHaploid
 
unsigned int _nb_locus
 
double _mut_rate
 
double _genomic_mut_rate
 
double _recomb_rate
 
void(TT_BDMI::* _inherit_func_ptr )(TTrait *, TTrait *)
 
void(TT_BDMI::* _mutation_func_ptr )(void)
 
double(TT_BDMI::* _viability_func_ptr )(void)
 

Static Private Attributes

static unsigned int_recomb_template
 
static unsigned int_rSites
 
static unsigned char * _sites
 
static unsigned int _haploGenotCoding [2][2] = {{0,1},{2,3}}
 
static unsigned int _diploGenotCoding [2][2] = {{0,1},{1,2}}
 

Constructor & Destructor Documentation

TT_BDMI::TT_BDMI ( )
inline

Referenced by clone().

156  {_sequence[0] = _sequence[1] = NULL;}
void(TT_BDMI::* _inherit_func_ptr)(TTrait *, TTrait *)
Definition: ttbdmi.h:142
unsigned int _nb_locus
Definition: ttbdmi.h:137
double _genomic_mut_rate
Definition: ttbdmi.h:139
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
bool _isHaploid
Definition: ttbdmi.h:135
double _phenotype
Definition: ttbdmi.h:133
double _recomb_rate
Definition: ttbdmi.h:140
void(TT_BDMI::* _mutation_func_ptr)(void)
Definition: ttbdmi.h:143
bitstring * _sequence[2]
Definition: ttbdmi.h:131
double _mut_rate
Definition: ttbdmi.h:138
double(TT_BDMI::* _viability_func_ptr)(void)
Definition: ttbdmi.h:144
TT_BDMI::TT_BDMI ( const TT_BDMI T)
inline
163  {_sequence[0] = _sequence[1] = NULL;}
void(TT_BDMI::* _inherit_func_ptr)(TTrait *, TTrait *)
Definition: ttbdmi.h:142
unsigned int _nb_locus
Definition: ttbdmi.h:137
double _genomic_mut_rate
Definition: ttbdmi.h:139
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
bool _isHaploid
Definition: ttbdmi.h:135
double _phenotype
Definition: ttbdmi.h:133
double _recomb_rate
Definition: ttbdmi.h:140
void(TT_BDMI::* _mutation_func_ptr)(void)
Definition: ttbdmi.h:143
bitstring * _sequence[2]
Definition: ttbdmi.h:131
double _mut_rate
Definition: ttbdmi.h:138
double(TT_BDMI::* _viability_func_ptr)(void)
Definition: ttbdmi.h:144
virtual TT_BDMI::~TT_BDMI ( )
inlinevirtual
165 { }

Member Function Documentation

virtual TT_BDMI* TT_BDMI::clone ( )
inlinevirtual

Implements TTrait.

References TT_BDMI().

218 {return new TT_BDMI(*this);}
TT_BDMI()
Definition: ttbdmi.h:153
double TT_BDMI::get_allele_value ( int  loc,
int  all 
)
virtual

Implements TTrait.

References _isHaploid, _myProto, TProtoBDMI::getGenoFitnessDiplo(), and TProtoBDMI::getGenoFitnessHaplo().

330 {
331  if(_isHaploid)
332  return _myProto->getGenoFitnessHaplo(loc, all);
333  else
334  return _myProto->getGenoFitnessDiplo(loc, all);
335 }
double getGenoFitnessDiplo(unsigned int row, unsigned int posA, unsigned int posB)
Definition: ttbdmi.h:89
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
bool _isHaploid
Definition: ttbdmi.h:135
double getGenoFitnessHaplo(unsigned int row, unsigned int pos)
Definition: ttbdmi.h:84
unsigned int TT_BDMI::get_num_mut_diplo ( unsigned int  loc)
inline

Referenced by TTBDMI_SH::countAllele_diplo().

198 {return (*_sequence[0])[loc]+(*_sequence[1])[loc];}
bitstring * _sequence[2]
Definition: ttbdmi.h:131
unsigned int TT_BDMI::get_num_mut_haplo ( unsigned int  loc)
inline

Referenced by TTBDMI_SH::countAllele_haplo().

197 {return (*_sequence[0])[loc];}
bitstring * _sequence[2]
Definition: ttbdmi.h:131
virtual void** TT_BDMI::get_sequence ( ) const
inlinevirtual

Implements TTrait.

213 {return (void**)&_sequence[0];}
bitstring * _sequence[2]
Definition: ttbdmi.h:131
virtual trait_t TT_BDMI::get_type ( ) const
inlinevirtual

Implements TTrait.

References TProtoBDMI::get_type().

212 {return _myProto->get_type();}
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
virtual trait_t get_type() const
Definition: ttbdmi.h:110
virtual void* TT_BDMI::getValue ( ) const
inlinevirtual

Implements TTrait.

References _phenotype.

Referenced by show_up().

211 {return (void*)&_phenotype;}
double _phenotype
Definition: ttbdmi.h:133
virtual void TT_BDMI::inherit ( TTrait mother,
TTrait father 
)
inlinevirtual

Implements TTrait.

References _inherit_func_ptr.

206 {(this->* _inherit_func_ptr) (mother, father);}
void(TT_BDMI::* _inherit_func_ptr)(TTrait *, TTrait *)
Definition: ttbdmi.h:142
void TT_BDMI::inherit_diplo ( TTrait mother,
TTrait father 
)

References _myProto, _sequence, FEM, TTrait::get_sequence(), TProtoBDMI::inherit(), and MAL.

Referenced by TProtoBDMI::setParameters().

407 {
408  bitstring** mother_seq = (bitstring**)mother->get_sequence();
409  bitstring** father_seq = (bitstring**)father->get_sequence();
410 
411  _myProto->inherit(FEM, _sequence[FEM], mother_seq);
412  _myProto->inherit(MAL, _sequence[MAL], father_seq);
413 }
void inherit(sex_t SEX, bitstring *seq, bitstring **parent)
Definition: ttbdmi.cc:232
Non-template and faster implementation of std::bitset.
Definition: bitstring.h:56
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
virtual void ** get_sequence() const =0
sequence accessor.
Definition: types.h:37
bitstring * _sequence[2]
Definition: ttbdmi.h:131
Definition: types.h:37
void TT_BDMI::inherit_haplo ( TTrait mother,
TTrait father 
)

References _myProto, _sequence, TTrait::get_sequence(), TProtoBDMI::inherit(), and MAL.

Referenced by TProtoBDMI::setParameters().

418 {
419  bitstring* gamete[2];
420  gamete[0] = (bitstring*)(mother->get_sequence()[0]);
421  gamete[1] = (bitstring*)(father->get_sequence()[0]);
422 
423  _myProto->inherit(MAL, _sequence[0], &gamete[0]);
424 }
void inherit(sex_t SEX, bitstring *seq, bitstring **parent)
Definition: ttbdmi.cc:232
Non-template and faster implementation of std::bitset.
Definition: bitstring.h:56
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
virtual void ** get_sequence() const =0
sequence accessor.
Definition: types.h:37
bitstring * _sequence[2]
Definition: ttbdmi.h:131
void TT_BDMI::init ( )
virtual

Implements TTrait.

References _isHaploid, _nb_locus, _sequence, and fatal().

Referenced by operator=(), and set_sequence().

349 {
350  if(_sequence[0] != NULL) fatal("TT_BDMI::init::_sequence[0] is not NULL !\n");
351  if(!_isHaploid && _sequence[1] != NULL) fatal("TT_BDMI::init::_sequence[1] is not NULL !\n");
352 
353  _sequence[0] = new bitstring(_nb_locus);
354  if(!_isHaploid) _sequence[1] = new bitstring(_nb_locus);
355 }
Non-template and faster implementation of std::bitset.
Definition: bitstring.h:56
unsigned int _nb_locus
Definition: ttbdmi.h:137
void fatal(const char *str,...)
Definition: output.cc:90
bool _isHaploid
Definition: ttbdmi.h:135
bitstring * _sequence[2]
Definition: ttbdmi.h:131
void TT_BDMI::init_sequence ( )
virtual

Implements TTrait.

References _isHaploid, _myProto, _nb_locus, _sequence, TProtoBDMI::get_init_freq(), TProtoBDMI::isInitSet(), bitstring::reset(), and RAND::Uniform().

Referenced by LCE_Init_BDMI::init_value().

380 {
381  if(_sequence[0] == NULL) _sequence[0] = new bitstring(_nb_locus);
382 
383  _sequence[0]->reset(); //sets all bits to 0
384 
385  if(!_isHaploid){
386  if(_sequence[1] == NULL) _sequence[1] = new bitstring(_nb_locus);
387  _sequence[1]->reset();
388  }
389 
390  if(_myProto->isInitSet()) {
391 
392  for(unsigned int i = 0; i < _nb_locus; i++) {
393  if( RAND::Uniform() < _myProto->get_init_freq(i) )
394  _sequence[0]->set(i);
395 
396  if( !_isHaploid )
397  if ( RAND::Uniform() < _myProto->get_init_freq(i) )
398  _sequence[1]->set(i);
399  }
400  }
401 
402 }
double get_init_freq(unsigned int i)
Definition: ttbdmi.h:81
Non-template and faster implementation of std::bitset.
Definition: bitstring.h:56
unsigned int _nb_locus
Definition: ttbdmi.h:137
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
void reset()
Set all bits to 0.
Definition: bitstring.h:251
bool _isHaploid
Definition: ttbdmi.h:135
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
bitstring * _sequence[2]
Definition: ttbdmi.h:131
bool isInitSet()
Definition: ttbdmi.h:82
virtual void TT_BDMI::mutate ( )
inlinevirtual

Implements TTrait.

References _mutation_func_ptr.

207 {(this->*_mutation_func_ptr)();}
void(TT_BDMI::* _mutation_func_ptr)(void)
Definition: ttbdmi.h:143
void TT_BDMI::mutate_diplo ( )

References _genomic_mut_rate, _nb_locus, _sequence, bitstring::flip(), RAND::Poisson(), RAND::RandBool(), and RAND::Uniform().

Referenced by TProtoBDMI::setParameters().

446 {
447  unsigned int NbMut;
448 
449  NbMut = (unsigned int)RAND::Poisson(_genomic_mut_rate);
450 
451  while(NbMut != 0) {
452 
454 
455  NbMut--;
456  }
457 }
unsigned int _nb_locus
Definition: ttbdmi.h:137
static double Poisson(double mean)
From the Numerical Recieps.
Definition: Uniform.h:196
double _genomic_mut_rate
Definition: ttbdmi.h:139
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:139
bitstring * _sequence[2]
Definition: ttbdmi.h:131
void flip(size_t n)
Flip the bit at n.
Definition: bitstring.h:238
void TT_BDMI::mutate_haplo ( )

References _genomic_mut_rate, _nb_locus, _sequence, bitstring::flip(), RAND::Poisson(), and RAND::Uniform().

Referenced by TProtoBDMI::setParameters().

430 {
431  unsigned int NbMut;
432 
433  NbMut = (unsigned int)RAND::Poisson(_genomic_mut_rate);
434 
435  while(NbMut != 0) {
436 
438 
439  NbMut--;
440  }
441 }
unsigned int _nb_locus
Definition: ttbdmi.h:137
static double Poisson(double mean)
From the Numerical Recieps.
Definition: Uniform.h:196
double _genomic_mut_rate
Definition: ttbdmi.h:139
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
bitstring * _sequence[2]
Definition: ttbdmi.h:131
void flip(size_t n)
Flip the bit at n.
Definition: bitstring.h:238
bool TT_BDMI::operator!= ( const TTrait T)
virtual

Implements TTrait.

320 {
321  if(!((*this) == T))
322  return true;
323  else
324  return false;
325 }
TT_BDMI & TT_BDMI::operator= ( const TTrait T)
virtual

Implements TTrait.

References _isHaploid, _nb_locus, _sequence, bitstring::copy(), init(), reset(), and set_value().

278 {
279  const TT_BDMI& TD = dynamic_cast<const TT_BDMI&> (T);
280  if(this != &TD) {
281 
282  _nb_locus = TD._nb_locus;
283 // _mut_rate = TD._mut_rate;
284 // _recomb_rate = TD._recomb_rate;
285 // _genomic_mut_rate = TD._genomic_mut_rate;
286  _isHaploid = TD._isHaploid;
287 // _inherit_func_ptr = TD._inherit_func_ptr;
288 // _mutation_func_ptr = TD._mutation_func_ptr;
289 // _viability_func_ptr = TD._viability_func_ptr;
290  //deallocate any previous _sequence memory:
291  reset();
292  //allocate _sequence memory:
293  init();
294  //copy _sequence:
295  _sequence[0]->copy(*TD._sequence[0]);
296  if(!_isHaploid) _sequence[1]->copy(*TD._sequence[1]);
297 
298  set_value();
299  }
300  return *this;
301 }
Definition: ttbdmi.h:127
unsigned int _nb_locus
Definition: ttbdmi.h:137
void copy(const bitstring &b)
Unchecked copy, assumes we have sames sizes.
Definition: bitstring.h:255
virtual void set_value()
Definition: ttbdmi.h:210
virtual void reset()
Definition: ttbdmi.cc:359
bool _isHaploid
Definition: ttbdmi.h:135
virtual void init()
Definition: ttbdmi.cc:348
bitstring * _sequence[2]
Definition: ttbdmi.h:131
bool TT_BDMI::operator== ( const TTrait T)
virtual

Implements TTrait.

References _isHaploid, _myProto, _nb_locus, TTrait::get_type(), and TProtoBDMI::get_type().

306 {
307  if(_myProto->get_type().compare(T.get_type()) != 0) return false;
308 
309  const TT_BDMI& TD = dynamic_cast<const TT_BDMI&> (T);
310  if(this != &TD) {
311  if(_nb_locus != TD._nb_locus) return false;
312  if(_isHaploid != TD._isHaploid) return false;
313  }
314  return true;
315 }
Definition: ttbdmi.h:127
unsigned int _nb_locus
Definition: ttbdmi.h:137
virtual trait_t get_type() const =0
type accessor.
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
bool _isHaploid
Definition: ttbdmi.h:135
virtual trait_t get_type() const
Definition: ttbdmi.h:110
void TT_BDMI::reset ( )
virtual

Implements TTrait.

References _isHaploid, and _sequence.

Referenced by operator=(), and set_sequence().

360 {
361  if(_sequence[0] != NULL) delete _sequence[0];
362  if(!_isHaploid && _sequence[1] != NULL) delete _sequence[1];
363 
364  _sequence[0] = NULL;
365  _sequence[1] = NULL;
366 }
bool _isHaploid
Definition: ttbdmi.h:135
bitstring * _sequence[2]
Definition: ttbdmi.h:131
virtual bool TT_BDMI::retrieve_data ( BinaryStorageBuffer reader)
inlinevirtual

Implements StorableComponent.

224 {return true;}
void TT_BDMI::set_allele_value ( unsigned int  locus,
unsigned int  allele,
double  value 
)
virtual

Implements TTrait.

References _myProto, and TProtoBDMI::setGenoFitnessValue().

342 {
343  _myProto->setGenoFitnessValue(locus, allele, value);
344 }
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
void setGenoFitnessValue(unsigned int row, unsigned int geno, double value)
Definition: ttbdmi.h:98
void TT_BDMI::set_geno_rate ( double  val)
inline

Referenced by TProtoBDMI::hatch().

171 {_genomic_mut_rate = val;}
double _genomic_mut_rate
Definition: ttbdmi.h:139
void TT_BDMI::set_inherit_func_ptr ( void(TT_BDMI::*)(TTrait *, TTrait *)  theFunc)
inline

References _inherit_func_ptr.

Referenced by TProtoBDMI::hatch().

175  {_inherit_func_ptr = theFunc;}
void(TT_BDMI::* _inherit_func_ptr)(TTrait *, TTrait *)
Definition: ttbdmi.h:142
void TT_BDMI::set_isHaploid ( bool  val)
inline

Referenced by TProtoBDMI::hatch().

173 {_isHaploid = val;}
bool _isHaploid
Definition: ttbdmi.h:135
void TT_BDMI::set_mut_rate ( double  val)
inline

Referenced by TProtoBDMI::hatch().

170 {_mut_rate = val;}
double _mut_rate
Definition: ttbdmi.h:138
void TT_BDMI::set_mutation_func_ptr ( void(TT_BDMI::*)(void)  theFunc)
inline

References _mutation_func_ptr.

Referenced by TProtoBDMI::hatch().

177  {_mutation_func_ptr = theFunc;}
void(TT_BDMI::* _mutation_func_ptr)(void)
Definition: ttbdmi.h:143
void TT_BDMI::set_nb_locus ( int  val)
inline

Referenced by TProtoBDMI::hatch().

169 {_nb_locus = val;}
unsigned int _nb_locus
Definition: ttbdmi.h:137
void TT_BDMI::set_proto ( TProtoBDMI proto)
inline

Referenced by TProtoBDMI::hatch().

181 {_myProto = proto;}
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
void TT_BDMI::set_recomb_rate ( double  val)
inline
172 {_recomb_rate = val;}
double _recomb_rate
Definition: ttbdmi.h:140
void TT_BDMI::set_sequence ( bitstring **  seq)

References _isHaploid, _sequence, bitstring::copy(), init(), and reset().

371 {
372  reset(); init();
373  _sequence[0]->copy(*seq[0]);
374  if(!_isHaploid) _sequence[1]->copy(*seq[1]);
375 }
void copy(const bitstring &b)
Unchecked copy, assumes we have sames sizes.
Definition: bitstring.h:255
virtual void reset()
Definition: ttbdmi.cc:359
bool _isHaploid
Definition: ttbdmi.h:135
virtual void init()
Definition: ttbdmi.cc:348
bitstring * _sequence[2]
Definition: ttbdmi.h:131
virtual void TT_BDMI::set_sequence ( void **  seq)
inlinevirtual

Implements TTrait.

209 {}
virtual void* TT_BDMI::set_trait ( void *  value)
inlinevirtual

Implements TTrait.

208 {return NULL;}
virtual void TT_BDMI::set_value ( )
inlinevirtual

Implements TTrait.

References _viability_func_ptr.

Referenced by LCE_Init_BDMI::init_value(), operator=(), and show_up().

210 {_phenotype = (this->*_viability_func_ptr)();}
double _phenotype
Definition: ttbdmi.h:133
double(TT_BDMI::* _viability_func_ptr)(void)
Definition: ttbdmi.h:144
void TT_BDMI::set_viability_func_ptr ( double(TT_BDMI::*)(void)  theFunc)
inline

References _viability_func_ptr.

Referenced by TProtoBDMI::hatch().

179  {_viability_func_ptr = theFunc;}
double(TT_BDMI::* _viability_func_ptr)(void)
Definition: ttbdmi.h:144
void TT_BDMI::show_up ( )
virtual

Implements TTrait.

References _isHaploid, _myProto, _nb_locus, _sequence, getValue(), set_value(), and TProtoBDMI::showGenoTable().

496 {
497  set_value();
498  std::cout<<"\n Trait type: dmi"
499  <<"\n value: "<<*(double*)getValue()
500  <<"\n num loci: "<<_nb_locus
501  <<"\nfitness table: "<<endl;
503 
504  cout<<"\n sequence: "<<endl;
505  cout<<"0: ";
506  for(unsigned int i = 0; i < _nb_locus && i < 64; i++)
507  cout<<(unsigned int)(*_sequence[0])[i];
508  cout<<endl;
509 
510  if(!_isHaploid) {
511  cout<<"1: ";
512  for(unsigned int i = 0; i < _nb_locus && i < 64; i++)
513  cout<<(unsigned int)(*_sequence[1])[i];
514  }
515  cout<<endl;
516 }
virtual void * getValue() const
Definition: ttbdmi.h:211
unsigned int _nb_locus
Definition: ttbdmi.h:137
virtual void set_value()
Definition: ttbdmi.h:210
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
bool _isHaploid
Definition: ttbdmi.h:135
void showGenoTable(unsigned int nrows)
Definition: ttbdmi.cc:212
bitstring * _sequence[2]
Definition: ttbdmi.h:131
virtual void TT_BDMI::store_data ( BinaryStorageBuffer saver)
inlinevirtual

Implements StorableComponent.

223 {}
double TT_BDMI::viability_diplo ( )

References _diploGenotCoding, _myProto, _nb_locus, _sequence, and TProtoBDMI::getGenoFitnessDiplo().

Referenced by TProtoBDMI::setParameters().

476 {
477  unsigned int npair = _nb_locus/2;
478  double viab = 1;
479 //cout << "\nTT_BDMI::viability_diplo\n";
480 // cout << " sequence[0].size(): "<<(*_sequence[0]).size()
481 // << " sequence[0].nb_words(): "<<(*_sequence[0]).nb_words()<<endl;
482 // cout << " sequence[1].size(): "<<(*_sequence[1]).size()
483 // << " sequence[1].nb_words(): "<<(*_sequence[1]).nb_words()<<endl;
484 
485  for (unsigned int pair = 0, i = 0; pair < npair && i < _nb_locus; ++pair) {
486  viab *= 1 + _myProto->getGenoFitnessDiplo( pair , //locus number
487  _diploGenotCoding[ (*_sequence[0])[i] ][ (*_sequence[1])[i++] ], //first locus
488  _diploGenotCoding[ (*_sequence[0])[i] ][ (*_sequence[1])[i++] ]); //second locus
489  }
490  return viab;
491 }
double getGenoFitnessDiplo(unsigned int row, unsigned int posA, unsigned int posB)
Definition: ttbdmi.h:89
unsigned int _nb_locus
Definition: ttbdmi.h:137
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
bitstring * _sequence[2]
Definition: ttbdmi.h:131
static unsigned int _diploGenotCoding[2][2]
Definition: ttbdmi.h:149
double TT_BDMI::viability_haplo ( )

References _haploGenotCoding, _myProto, _nb_locus, _sequence, and TProtoBDMI::getGenoFitnessHaplo().

Referenced by TProtoBDMI::setParameters().

462 {
463  unsigned int npair = _nb_locus/2;
464  double viab = 1;
465 
466  for (unsigned int pair = 0, i = 0; pair < npair && i < _nb_locus; ++pair) {
467  viab *= 1 + _myProto->getGenoFitnessHaplo( pair ,
468  _haploGenotCoding[ (*_sequence[0])[i++] ][ (*_sequence[0])[i++] ]);
469  }
470  return viab;
471 }
unsigned int _nb_locus
Definition: ttbdmi.h:137
TProtoBDMI * _myProto
Definition: ttbdmi.h:129
double getGenoFitnessHaplo(unsigned int row, unsigned int pos)
Definition: ttbdmi.h:84
static unsigned int _haploGenotCoding[2][2]
Definition: ttbdmi.h:148
bitstring * _sequence[2]
Definition: ttbdmi.h:131

Member Data Documentation

unsigned int TT_BDMI::_diploGenotCoding = {{0,1},{1,2}}
staticprivate

Referenced by viability_diplo().

double TT_BDMI::_genomic_mut_rate
private

Referenced by mutate_diplo(), and mutate_haplo().

unsigned int TT_BDMI::_haploGenotCoding = {{0,1},{2,3}}
staticprivate

Referenced by viability_haplo().

void(TT_BDMI::* TT_BDMI::_inherit_func_ptr)(TTrait *, TTrait *)
private

Referenced by inherit(), and set_inherit_func_ptr().

bool TT_BDMI::_isHaploid
private
double TT_BDMI::_mut_rate
private
void(TT_BDMI::* TT_BDMI::_mutation_func_ptr)(void)
private

Referenced by mutate(), and set_mutation_func_ptr().

double TT_BDMI::_phenotype
private

Referenced by getValue().

double TT_BDMI::_recomb_rate
private
unsigned int* TT_BDMI::_recomb_template
staticprivate
unsigned int * TT_BDMI::_rSites
staticprivate
unsigned char* TT_BDMI::_sites
staticprivate
double(TT_BDMI::* TT_BDMI::_viability_func_ptr)(void)
private

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

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