Nemo  2.3.56
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 ()
 
unsigned int get_nb_mut_atLocus (unsigned int loc)
 
unsigned int get_nb_htz_mutations ()
 
unsigned int get_nb_hmz_mutations ()
 
bool get_hmz_atLocus (unsigned int loc)
 
bool get_htz_atLocus (unsigned int loc)
 
Setters:
void set_proto (TProtoDeletMutations_bitstring *proto)
 
void set_nb_locus (int val)
 
void set_mut_rate (double val, int nloc)
 
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 double get_allele_value (int loc, int all)
 
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 (TTrait *mother, 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 void init ()=0
 Called to allocate the trait's genotypic sequences. More...
 
virtual void init_sequence ()=0
 Called at the start of each replicate, sets the initial genotypes. More...
 
virtual void reset ()=0
 Called at the end of each simulation/replicate, deallocates sequence memory. More...
 
virtual void inherit (TTrait *mother, TTrait *father)=0
 Inheritance procedure, creates a new trait from mother's and father's traits. More...
 
virtual void mutate ()=0
 Mutation procedure, perform mutations on the genes sequence. More...
 
virtual void * set_trait (void *value)=0
 Called to set the phenotypic to a particular value or to give context-dependant value(s) to the trait. More...
 
virtual void set_sequence (void **seq)=0
 Called to set the sequence pointer to an existing trait. More...
 
virtual double get_allele_value (int loc, int all)=0
 Called to read one allele value at a particular locus. More...
 
virtual void set_allele_value (unsigned int locus, unsigned int allele, double value)=0
 Called to change the allelic value at a particular locus. More...
 
virtual void set_value ()=0
 Tells the trait to set its phenotype from genotype, should be used instead of getValue(). More...
 
virtual void * getValue () const =0
 Genotype to phenotype mapper. More...
 
virtual trait_t get_type () const =0
 type accessor. More...
 
virtual void ** get_sequence () const =0
 sequence accessor. More...
 
virtual void show_up ()=0
 Writes some info to stdout. More...
 
virtual TTraitclone ()=0
 Returns a copy of itself. More...
 
virtual ~TTrait ()
 
- Public Member Functions inherited from StorableComponent
virtual void store_data (BinaryStorageBuffer *saver)=0
 Interface to store the component data (e.g. gene values) into a binary buffer. More...
 
virtual bool retrieve_data (BinaryStorageBuffer *reader)=0
 Interface to retrieve the same data from the binary buffer. More...
 
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 ()
 

Private Attributes

TProtoDeletMutations_bitstring_myProto
 
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
89 {sequence[0] = sequence[1] = NULL;}
TProtoDeletMutations_bitstring * _myProto
Definition: ttdeletmutations_bitstring.h:51
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:56
unsigned int _nb_mutations
Definition: ttdeletmutations_bitstring.h:67
unsigned int _nb_locus
Definition: ttdeletmutations_bitstring.h:55
double(TTDeletMutations_bitstring::* _viability_func_ptr)(void)
Definition: ttdeletmutations_bitstring.h:58
trait_t _type
Definition: ttdeletmutations_bitstring.h:75
void(TTDeletMutations_bitstring::* _mutation_func_ptr)(void)
Definition: ttdeletmutations_bitstring.h:60
bitstring * _hmz
Definition: ttdeletmutations_bitstring.h:72
void(TProtoDeletMutations_bitstring::* _inherit_func_ptr)(sex_t, bitstring *, bitstring **)
Definition: ttdeletmutations_bitstring.h:59
bitstring * sequence[2]
Definition: ttdeletmutations_bitstring.h:71
#define DELE
Definition: types.h:66

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
99{reset();}
virtual void reset()
Definition: ttdeletmutations_bitstring.cc:653

References reset().

Member Function Documentation

◆ clone()

virtual TTDeletMutations_bitstring * TTDeletMutations_bitstring::clone ( )
inlinevirtual

Implements TTrait.

154{return new TTDeletMutations_bitstring(*this);}
TTDeletMutations_bitstring()
Definition: ttdeletmutations_bitstring.h:85

References TTDeletMutations_bitstring().

◆ get_allele_value()

double TTDeletMutations_bitstring::get_allele_value ( int  loc,
int  all 
)
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:191
bool get_hmz_atLocus(unsigned int loc)
Definition: ttdeletmutations_bitstring.h:108

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

◆ get_hmz_atLocus()

bool TTDeletMutations_bitstring::get_hmz_atLocus ( unsigned int  loc)
inline
108{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)
inline
109{return (*sequence[0])[loc] ^ (*sequence[1])[loc];}

References sequence.

◆ get_nb_hmz_mutations()

unsigned int TTDeletMutations_bitstring::get_nb_hmz_mutations ( )
inline
107{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 ( )
inline
106{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)
inline
105{return (*sequence[0])[loc] + (*sequence[1])[loc];}

References sequence.

Referenced by TTDeletMutBitstrSH::setDeletStats().

+ Here is the caller graph for this function:

◆ get_nb_mutations()

unsigned int TTDeletMutations_bitstring::get_nb_mutations ( )
inline
104{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.

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

References sequence.

◆ get_type()

virtual trait_t TTDeletMutations_bitstring::get_type ( ) const
inlinevirtual

Implements TTrait.

148{return _type;}

References _type.

◆ getValue()

virtual void * TTDeletMutations_bitstring::getValue ( ) const
inlinevirtual

Implements TTrait.

152{return (void*)&_phenotype;}

References _phenotype.

Referenced by show_up().

+ Here is the caller graph for this function:

◆ inherit()

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

Implements TTrait.

750{
751 bitstring** mother_seq = (bitstring**)mother->get_sequence();
752 bitstring** father_seq = (bitstring**)father->get_sequence();
753
754 (_myProto->* _inherit_func_ptr) (FEM, sequence[FEM], mother_seq);
755
756 (_myProto->* _inherit_func_ptr) (MAL, sequence[MAL], father_seq);
757}
virtual void ** get_sequence() const =0
sequence accessor.
Non-template and faster implementation of std::bitset.
Definition: bitstring.h:56
@ FEM
Definition: types.h:37
@ MAL
Definition: types.h:37

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

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.

717{
718 if(sequence[0] == NULL) sequence[0] = new bitstring(_nb_locus);
719
720 if(sequence[1] == NULL) sequence[1] = new bitstring(_nb_locus);
721
722 unsigned int nb_mut, locus;
723
724 sequence[0]->reset();
725 sequence[1]->reset();
726
727 if(_myProto->get_init_freq() != 0) {
728
729 nb_mut = (unsigned int)(_myProto->get_init_freq()*_nb_locus*2);
730
731 for(unsigned int i = 0; i < nb_mut; i++) {
732
733 do {
734 locus = RAND::Uniform( _nb_locus );
735 //check if the locus is not already homozygote:
736 } while( (*sequence[0])[ locus ] && (*sequence[1])[ locus ] );
737
738 if((*sequence[0])[ locus ])
739 sequence[1]->set(locus);
740 else
741 sequence[0]->set(locus);
742 }
743
744 }
745}
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:186
void reset()
Set all bits to 0.
Definition: bitstring.h:256
void set(size_t n)
Set a bit to 1.
Definition: bitstring.h:240

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.

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

References _mutation_func_ptr.

◆ mutate_noredraw()

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

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 ( )
828{
829 register unsigned int NbMut = (unsigned int)RAND::Poisson(_genomic_mut_rate);
830
831 while(NbMut != 0) {
832
834
835 NbMut--;
836 }
837
838}

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 ( )
763{
764 unsigned int NbMut, mutLocus;
765
766 NbMut = (unsigned int)RAND::Poisson(_genomic_mut_rate);
767
768 if( (int)_nb_hmz_mutations - (int)NbMut < 0 ) NbMut -= _nb_hmz_mutations;
769
770 while(NbMut != 0) {
771
772 do {
773 mutLocus = RAND::Uniform( _nb_locus );
774 //check if the locus is not already homozygote:
775 } while( (*sequence[0])[mutLocus] && (*sequence[1])[mutLocus] );
776
777 if ( !( (*sequence[0])[mutLocus] || (*sequence[1])[mutLocus] ) )
778 sequence[RAND::RandBool()]->set(mutLocus);
779 else if((*sequence[0])[mutLocus])
780 sequence[1]->set(mutLocus);
781 else
782 sequence[0]->set(mutLocus);
783
784 NbMut--;
785 }
786}

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:47
virtual void set_value()
Definition: ttdeletmutations_bitstring.cc:842
virtual void init()
Definition: ttdeletmutations_bitstring.cc:636
void copy(const bitstring &b)
Unchecked copy, assumes we have sames sizes.
Definition: bitstring.h:260

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.

932{
933 size_t wnb = sequence[0]->nb_words();
934 size_t bytes = wnb * sizeof(bitstring::_ul);
935 bitstring::_ul *srce = new bitstring::_ul [wnb];
936
937 reader->read(srce, bytes);
938 sequence[0]->set_data(srce,wnb);
939
940 reader->read(srce, bytes);
941 sequence[1]->set_data(srce,wnb);
942
943 delete [] srce;
944
945 return true;
946}
void read(void *out, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:162
unsigned long _ul
Definition: bitstring.h:60
size_t nb_words()
Definition: bitstring.h:144
void set_data(_ul *srce, size_t nbwrd)
Copy bits from an array of unsigned long words.
Definition: bitstring.h:246

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.

695{
696 assert(locus < _nb_locus && allele < 2);
697
698 sequence[allele]->set(locus);
699
700 _myProto->set_effect(1, locus, (float)value);
701
702 double dom;
703
704 if(_myProto->get_dominance_model() == 1)
705 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
706 else dom = _myProto->get_dominance();
707
708 //heterozygote effect: hs
709 _myProto->set_effect(0, locus, (float)(dom * _myProto->get_effect(1, locus)) );
710
711}
double get_dominance()
Definition: ttdeletmutations_bitstring.h:183
int get_dominance_model()
Definition: ttdeletmutations_bitstring.h:184
void set_effect(unsigned int at, unsigned int loc, float val)
Definition: ttdeletmutations_bitstring.h:197
double get_strength()
Definition: ttdeletmutations_bitstring.h:182

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_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
120 {_inherit_func_ptr = theFunc;}

References _inherit_func_ptr.

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
117{_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 {
624 else
626 break;
627 }
628 case 2:
630 break;
631 }
632}
void mutate_noredraw_noBackMutation()
Definition: ttdeletmutations_bitstring.cc:827
void mutate_redraw()
Definition: ttdeletmutations_bitstring.cc:762
void mutate_noredraw()
Definition: ttdeletmutations_bitstring.cc:790

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
868{
869 (*_hmz) = *sequence[0] & *sequence[1];
871}
unsigned int count()
Count number of set bits.
Definition: bitstring.h:229

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

Referenced by set_value(), and show_up().

+ Here is the caller graph for this function:

◆ set_nb_htz_mutations()

void TTDeletMutations_bitstring::set_nb_htz_mutations ( )
private
860{
861 (*_htz) = *sequence[0] ^ *sequence[1];
863}

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

Referenced by set_value(), and show_up().

+ Here is the caller graph for this function:

◆ set_nb_locus()

void TTDeletMutations_bitstring::set_nb_locus ( int  val)
inline
116{_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
853{
854 _nb_mutations = sequence[0]->count() + sequence[1]->count();
855}

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

Referenced by set_value(), and show_up().

+ Here is the caller graph for this function:

◆ set_proto()

void TTDeletMutations_bitstring::set_proto ( TProtoDeletMutations_bitstring proto)
inline
115{_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.

147{}

◆ set_trait()

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

Implements TTrait.

142{return NULL;}

◆ set_value()

void TTDeletMutations_bitstring::set_value ( )
virtual

Implements TTrait.

843{
847 _phenotype = (this->*_viability_func_ptr)();
848}
void set_nb_htz_mutations()
Definition: ttdeletmutations_bitstring.cc:859
void set_nb_mutations()
Definition: ttdeletmutations_bitstring.cc:852
void set_nb_hmz_mutations()
Definition: ttdeletmutations_bitstring.cc:867

References _phenotype, _viability_func_ptr, set_nb_hmz_mutations(), set_nb_htz_mutations(), and set_nb_mutations().

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:875
double viability_epist_continuous()
Definition: ttdeletmutations_bitstring.cc:908
double viability_multi_continuous()
Definition: ttdeletmutations_bitstring.cc:893
double viability_epist()
Definition: ttdeletmutations_bitstring.cc:885

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.

952{
956 set_value();
957 std::cout<<"\n Trait type: delet"
958 <<"\n value: "<<*(double*)getValue()
959 <<"\nnb mutations: "<<get_nb_mutations()
960 <<"\n nb hmz mut: "<<get_nb_hmz_mutations()
961 <<"\n nb htz mut: "<<get_nb_htz_mutations()
962 <<"\n sequence: "<<std::endl;
963 cout<<"0: ";
964 for(unsigned int i = 0; i < _nb_locus && i < 64; i++)
965 cout<<(*sequence[0])[i];
966 cout<<"\n1: ";
967 for(unsigned int i = 0; i < _nb_locus && i < 64; i++)
968 cout<<(*sequence[1])[i];
969 cout<<endl;
970}
unsigned int get_nb_htz_mutations()
Definition: ttdeletmutations_bitstring.h:106
unsigned int get_nb_mutations()
Definition: ttdeletmutations_bitstring.h:104
virtual void * getValue() const
Definition: ttdeletmutations_bitstring.h:152
unsigned int get_nb_hmz_mutations()
Definition: ttdeletmutations_bitstring.h:107

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

◆ store_data()

void TTDeletMutations_bitstring::store_data ( BinaryStorageBuffer saver)
virtual

Implements StorableComponent.

920{
921 size_t wnb = sequence[0]->nb_words();
922 size_t bytes = sizeof(bitstring::_ul);
923
924 for(size_t i = 0; i < wnb; i++)
925 saver->store(sequence[0]->getword_atIdx(i), bytes);
926
927 for(size_t i = 0; i < wnb; i++)
928 saver->store(sequence[1]->getword_atIdx(i), bytes);
929}
void store(void *stream, unsigned int nb_bytes)
Definition: binarystoragebuffer.cc:16
_ul * getword_atIdx(size_t index)
Definition: bitstring.h:139

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

◆ viability_epist()

double TTDeletMutations_bitstring::viability_epist ( )

◆ viability_epist_continuous()

double TTDeletMutations_bitstring::viability_epist_continuous ( )
909{
910 //w = 1 - s(hmz + h*htz)
911 double fitness = 1.0;
912
913 for(unsigned int i = 0; i < _nb_locus; ++i)
914 fitness -= (*_hmz)[i]*_myProto->get_effect(1,i) + (*_htz)[i]*_myProto->get_effect(0,i);
915
916 return fitness * _myProto->get_fitness_scaling_factor();
917}

References _hmz, _myProto, _nb_locus, TProtoDeletMutations_bitstring::get_effect(), and TProtoDeletMutations_bitstring::get_fitness_scaling_factor().

Referenced by set_viability_func_ptr().

+ Here is the caller graph for this function:

◆ viability_multi()

double TTDeletMutations_bitstring::viability_multi ( )

◆ viability_multi_continuous()

double TTDeletMutations_bitstring::viability_multi_continuous ( )
894{
895 //w = (1-s)^hmz * (1-hs)^htz
896 double fitness = 1.0;
897
898 for(unsigned int i = 0; i < _nb_locus; ++i)
899 //_effects[0] stores hs, _effects[1] stores s
900 fitness *= (1.0f - (*_hmz)[i]*_myProto->get_effect(1, i))
901 * (1.0f - (*_htz)[i]*_myProto->get_effect(0, i));
902
903 return fitness * _myProto->get_fitness_scaling_factor();
904}

References _hmz, _myProto, _nb_locus, TProtoDeletMutations_bitstring::get_effect(), and TProtoDeletMutations_bitstring::get_fitness_scaling_factor().

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

bitstring * TTDeletMutations_bitstring::_hmz
private

◆ _htz

bitstring* TTDeletMutations_bitstring::_htz
private

Referenced by init(), reset(), and set_nb_htz_mutations().

◆ _inherit_func_ptr

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

Referenced by inherit(), and set_inherit_func_ptr().

◆ _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.3.56 by  doxygen 1.9.0 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR