Nemo  2.4.2
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
TTDeletMutations_bitstring Class Reference

Bitstring implementation of TTDeletMutations with recombination. More...

#include <ttdeletmutations_bitstring.h>

+ Inheritance diagram for TTDeletMutations_bitstring:
+ Collaboration diagram for TTDeletMutations_bitstring:

Public Member Functions

 TTDeletMutations_bitstring ()
 
 TTDeletMutations_bitstring (const TTDeletMutations_bitstring &T)
 
virtual ~TTDeletMutations_bitstring ()
 
double viability_multi ()
 
double viability_epist ()
 
double viability_multi_continuous ()
 
double viability_epist_continuous ()
 
void mutate_redraw ()
 
void mutate_noredraw ()
 
void mutate_noredraw_noBackMutation ()
 
void set_sequence (bitstring **seq)
 
Getters:
unsigned int get_nb_mutations () const
 
unsigned int get_nb_mut_atLocus (unsigned int loc) const
 
unsigned int get_nb_htz_mutations () const
 
unsigned int get_nb_hmz_mutations () const
 
bool get_hmz_atLocus (unsigned int loc) const
 
bool get_htz_atLocus (unsigned int loc) const
 
Setters:
void set_proto (TProtoDeletMutations_bitstring *proto)
 
void set_nb_locus (int val)
 
void set_mut_rate (double val, int nloc)
 
void set_is_continuous (bool val)
 
void set_viability_func_ptr (unsigned int f_model, bool is_cont)
 
void set_inherit_func_ptr (void(TProtoDeletMutations_bitstring::*theFunc)(sex_t, bitstring *, bitstring **))
 
void set_mutation_func_ptr (unsigned int m_model)
 
Implementations
virtual void init ()
 
virtual void init_sequence ()
 
virtual void reset ()
 
virtual void * set_trait (void *value)
 
virtual void ** get_sequence () const
 
virtual unsigned int get_allele (int loc, int all) const
 
virtual double get_allele_value (int loc, int all) const
 
virtual void set_allele_value (unsigned int locus, unsigned int allele, double value)
 
virtual void set_sequence (void **seq)
 
virtual trait_t get_type () const
 
virtual void inherit (const TTrait *mother, const TTrait *father)
 
virtual void mutate ()
 
virtual void set_value ()
 
virtual void * getValue () const
 
virtual void show_up ()
 
virtual TTDeletMutations_bitstringclone ()
 
virtual TTDeletMutations_bitstringoperator= (const TTrait &T)
 
virtual bool operator== (const TTrait &T)
 
virtual bool operator!= (const TTrait &T)
 
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 ()
 

Static Public Member Functions

static void set_effects (float **fx)
 
static void set_recomb_template (unsigned int size)
 

Private Member Functions

void set_nb_mutations ()
 
void set_nb_htz_mutations ()
 
void set_nb_hmz_mutations ()
 
void set_counts_and_bitstrings ()
 

Private Attributes

TProtoDeletMutations_bitstring_myProto
 
bool _is_continuous
 
unsigned int _nb_mutations
 
unsigned int _nb_hmz_mutations
 
unsigned int _nb_htz_mutations
 
bitstringsequence [2]
 
bitstring_htz
 
bitstring_hmz
 
double _phenotype
 
trait_t _type
 
Parameters
unsigned int _nb_locus
 
double _genomic_mut_rate
 
double(TTDeletMutations_bitstring::* _viability_func_ptr )(void)
 
void(TProtoDeletMutations_bitstring::* _inherit_func_ptr )(sex_t, bitstring *, bitstring **)
 
void(TTDeletMutations_bitstring::* _mutation_func_ptr )(void)
 

Detailed Description

Bitstring implementation of TTDeletMutations with recombination.

Constructor & Destructor Documentation

◆ TTDeletMutations_bitstring() [1/2]

TTDeletMutations_bitstring::TTDeletMutations_bitstring ( )
inline
90  _phenotype(0), _type(DELE)
91  {sequence[0] = sequence[1] = NULL;}
TProtoDeletMutations_bitstring * _myProto
Definition: ttdeletmutations_bitstring.h:49
bool _is_continuous
Definition: ttdeletmutations_bitstring.h:64
unsigned int _nb_htz_mutations
Definition: ttdeletmutations_bitstring.h:69
double _phenotype
Definition: ttdeletmutations_bitstring.h:73
bitstring * _htz
Definition: ttdeletmutations_bitstring.h:72
unsigned int _nb_hmz_mutations
Definition: ttdeletmutations_bitstring.h:68
double _genomic_mut_rate
Definition: ttdeletmutations_bitstring.h:54
unsigned int _nb_mutations
Definition: ttdeletmutations_bitstring.h:67
unsigned int _nb_locus
Definition: ttdeletmutations_bitstring.h:53
double(TTDeletMutations_bitstring::* _viability_func_ptr)(void)
Definition: ttdeletmutations_bitstring.h:56
trait_t _type
Definition: ttdeletmutations_bitstring.h:75
void(TTDeletMutations_bitstring::* _mutation_func_ptr)(void)
Definition: ttdeletmutations_bitstring.h:58
bitstring * _hmz
Definition: ttdeletmutations_bitstring.h:72
void(TProtoDeletMutations_bitstring::* _inherit_func_ptr)(sex_t, bitstring *, bitstring **)
Definition: ttdeletmutations_bitstring.h:57
bitstring * sequence[2]
Definition: ttdeletmutations_bitstring.h:71
#define DELE
Definition: types.h:64

References sequence.

Referenced by clone().

+ Here is the caller graph for this function:

◆ TTDeletMutations_bitstring() [2/2]

TTDeletMutations_bitstring::TTDeletMutations_bitstring ( const TTDeletMutations_bitstring T)
inline

◆ ~TTDeletMutations_bitstring()

virtual TTDeletMutations_bitstring::~TTDeletMutations_bitstring ( )
inlinevirtual
102 {reset();}
virtual void reset()
Definition: ttdeletmutations_bitstring.cc:653

References reset().

Member Function Documentation

◆ clone()

virtual TTDeletMutations_bitstring* TTDeletMutations_bitstring::clone ( )
inlinevirtual

Implements TTrait.

159 {return new TTDeletMutations_bitstring(*this);}
TTDeletMutations_bitstring()
Definition: ttdeletmutations_bitstring.h:86

References TTDeletMutations_bitstring().

◆ get_allele()

unsigned int TTDeletMutations_bitstring::get_allele ( int  loc,
int  all 
) const
virtual

Implements TTrait.

694 {
695  return (*sequence[all])[loc];
696 }

References sequence.

◆ get_allele_value()

double TTDeletMutations_bitstring::get_allele_value ( int  loc,
int  all 
) const
virtual

Implements TTrait.

681 {
682  if((*sequence[all])[loc]) {
683  if(get_hmz_atLocus(loc)) return _myProto->get_effect(1, loc);
684  else return _myProto->get_effect(0, loc);
685  } else {
686  if(get_hmz_atLocus(loc)) return 0;
687  else return _myProto->get_effect(0, loc);
688  }
689 }
float get_effect(unsigned int at, unsigned int loc)
Definition: ttdeletmutations_bitstring.h:196
bool get_hmz_atLocus(unsigned int loc) const
Definition: ttdeletmutations_bitstring.h:111

References _myProto, TProtoDeletMutations_bitstring::get_effect(), get_hmz_atLocus(), and sequence.

◆ get_hmz_atLocus()

bool TTDeletMutations_bitstring::get_hmz_atLocus ( unsigned int  loc) const
inline
111 {return (*sequence[0])[loc] & (*sequence[1])[loc];}

References sequence.

Referenced by get_allele_value().

+ Here is the caller graph for this function:

◆ get_htz_atLocus()

bool TTDeletMutations_bitstring::get_htz_atLocus ( unsigned int  loc) const
inline
112 {return (*sequence[0])[loc] ^ (*sequence[1])[loc];}

References sequence.

◆ get_nb_hmz_mutations()

unsigned int TTDeletMutations_bitstring::get_nb_hmz_mutations ( ) const
inline
110 {return _nb_hmz_mutations;}

References _nb_hmz_mutations.

Referenced by TTDeletMutBitstrSH::setDeletStats(), and show_up().

+ Here is the caller graph for this function:

◆ get_nb_htz_mutations()

unsigned int TTDeletMutations_bitstring::get_nb_htz_mutations ( ) const
inline
109 {return _nb_htz_mutations;}

References _nb_htz_mutations.

Referenced by TTDeletMutBitstrSH::setDeletStats(), and show_up().

+ Here is the caller graph for this function:

◆ get_nb_mut_atLocus()

unsigned int TTDeletMutations_bitstring::get_nb_mut_atLocus ( unsigned int  loc) const
inline
108 {return (*sequence[0])[loc] + (*sequence[1])[loc];}

References sequence.

◆ get_nb_mutations()

unsigned int TTDeletMutations_bitstring::get_nb_mutations ( ) const
inline
107 {return _nb_mutations;}

References _nb_mutations.

Referenced by show_up().

+ Here is the caller graph for this function:

◆ get_sequence()

virtual void** TTDeletMutations_bitstring::get_sequence ( ) const
inlinevirtual

Implements TTrait.

147 {return (void**)&sequence[0];}

References sequence.

Referenced by TTDeletMutBitstrSH::setDeletStats().

+ Here is the caller graph for this function:

◆ get_type()

virtual trait_t TTDeletMutations_bitstring::get_type ( ) const
inlinevirtual

Implements TTrait.

153 {return _type;}

References _type.

◆ getValue()

virtual void* TTDeletMutations_bitstring::getValue ( ) const
inlinevirtual

Implements TTrait.

157 {return (void*)&_phenotype;}

References _phenotype.

Referenced by show_up().

+ Here is the caller graph for this function:

◆ inherit()

void TTDeletMutations_bitstring::inherit ( const TTrait mother,
const TTrait father 
)
virtual

Implements TTrait.

757 {
758  bitstring** mother_seq = (bitstring**)mother->get_sequence();
759  bitstring** father_seq = (bitstring**)father->get_sequence();
760 
761  (_myProto->* _inherit_func_ptr) (FEM, sequence[FEM], mother_seq);
762 
763  (_myProto->* _inherit_func_ptr) (MAL, sequence[MAL], father_seq);
764 }
virtual void ** get_sequence() const =0
sequence accessor.
Non-template and faster implementation of std::bitset.
Definition: bitstring.h:53
@ FEM
Definition: types.h:35
@ MAL
Definition: types.h:35

References _inherit_func_ptr, _myProto, FEM, TTrait::get_sequence(), MAL, and sequence.

◆ init()

void TTDeletMutations_bitstring::init ( )
virtual

Implements TTrait.

637 {
638  if(sequence[0] != NULL)
639  fatal("TTDeletMutations_bitstring::init::sequence[0] is not NULL !\n");
640 
641  if(sequence[1] != NULL)
642  fatal("TTDeletMutations_bitstring::init::sequence[1] is not NULL !\n");
643 
644  sequence[0] = new bitstring(_nb_locus);
645  sequence[1] = new bitstring(_nb_locus);
646 
647  _htz = new bitstring(_nb_locus);
648  _hmz = new bitstring(_nb_locus);
649 }
void fatal(const char *str,...)
Definition: output.cc:98

References _hmz, _htz, _nb_locus, fatal(), and sequence.

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

+ Here is the caller graph for this function:

◆ init_sequence()

void TTDeletMutations_bitstring::init_sequence ( )
virtual

Implements TTrait.

724 {
725  if(sequence[0] == NULL) sequence[0] = new bitstring(_nb_locus);
726 
727  if(sequence[1] == NULL) sequence[1] = new bitstring(_nb_locus);
728 
729  unsigned int nb_mut, locus;
730 
731  sequence[0]->reset();
732  sequence[1]->reset();
733 
734  if(_myProto->get_init_freq() != 0) {
735 
736  nb_mut = (unsigned int)(_myProto->get_init_freq()*_nb_locus*2);
737 
738  for(unsigned int i = 0; i < nb_mut; i++) {
739 
740  do {
741  locus = RAND::Uniform( _nb_locus );
742  //check if the locus is not already homozygote:
743  } while( (*sequence[0])[ locus ] && (*sequence[1])[ locus ] );
744 
745  if((*sequence[0])[ locus ])
746  sequence[1]->set(locus);
747  else
748  sequence[0]->set(locus);
749  }
750 
751  }
752 }
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:125
double get_init_freq()
Definition: ttdeletmutations_bitstring.h:191
void set(size_t n)
Set a bit to 1.
Definition: bitstring.h:332
void reset(size_t length)
Definition: bitstring.h:136

References _myProto, _nb_locus, TProtoDeletMutations_bitstring::get_init_freq(), bitstring::reset(), sequence, bitstring::set(), and RAND::Uniform().

◆ mutate()

virtual void TTDeletMutations_bitstring::mutate ( )
inlinevirtual

Implements TTrait.

155 {(this->*_mutation_func_ptr)();}

References _mutation_func_ptr.

◆ mutate_noredraw()

void TTDeletMutations_bitstring::mutate_noredraw ( )
798 {
799  unsigned int NbMut, mut_locus, mut_chrom;
800 
801  NbMut = (unsigned int)RAND::Poisson(_genomic_mut_rate);
802 
803  while(NbMut != 0) {
804 
805  mut_locus = RAND::Uniform( _nb_locus ); // choose the locus that is going to mutate
806  mut_chrom = RAND::RandBool(); // which chromosome of the two will we mutate
807 
808  // has it already mutated in the past?
809  if( (*sequence[mut_chrom])[mut_locus] ) {
810 
811  // true if there is already a mutation there because that would =1
812  // maybe backmutate (this has a reduced prob)
813  // draw a new rand num and if of some value, proceed with backmutation
814 
816  { // by default, 1% of the time do a backmutation once we get here
817 
818  //backmutate:
819  sequence[mut_chrom]->flip(mut_locus); // change to the other number at that locus (0 to 1 or vice versa)
820 
821  }
822 
823  } else {
824  // or forward mutate
825  sequence[mut_chrom]->set(mut_locus);
826  }
827 
828  NbMut--;
829  }
830 }
static double Poisson(double mean)
From the Numerical Recieps.
Definition: Uniform.h:229
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:170
double get_backmutation_rate()
Definition: ttdeletmutations_bitstring.h:186
void flip(size_t n)
Flip the bit at n.
Definition: bitstring.h:343

References _genomic_mut_rate, _myProto, _nb_locus, bitstring::flip(), TProtoDeletMutations_bitstring::get_backmutation_rate(), RAND::Poisson(), RAND::RandBool(), sequence, bitstring::set(), and RAND::Uniform().

Referenced by set_mutation_func_ptr().

+ Here is the caller graph for this function:

◆ mutate_noredraw_noBackMutation()

void TTDeletMutations_bitstring::mutate_noredraw_noBackMutation ( )
835 {
836  unsigned int NbMut = (unsigned int)RAND::Poisson(_genomic_mut_rate);
837 
838  while(NbMut != 0) {
839 
841 
842  NbMut--;
843  }
844 
845 }

References _genomic_mut_rate, _nb_locus, RAND::Poisson(), RAND::RandBool(), sequence, bitstring::set(), and RAND::Uniform().

Referenced by set_mutation_func_ptr().

+ Here is the caller graph for this function:

◆ mutate_redraw()

void TTDeletMutations_bitstring::mutate_redraw ( )
770 {
771  unsigned int NbMut, mutLocus;
772 
773  NbMut = (unsigned int)RAND::Poisson(_genomic_mut_rate);
774 
775  if( (int)_nb_hmz_mutations - (int)NbMut < 0 ) NbMut -= _nb_hmz_mutations;
776 
777  while(NbMut != 0) {
778 
779  do {
780  mutLocus = RAND::Uniform( _nb_locus );
781  //check if the locus is not already homozygote:
782  } while( (*sequence[0])[mutLocus] && (*sequence[1])[mutLocus] );
783 
784  if ( !( (*sequence[0])[mutLocus] || (*sequence[1])[mutLocus] ) )
785  sequence[RAND::RandBool()]->set(mutLocus);
786  else if((*sequence[0])[mutLocus])
787  sequence[1]->set(mutLocus);
788  else
789  sequence[0]->set(mutLocus);
790 
791  NbMut--;
792  }
793 }

References _genomic_mut_rate, _nb_hmz_mutations, _nb_locus, RAND::Poisson(), RAND::RandBool(), sequence, bitstring::set(), and RAND::Uniform().

Referenced by set_mutation_func_ptr().

+ Here is the caller graph for this function:

◆ operator!=()

bool TTDeletMutations_bitstring::operator!= ( const TTrait T)
virtual

Implements TTrait.

585 {
586  if(!((*this) == T))
587  return true;
588  else
589  return false;
590 }

◆ operator=()

TTDeletMutations_bitstring & TTDeletMutations_bitstring::operator= ( const TTrait T)
virtual

Implements TTrait.

547 {
548  const TTDeletMutations_bitstring& TD = dynamic_cast<const TTDeletMutations_bitstring&> (T);
549 
550  if(this != &TD) {
551 
552  _nb_locus = TD._nb_locus;
553 
554  //deallocate any previous sequence memory:
555  reset();
556 
557  //allocate sequence memory:
558  init();
559 
560  //copy sequence:
561  sequence[0]->copy(*TD.sequence[0]);
562  sequence[1]->copy(*TD.sequence[1]);
563 
564  set_value();
565  }
566  return *this;
567 }
Bitstring implementation of TTDeletMutations with recombination.
Definition: ttdeletmutations_bitstring.h:45
virtual void set_value()
Definition: ttdeletmutations_bitstring.cc:849
virtual void init()
Definition: ttdeletmutations_bitstring.cc:636
void copy(const bitstring &b)
Unchecked copy, assumes we have sames sizes.
Definition: bitstring.h:357

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

◆ operator==()

bool TTDeletMutations_bitstring::operator== ( const TTrait T)
virtual

Implements TTrait.

572 {
573  if( _type != T.get_type() ) return false;
574 
575  const TTDeletMutations_bitstring& TD = dynamic_cast<const TTDeletMutations_bitstring&> (T);
576  if(this != &TD) {
577  if(_nb_locus != TD._nb_locus) return false;
578  }
579  return true;
580 }
virtual trait_t get_type() const =0
type accessor.

References _nb_locus, _type, and TTrait::get_type().

◆ reset()

void TTDeletMutations_bitstring::reset ( )
virtual

Implements TTrait.

654 {
655  if(sequence[0] != NULL) delete sequence[0];
656  if(sequence[1] != NULL) delete sequence[1];
657 
658  sequence[0] = NULL;
659  sequence[1] = NULL;
660 
661  if(_htz != NULL) delete _htz;
662  _htz = 0;
663 
664  if(_hmz != NULL) delete _hmz;
665  _hmz = 0;
666 }

References _hmz, _htz, and sequence.

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

+ Here is the caller graph for this function:

◆ retrieve_data()

bool TTDeletMutations_bitstring::retrieve_data ( BinaryStorageBuffer reader)
virtual

Implements StorableComponent.

1000 {
1001  size_t wnb = sequence[0]->nb_words();
1002  size_t bytes = wnb * sizeof(bitstring::_ul);
1003  bitstring::_ul *srce = new bitstring::_ul [wnb];
1004 
1005  reader->read(srce, bytes);
1006  sequence[0]->set_data(srce,wnb);
1007 
1008  reader->read(srce, bytes);
1009  sequence[1]->set_data(srce,wnb);
1010 
1011  delete [] srce;
1012 
1013  return true;
1014 }
void read(void *out, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:219
unsigned long _ul
Definition: bitstring.h:57
void set_data(_ul *srce, size_t nbwrd)
Copy bits from an array of unsigned long words.
Definition: bitstring.h:346
size_t nb_words() const
Definition: bitstring.h:160

References bitstring::nb_words(), BinaryStorageBuffer::read(), sequence, and bitstring::set_data().

◆ set_allele_value()

void TTDeletMutations_bitstring::set_allele_value ( unsigned int  locus,
unsigned int  allele,
double  value 
)
virtual

Implements TTrait.

702 {
703  assert(locus < _nb_locus && allele < 2);
704 
705  sequence[allele]->set(locus);
706 
707  _myProto->set_effect(1, locus, (float)value);
708 
709  double dom;
710 
711  if(_myProto->get_dominance_model() == 1)
712  dom = exp(-1.0*_myProto->get_effect(1, locus)*(-1.0*log(2*_myProto->get_dominance()) / _myProto->get_strength()))/2.0; //scaling of h on s
713  else dom = _myProto->get_dominance();
714 
715  //heterozygote effect: hs
716  _myProto->set_effect(0, locus, (float)(dom * _myProto->get_effect(1, locus)) );
717 
718 }
double get_dominance()
Definition: ttdeletmutations_bitstring.h:188
int get_dominance_model()
Definition: ttdeletmutations_bitstring.h:189
void set_effect(unsigned int at, unsigned int loc, float val)
Definition: ttdeletmutations_bitstring.h:202
double get_strength()
Definition: ttdeletmutations_bitstring.h:187

References _myProto, _nb_locus, TProtoDeletMutations_bitstring::get_dominance(), TProtoDeletMutations_bitstring::get_dominance_model(), TProtoDeletMutations_bitstring::get_effect(), TProtoDeletMutations_bitstring::get_strength(), sequence, bitstring::set(), and TProtoDeletMutations_bitstring::set_effect().

◆ set_counts_and_bitstrings()

void TTDeletMutations_bitstring::set_counts_and_bitstrings ( )
private
887 {
888  unsigned int hmz_cnt = 0, htz_cnt = 0;
889  size_t nw = sequence[0]->nb_words();
890  for (size_t w = 0; w < nw; ++w) {
891  auto w0 = *sequence[0]->getword_atIdx(w);
892  auto w1 = *sequence[1]->getword_atIdx(w);
893  auto hmz_word = w0 & w1;
894  auto htz_word = w0 ^ w1;
895  *_hmz->getword_atIdx(w) = hmz_word;
896  *_htz->getword_atIdx(w) = htz_word;
897  hmz_cnt += __builtin_popcountl(hmz_word);
898  htz_cnt += __builtin_popcountl(htz_word);
899  }
900  _nb_hmz_mutations = hmz_cnt;
901  _nb_htz_mutations = htz_cnt;
902  _nb_mutations = 2 * hmz_cnt + htz_cnt;
903 }
_ul * getword_atIdx(size_t index) const
Definition: bitstring.h:155

References _hmz, _htz, _nb_hmz_mutations, _nb_htz_mutations, _nb_mutations, bitstring::getword_atIdx(), bitstring::nb_words(), and sequence.

Referenced by set_value().

+ Here is the caller graph for this function:

◆ set_effects()

static void TTDeletMutations_bitstring::set_effects ( float **  fx)
static

◆ set_inherit_func_ptr()

void TTDeletMutations_bitstring::set_inherit_func_ptr ( void(TProtoDeletMutations_bitstring::*)(sex_t, bitstring *, bitstring **)  theFunc)
inline
124  {_inherit_func_ptr = theFunc;}

References _inherit_func_ptr.

Referenced by TProtoDeletMutations_bitstring::hatch().

+ Here is the caller graph for this function:

◆ set_is_continuous()

void TTDeletMutations_bitstring::set_is_continuous ( bool  val)
inline
121 {_is_continuous = val;}

References _is_continuous.

Referenced by TProtoDeletMutations_bitstring::hatch().

+ Here is the caller graph for this function:

◆ set_mut_rate()

void TTDeletMutations_bitstring::set_mut_rate ( double  val,
int  nloc 
)
inline
120 {_genomic_mut_rate = 2*nloc*val;}

References _genomic_mut_rate.

Referenced by TProtoDeletMutations_bitstring::hatch().

+ Here is the caller graph for this function:

◆ set_mutation_func_ptr()

void TTDeletMutations_bitstring::set_mutation_func_ptr ( unsigned int  m_model)
618 {
619  switch(m_model) {
620  case 1:
621  {
622  if(_myProto->get_backmutation_rate() != 0)
624  else
626  break;
627  }
628  case 2:
630  break;
631  }
632 }
void mutate_noredraw_noBackMutation()
Definition: ttdeletmutations_bitstring.cc:834
void mutate_redraw()
Definition: ttdeletmutations_bitstring.cc:769
void mutate_noredraw()
Definition: ttdeletmutations_bitstring.cc:797

References _mutation_func_ptr, _myProto, TProtoDeletMutations_bitstring::get_backmutation_rate(), mutate_noredraw(), mutate_noredraw_noBackMutation(), and mutate_redraw().

Referenced by TProtoDeletMutations_bitstring::hatch().

+ Here is the caller graph for this function:

◆ set_nb_hmz_mutations()

void TTDeletMutations_bitstring::set_nb_hmz_mutations ( )
private
879 {
880  (*_hmz) = *sequence[0] & *sequence[1];
882 }
unsigned int count()
Count number of set bits.
Definition: bitstring.h:255

References _hmz, _nb_hmz_mutations, bitstring::count(), and sequence.

◆ set_nb_htz_mutations()

void TTDeletMutations_bitstring::set_nb_htz_mutations ( )
private
871 {
872  (*_htz) = *sequence[0] ^ *sequence[1];
874 }

References _htz, _nb_htz_mutations, bitstring::count(), and sequence.

◆ set_nb_locus()

void TTDeletMutations_bitstring::set_nb_locus ( int  val)
inline
119 {_nb_locus = val;}

References _nb_locus.

Referenced by TProtoDeletMutations_bitstring::hatch().

+ Here is the caller graph for this function:

◆ set_nb_mutations()

void TTDeletMutations_bitstring::set_nb_mutations ( )
private
864 {
865  _nb_mutations = sequence[0]->count() + sequence[1]->count();
866 }

References _nb_mutations, bitstring::count(), and sequence.

◆ set_proto()

void TTDeletMutations_bitstring::set_proto ( TProtoDeletMutations_bitstring proto)
inline
118 {_myProto = proto;}

References _myProto.

Referenced by TProtoDeletMutations_bitstring::hatch().

+ Here is the caller graph for this function:

◆ set_recomb_template()

static void TTDeletMutations_bitstring::set_recomb_template ( unsigned int  size)
static

◆ set_sequence() [1/2]

void TTDeletMutations_bitstring::set_sequence ( bitstring **  seq)
671 {
672  reset();
673  init();
674  sequence[0]->copy(*seq[0]);
675  sequence[1]->copy(*seq[1]);
676 }

References bitstring::copy(), init(), reset(), and sequence.

Referenced by TTDeletMutBitstrFH::FHread().

+ Here is the caller graph for this function:

◆ set_sequence() [2/2]

virtual void TTDeletMutations_bitstring::set_sequence ( void **  seq)
inlinevirtual

Implements TTrait.

152 {}

◆ set_trait()

virtual void* TTDeletMutations_bitstring::set_trait ( void *  value)
inlinevirtual

Implements TTrait.

146 {return NULL;}

◆ set_value()

void TTDeletMutations_bitstring::set_value ( )
virtual

Implements TTrait.

850 {
851  if (_is_continuous) {
853  } else {
857  }
858  _phenotype = (this->*_viability_func_ptr)();
859 }
void set_counts_and_bitstrings()
Definition: ttdeletmutations_bitstring.cc:886
unsigned int count_xor(const bitstring &other) const
Fused XOR popcount: count set bits in (this XOR other).
Definition: bitstring.h:305
unsigned int count_and(const bitstring &mask) const
Masked popcount: count set bits in (this AND mask).
Definition: bitstring.h:296

References _is_continuous, _nb_hmz_mutations, _nb_htz_mutations, _nb_mutations, _phenotype, _viability_func_ptr, bitstring::count_and(), bitstring::count_xor(), sequence, and set_counts_and_bitstrings().

Referenced by TTDeletMutBitstrFH::FHread(), operator=(), and show_up().

+ Here is the caller graph for this function:

◆ set_viability_func_ptr()

void TTDeletMutations_bitstring::set_viability_func_ptr ( unsigned int  f_model,
bool  is_cont 
)
594  {
595  switch(f_model) {
596  case 1:
597  {
598  if(is_cont)
600  else
602  break;
603  }
604  case 2:
605  {
606  if(is_cont)
608  else
610  break;
611  }
612  }
613 }
double viability_multi()
Definition: ttdeletmutations_bitstring.cc:907
double viability_epist_continuous()
Definition: ttdeletmutations_bitstring.cc:957
double viability_multi_continuous()
Definition: ttdeletmutations_bitstring.cc:925
double viability_epist()
Definition: ttdeletmutations_bitstring.cc:917

References _viability_func_ptr, viability_epist(), viability_epist_continuous(), viability_multi(), and viability_multi_continuous().

Referenced by TProtoDeletMutations_bitstring::hatch().

+ Here is the caller graph for this function:

◆ show_up()

void TTDeletMutations_bitstring::show_up ( )
virtual

Implements TTrait.

1020 {
1021  set_value();
1022  std::cout<<"\n Trait type: delet"
1023  <<"\n value: "<<*(double*)getValue()
1024  <<"\nnb mutations: "<<get_nb_mutations()
1025  <<"\n nb hmz mut: "<<get_nb_hmz_mutations()
1026  <<"\n nb htz mut: "<<get_nb_htz_mutations()
1027  <<"\n sequence: "<<std::endl;
1028  cout<<"0: ";
1029  for(unsigned int i = 0; i < _nb_locus && i < 64; i++)
1030  cout<<(*sequence[0])[i];
1031  cout<<"\n1: ";
1032  for(unsigned int i = 0; i < _nb_locus && i < 64; i++)
1033  cout<<(*sequence[1])[i];
1034  cout<<endl;
1035 }
unsigned int get_nb_mutations() const
Definition: ttdeletmutations_bitstring.h:107
virtual void * getValue() const
Definition: ttdeletmutations_bitstring.h:157
unsigned int get_nb_htz_mutations() const
Definition: ttdeletmutations_bitstring.h:109
unsigned int get_nb_hmz_mutations() const
Definition: ttdeletmutations_bitstring.h:110

References _nb_locus, get_nb_hmz_mutations(), get_nb_htz_mutations(), get_nb_mutations(), getValue(), sequence, and set_value().

◆ store_data()

void TTDeletMutations_bitstring::store_data ( BinaryStorageBuffer saver)
virtual

Implements StorableComponent.

988 {
989  size_t wnb = sequence[0]->nb_words();
990  size_t bytes = sizeof(bitstring::_ul);
991 
992  for(size_t i = 0; i < wnb; i++)
993  saver->store(sequence[0]->getword_atIdx(i), bytes);
994 
995  for(size_t i = 0; i < wnb; i++)
996  saver->store(sequence[1]->getword_atIdx(i), bytes);
997 }
void store(void *stream, unsigned int nb_bytes)
Definition: binarystoragebuffer.cc:36

References bitstring::getword_atIdx(), bitstring::nb_words(), sequence, and BinaryStorageBuffer::store().

◆ viability_epist()

double TTDeletMutations_bitstring::viability_epist ( )
918 {
919  //w = 1 - s(hmz + h*htz)
921 }
double get_fitness_scaling_factor()
Definition: ttdeletmutations_bitstring.h:192

References _myProto, _nb_hmz_mutations, _nb_htz_mutations, TProtoDeletMutations_bitstring::get_dominance(), TProtoDeletMutations_bitstring::get_fitness_scaling_factor(), and TProtoDeletMutations_bitstring::get_strength().

Referenced by set_viability_func_ptr().

+ Here is the caller graph for this function:

◆ viability_epist_continuous()

double TTDeletMutations_bitstring::viability_epist_continuous ( )
958 {
959  //w = 1 - sum_i(s_i*hmz_i + hs_i*htz_i)
960  //sparse iteration: only visit set bits (mutated loci) using ctz
961  double fitness = 1.0;
962  float** effects = _myProto->get_effects();
963 
964  for (size_t w = 0; w < _hmz->nb_words(); ++w) {
965  auto word = *_hmz->getword_atIdx(w);
966  while (word) {
967  unsigned int bit = __builtin_ctzl(word);
968  unsigned int locus = w * BITS_PER_WORD + bit;
969  fitness -= effects[1][locus];
970  word &= word - 1;
971  }
972  }
973 
974  for (size_t w = 0; w < _htz->nb_words(); ++w) {
975  auto word = *_htz->getword_atIdx(w);
976  while (word) {
977  unsigned int bit = __builtin_ctzl(word);
978  unsigned int locus = w * BITS_PER_WORD + bit;
979  fitness -= effects[0][locus];
980  word &= word - 1;
981  }
982  }
983 
984  return fitness * _myProto->get_fitness_scaling_factor();
985 }
#define BITS_PER_WORD
Definition: bitstring.h:39
float ** get_effects() const
Definition: ttdeletmutations_bitstring.h:195

References _hmz, _htz, _myProto, BITS_PER_WORD, TProtoDeletMutations_bitstring::get_effects(), TProtoDeletMutations_bitstring::get_fitness_scaling_factor(), bitstring::getword_atIdx(), and bitstring::nb_words().

Referenced by set_viability_func_ptr().

+ Here is the caller graph for this function:

◆ viability_multi()

double TTDeletMutations_bitstring::viability_multi ( )
908 {
909  //w = (1-s)^hmz * (1-hs)^htz
910  return ( pow( 1.0 - _myProto->get_strength(), (double)_nb_hmz_mutations ) *
911  pow( 1.0 - (_myProto->get_dominance() * _myProto->get_strength()), (double)_nb_htz_mutations) *
913 }

References _myProto, _nb_hmz_mutations, _nb_htz_mutations, TProtoDeletMutations_bitstring::get_dominance(), TProtoDeletMutations_bitstring::get_fitness_scaling_factor(), and TProtoDeletMutations_bitstring::get_strength().

Referenced by set_viability_func_ptr().

+ Here is the caller graph for this function:

◆ viability_multi_continuous()

double TTDeletMutations_bitstring::viability_multi_continuous ( )
926 {
927  //w = prod_i (1-s_i)^hmz_i * (1-hs_i)^htz_i
928  //sparse iteration: only visit set bits (mutated loci) using ctz
929  double fitness = 1.0;
930  float** effects = _myProto->get_effects();
931 
932  for (size_t w = 0; w < _hmz->nb_words(); ++w) {
933  auto word = *_hmz->getword_atIdx(w);
934  while (word) {
935  unsigned int bit = __builtin_ctzl(word);
936  unsigned int locus = w * BITS_PER_WORD + bit;
937  fitness *= (1.0f - effects[1][locus]);
938  word &= word - 1;
939  }
940  }
941 
942  for (size_t w = 0; w < _htz->nb_words(); ++w) {
943  auto word = *_htz->getword_atIdx(w);
944  while (word) {
945  unsigned int bit = __builtin_ctzl(word);
946  unsigned int locus = w * BITS_PER_WORD + bit;
947  fitness *= (1.0f - effects[0][locus]);
948  word &= word - 1;
949  }
950  }
951 
952  return fitness * _myProto->get_fitness_scaling_factor();
953 }

References _hmz, _htz, _myProto, BITS_PER_WORD, TProtoDeletMutations_bitstring::get_effects(), TProtoDeletMutations_bitstring::get_fitness_scaling_factor(), bitstring::getword_atIdx(), and bitstring::nb_words().

Referenced by set_viability_func_ptr().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _genomic_mut_rate

double TTDeletMutations_bitstring::_genomic_mut_rate
private

◆ _hmz

◆ _htz

◆ _inherit_func_ptr

void(TProtoDeletMutations_bitstring::* TTDeletMutations_bitstring::_inherit_func_ptr) (sex_t, bitstring *, bitstring **)
private

Referenced by inherit(), and set_inherit_func_ptr().

◆ _is_continuous

bool TTDeletMutations_bitstring::_is_continuous
private

Referenced by set_is_continuous(), and set_value().

◆ _mutation_func_ptr

void(TTDeletMutations_bitstring::* TTDeletMutations_bitstring::_mutation_func_ptr) (void)
private

Referenced by mutate(), and set_mutation_func_ptr().

◆ _myProto

◆ _nb_hmz_mutations

unsigned int TTDeletMutations_bitstring::_nb_hmz_mutations
private

◆ _nb_htz_mutations

unsigned int TTDeletMutations_bitstring::_nb_htz_mutations
private

◆ _nb_locus

◆ _nb_mutations

unsigned int TTDeletMutations_bitstring::_nb_mutations
private

◆ _phenotype

double TTDeletMutations_bitstring::_phenotype
private

Referenced by getValue(), and set_value().

◆ _type

trait_t TTDeletMutations_bitstring::_type
private

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

◆ _viability_func_ptr

double(TTDeletMutations_bitstring::* TTDeletMutations_bitstring::_viability_func_ptr) (void)
private

◆ sequence


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

Generated for Nemo v2.4.2 by  doxygen 1.9.1

Catalogued on GSR