Nemo  2.3.46
TTQuanti Class Reference

TTQuanti. More...

#include <ttquanti.h>

+ Inheritance diagram for TTQuanti:
+ Collaboration diagram for TTQuanti:

Public Member Functions

 TTQuanti ()
 
 TTQuanti (const TTQuanti &T)
 
 ~TTQuanti ()
 
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 TTQuanticlone ()
 
virtual TTQuantioperator= (const TTrait &T)
 
virtual bool operator== (const TTrait &T)
 
virtual bool operator!= (const TTrait &T)
 
double get_genotype (unsigned int trait)
 
virtual void store_data (BinaryStorageBuffer *saver)
 
virtual bool retrieve_data (BinaryStorageBuffer *reader)
 
void mutate_noHC ()
 
void mutate_HC ()
 
void set_proto (TProtoQuanti *proto)
 
void set_nb_locus (unsigned int val)
 
void set_nb_traits (unsigned int val)
 
void set_seq_length (unsigned int val)
 
void set_genomic_mutation_rate (double val)
 
void set_init_value (double *val, unsigned int doInit)
 
void set_init_value (double *val)
 
void set_mutation_fptr (double *(TProtoQuanti::*val)(unsigned int), bool _isHC)
 
void set_inherit_fptr (void(TProtoQuanti::*val)(sex_t, double *, double **))
 
void set_eVariance (double var)
 
void set_allele (int locus, int allele, double value)
 
- Public Member Functions inherited from TTraitWithMap
 TTraitWithMap ()
 
virtual ~TTraitWithMap ()
 
- Public Member Functions inherited from TTrait
virtual ~TTrait ()
 
- Public Member Functions inherited from StorableComponent
virtual ~StorableComponent ()
 

Private Attributes

double ** _sequence
 
double * _phenotypes
 
unsigned int _nb_locus
 
unsigned int _nb_traits
 
unsigned int _seq_length
 
double _genomic_mutation_rate
 
double * _init_value
 
unsigned int _doInitMutation
 
double _eVariance
 
TProtoQuanti_myProto
 
double *(TProtoQuanti::* _getMutationValues )(unsigned int)
 
void(TProtoQuanti::* _inherit )(sex_t, double *, double **)
 
void(TTQuanti::* _mutationFuncPtr )(void)
 

Additional Inherited Members

- Protected Attributes inherited from TTraitWithMap
TTProtoWithMap_myProto
 

Detailed Description

Constructor & Destructor Documentation

TTQuanti::TTQuanti ( )
inline

Referenced by clone().

62  { }
void(TProtoQuanti::* _inherit)(sex_t, double *, double **)
Definition: ttquanti.h:138
double *(TProtoQuanti::* _getMutationValues)(unsigned int)
Definition: ttquanti.h:137
unsigned int _seq_length
Definition: ttquanti.h:131
double _genomic_mutation_rate
Definition: ttquanti.h:132
double * _phenotypes
Definition: ttquanti.h:129
TProtoQuanti * _myProto
Definition: ttquanti.h:136
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_traits
Definition: ttquanti.h:131
double * _init_value
Definition: ttquanti.h:132
unsigned int _doInitMutation
Definition: ttquanti.h:133
double _eVariance
Definition: ttquanti.h:134
void(TTQuanti::* _mutationFuncPtr)(void)
Definition: ttquanti.h:139
unsigned int _nb_locus
Definition: ttquanti.h:131
TTQuanti::TTQuanti ( const TTQuanti T)
inline

References _init_value, _nb_traits, and _phenotypes.

69  {
70  _phenotypes = new double [_nb_traits];
71  _init_value = new double [_nb_traits];
72  for (unsigned int i = 0; i < _nb_traits; ++i) _init_value[i] = T._init_value[i];
73  }
void(TProtoQuanti::* _inherit)(sex_t, double *, double **)
Definition: ttquanti.h:138
double *(TProtoQuanti::* _getMutationValues)(unsigned int)
Definition: ttquanti.h:137
unsigned int _seq_length
Definition: ttquanti.h:131
double _genomic_mutation_rate
Definition: ttquanti.h:132
double * _phenotypes
Definition: ttquanti.h:129
TProtoQuanti * _myProto
Definition: ttquanti.h:136
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_traits
Definition: ttquanti.h:131
double * _init_value
Definition: ttquanti.h:132
unsigned int _doInitMutation
Definition: ttquanti.h:133
double _eVariance
Definition: ttquanti.h:134
void(TTQuanti::* _mutationFuncPtr)(void)
Definition: ttquanti.h:139
unsigned int _nb_locus
Definition: ttquanti.h:131
TTQuanti::~TTQuanti ( )
inline

References reset().

75 {reset();}
virtual void reset()
Definition: ttquanti.cc:1012

Member Function Documentation

virtual TTQuanti* TTQuanti::clone ( )
inlinevirtual

Implements TTrait.

References TTQuanti().

93 {return new TTQuanti(*this);}
TTQuanti()
Definition: ttquanti.h:59
virtual double TTQuanti::get_allele_value ( int  loc,
int  all 
)
inlinevirtual

Implements TTrait.

References _seq_length, and _sequence.

89 {return (loc < (int)_seq_length && all < 2 ? _sequence[all][loc] : 0);}
unsigned int _seq_length
Definition: ttquanti.h:131
double ** _sequence
Definition: ttquanti.h:128
double TTQuanti::get_genotype ( unsigned int  trait)

References _nb_locus, _nb_traits, and _sequence.

Referenced by TTQuantiFH::print(), and store_quanti_trait_values().

1106 {
1107  unsigned int loc;
1108  double genotype = 0;
1109 
1110  for(unsigned int j = 0; j < _nb_locus; ++j) {
1111  loc = j * _nb_traits + trait;
1112  genotype += _sequence[0][loc] + _sequence[1][loc];
1113  }
1114  return genotype;
1115 }
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_traits
Definition: ttquanti.h:131
unsigned int _nb_locus
Definition: ttquanti.h:131
virtual void** TTQuanti::get_sequence ( ) const
inlinevirtual

Implements TTrait.

References _sequence.

Referenced by TTQuantiFH::print().

88 {return (void**)_sequence;}
double ** _sequence
Definition: ttquanti.h:128
virtual trait_t TTQuanti::get_type ( ) const
inlinevirtual

Implements TTrait.

References QUANT.

Referenced by operator==().

87 {return QUANT;}
#define QUANT
Definition: types.h:72
virtual void* TTQuanti::getValue ( ) const
inlinevirtual

Implements TTrait.

References _phenotypes.

Referenced by TTQuantiFH::print(), and store_quanti_trait_values().

86 {return _phenotypes;}
double * _phenotypes
Definition: ttquanti.h:129
void TTQuanti::inherit ( TTrait mother,
TTrait father 
)
inlinevirtual

Implements TTrait.

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

1030 {
1031  double** mother_seq = (double**)mother->get_sequence();
1032  double** father_seq = (double**)father->get_sequence();
1033 
1034  (_myProto->* _inherit) (FEM, _sequence[FEM], mother_seq);
1035 
1036  (_myProto->* _inherit) (MAL, _sequence[MAL], father_seq);
1037 }
void(TProtoQuanti::* _inherit)(sex_t, double *, double **)
Definition: ttquanti.h:138
TProtoQuanti * _myProto
Definition: ttquanti.h:136
double ** _sequence
Definition: ttquanti.h:128
virtual void ** get_sequence() const =0
sequence accessor.
Definition: types.h:37
Definition: types.h:37
void TTQuanti::init ( )
inlinevirtual

Implements TTrait.

References _init_value, _myProto, _nb_traits, _phenotypes, _seq_length, _sequence, and TProtoQuanti::get_init_value().

Referenced by operator=().

864 {
865  _sequence = new double*[2];
866  _sequence[0] = new double [_seq_length];
867  _sequence[1] = new double [_seq_length];
868  if(!_phenotypes) _phenotypes = new double [_nb_traits];
869 
870  if(!_init_value) {
871  _init_value = new double [_nb_traits];
872  for(unsigned int i = 0; i < _nb_traits; ++i)
874  }
875 }
unsigned int _seq_length
Definition: ttquanti.h:131
double * _phenotypes
Definition: ttquanti.h:129
TProtoQuanti * _myProto
Definition: ttquanti.h:136
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_traits
Definition: ttquanti.h:131
double get_init_value(unsigned int i)
Definition: ttquanti.h:170
double * _init_value
Definition: ttquanti.h:132
void TTQuanti::init_sequence ( )
inlinevirtual

Implements TTrait.

References TProtoQuanti::_allele_model, TProtoQuanti::_allele_value, _doInitMutation, _getMutationValues, _init_value, _myProto, _nb_locus, _nb_traits, _sequence, RAND::Gaussian(), and RAND::Uniform().

Referenced by LCE_QuantiInit::init_trait_value().

880 {
881  unsigned int pos;
882  //options:
883  //0: no variation, init value = (trait value)/(2*_nb_locus)
884  //1: init value = (trait value)/(2*_nb_locus) + 1 mutation/locus
885  //2: init value = (trait value)/(2*_nb_locus) + 1 mutation/locus+make parts ==> mean trait value doesn't change
886  //3: init value = (trait value + random deviate N(0,sdVm))/(2*_nb_locus) + 1 mutation/locus+make parts
887  //4: no variation and initialize with opposite effect alleles at alternating loci.
888 
889  //decide what initial value to use
890 
891  //Note: the initial values may have been set individually by LCE_quanti
892  // it wouldn't make sense then to store the init values in the prototype
893  // because init values are set patch-specific by LCE_quanti
894  // Problem: without LCE_quanti, the original init values must not change from one replicate
895  // to the other, so we use a local variable
896 
897  double my_init[_nb_traits];
898 
899  if(_doInitMutation == 3) {
900 
901  double sdVm;
902 
903  for(unsigned int j = 0; j < _nb_traits; j++) {
904  // sdVm = sqrt(4*_nb_locus*_mut_rate*_myProto->get_trait_var(j)); //trait variance = 2Vm
905  sdVm = 0.25;
906  my_init[j] = (_init_value[j] + RAND::Gaussian(sdVm)) / (2*_nb_locus);
907  }
908 
909  } else {
910 
911  for(unsigned int j = 0; j < _nb_traits; j++) my_init[j] = _init_value[j] / (2*_nb_locus);
912 
913  }
914 
915  if(_myProto->_allele_model < 3) { //for the di-allelic models
916 
917  if (_doInitMutation != 4){
918  for(unsigned int i = 0; i < _nb_locus; i++) {
919  pos = i * _nb_traits;
920  for(unsigned int j = 0; j < _nb_traits; j++) {
921  _sequence[0][pos] = _myProto->_allele_value[i][0]; //set with the positive allele value
922  _sequence[1][pos] = _myProto->_allele_value[i][0];
923  pos++;
924  }
925  }
926 
927  } else {
928  //this is intended for a diallelic model with no initial variance
929 
930  for(unsigned int i = 0; i < _nb_locus; i++) {
931  pos = i * _nb_traits;
932  for(unsigned int j = 0; j < _nb_traits; j++) {
933  if (i % 2 == 0){
934  _sequence[0][pos] = _myProto->_allele_value[i][0]; //set with the positive allele value
935  _sequence[1][pos] = _myProto->_allele_value[i][0];
936  pos++;
937  } else {
938  _sequence[0][pos] = _myProto->_allele_value[i][0]*-1; //set with the negative allele value
939  _sequence[1][pos] = _myProto->_allele_value[i][0]*-1;
940  pos++;
941  }
942  }
943  }
944 
945  }
946  } else {
947 
948  //set the allele values from the trait value
949  for(unsigned int i = 0; i < _nb_locus; i++) {
950  pos = i * _nb_traits;
951  for(unsigned int j = 0; j < _nb_traits; j++) {
952  _sequence[0][pos] = my_init[j];
953  _sequence[1][pos] = my_init[j];
954  pos++;
955  }
956  }
957  }
958 
959 
960  //add random effects to allele values if needed
961  if(_doInitMutation != 0 & _doInitMutation != 4) {
962 
963  double *mut1, *mut2;
964  unsigned int L;
965 
966  for(unsigned int i = 0; i < _nb_locus; i++) {
967 
968  pos = i * _nb_traits;
969 
970  mut1 = (_myProto->*_getMutationValues)(i);
971  mut2 = (_myProto->*_getMutationValues)(i);
972 
973  if(_myProto->_allele_model < 3) { //diallelic models
974 
975  for(unsigned int j = 0; j < _nb_traits; j++) {
976  _sequence[0][pos] = mut1[j];
977  _sequence[1][pos] = mut2[j];
978  pos++;
979  }
980 
981  } else {
982 
983  for(unsigned int j = 0; j < _nb_traits; j++) {
984  _sequence[0][pos] += mut1[j];
985  _sequence[1][pos] += mut2[j];
986  pos++;
987  }
988 
989  if(_doInitMutation > 1) { // the make-parts algorithm
990 
991  //select a random locus
992  do{
993  L = RAND::Uniform(_nb_locus);
994  }while(L == i);
995 
996  pos = L * _nb_traits;
997  //subtract the previous random deviates from that locus
998  for(unsigned int j = 0; j < _nb_traits; j++) {
999  _sequence[0][pos] -= mut1[j];
1000  _sequence[1][pos] -= mut2[j];
1001  pos++;
1002  }
1003  }
1004  }
1005  }
1006  }
1007 
1008 }
double *(TProtoQuanti::* _getMutationValues)(unsigned int)
Definition: ttquanti.h:137
unsigned int _allele_model
Definition: ttquanti.h:202
TProtoQuanti * _myProto
Definition: ttquanti.h:136
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_traits
Definition: ttquanti.h:131
double * _init_value
Definition: ttquanti.h:132
unsigned int _doInitMutation
Definition: ttquanti.h:133
static double Gaussian(double sigma)
Definition: Uniform.h:238
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
double ** _allele_value
Definition: ttquanti.h:203
unsigned int _nb_locus
Definition: ttquanti.h:131
virtual void TTQuanti::mutate ( )
inlinevirtual

Implements TTrait.

References _mutationFuncPtr.

82 {(this->*_mutationFuncPtr)();}
void(TTQuanti::* _mutationFuncPtr)(void)
Definition: ttquanti.h:139
void TTQuanti::mutate_HC ( )
inline

mutations replace existing alleles

References _genomic_mutation_rate, _getMutationValues, _myProto, _nb_locus, _nb_traits, _sequence, RAND::Poisson(), RAND::RandBool(), and RAND::Uniform().

Referenced by set_mutation_fptr().

1063 {
1064  unsigned int NbMut = (unsigned int)RAND::Poisson(_genomic_mutation_rate);
1065  unsigned int mut_locus, mut_all, pos;
1066  double *effects;
1067 
1068  while(NbMut != 0) {
1069  mut_locus = RAND::Uniform(_nb_locus);
1070  effects = (_myProto->*_getMutationValues)(mut_locus);
1071  mut_all = RAND::RandBool();
1072  pos = mut_locus*_nb_traits;
1073  for(unsigned int i = 0; i < _nb_traits; i++)
1074  _sequence[mut_all][pos + i] = effects[i];
1075 
1076  NbMut--;
1077  }
1078 }
double *(TProtoQuanti::* _getMutationValues)(unsigned int)
Definition: ttquanti.h:137
double _genomic_mutation_rate
Definition: ttquanti.h:132
TProtoQuanti * _myProto
Definition: ttquanti.h:136
static double Poisson(double mean)
From the Numerical Recieps.
Definition: Uniform.h:196
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_traits
Definition: ttquanti.h:131
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
unsigned int _nb_locus
Definition: ttquanti.h:131
void TTQuanti::mutate_noHC ( )
inline

mutations are added to existing alleles

References _genomic_mutation_rate, _getMutationValues, _myProto, _nb_locus, _nb_traits, _sequence, RAND::Poisson(), RAND::RandBool(), and RAND::Uniform().

Referenced by set_mutation_fptr().

1042 {
1043  unsigned int NbMut = (unsigned int)RAND::Poisson(_genomic_mutation_rate);
1044  unsigned int mut_locus, mut_all, pos;
1045  double *effects;
1046 
1047  while(NbMut != 0) {
1048  mut_locus = RAND::Uniform(_nb_locus);
1049  effects = (_myProto->*_getMutationValues)(mut_locus);
1050  mut_all = RAND::RandBool();
1051  pos = mut_locus*_nb_traits;
1052  for(unsigned int i = 0; i < _nb_traits; i++)
1053  _sequence[mut_all][pos + i] += effects[i];
1054 
1055  NbMut--;
1056  }
1057 
1058 }
double *(TProtoQuanti::* _getMutationValues)(unsigned int)
Definition: ttquanti.h:137
double _genomic_mutation_rate
Definition: ttquanti.h:132
TProtoQuanti * _myProto
Definition: ttquanti.h:136
static double Poisson(double mean)
From the Numerical Recieps.
Definition: Uniform.h:196
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_traits
Definition: ttquanti.h:131
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
unsigned int _nb_locus
Definition: ttquanti.h:131
bool TTQuanti::operator!= ( const TTrait T)
virtual

Implements TTrait.

831 {
832  if(!((*this) == T) )
833  return true;
834  else
835  return false;
836 }
TTQuanti & TTQuanti::operator= ( const TTrait T)
virtual

Implements TTrait.

References _nb_locus, _nb_traits, _seq_length, _sequence, init(), reset(), and set_value().

795 {
796  const TTQuanti& TQ = dynamic_cast<const TTQuanti&>(T);
797 
798  if(this != &TQ) {
799 
800  _nb_locus = TQ._nb_locus;
801  _nb_traits = TQ._nb_traits;
803  reset();
804  init();
805  memcpy(_sequence[0],TQ._sequence[0],_seq_length*sizeof(double));
806  memcpy(_sequence[1],TQ._sequence[1],_seq_length*sizeof(double));
807  set_value();
808  }
809 
810  return *this;
811 }
TTQuanti.
Definition: ttquanti.h:55
unsigned int _seq_length
Definition: ttquanti.h:131
virtual void reset()
Definition: ttquanti.cc:1012
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_traits
Definition: ttquanti.h:131
virtual void set_value()
Definition: ttquanti.cc:1082
virtual void init()
Definition: ttquanti.cc:863
unsigned int _nb_locus
Definition: ttquanti.h:131
bool TTQuanti::operator== ( const TTrait T)
virtual

Implements TTrait.

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

816 {
817  if(this->get_type().compare(T.get_type()) != 0) return false;
818 
819  const TTQuanti& TQ = dynamic_cast<const TTQuanti&>(T);
820 
821  if(this != &TQ) {
822  if(_nb_locus != TQ._nb_locus) return false;
823  if(_nb_traits != TQ._nb_traits) return false;
824  }
825  return true;
826 }
TTQuanti.
Definition: ttquanti.h:55
virtual trait_t get_type() const =0
type accessor.
unsigned int _nb_traits
Definition: ttquanti.h:131
virtual trait_t get_type() const
Definition: ttquanti.h:87
unsigned int _nb_locus
Definition: ttquanti.h:131
void TTQuanti::reset ( )
inlinevirtual

Implements TTrait.

References _init_value, _phenotypes, and _sequence.

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

1013 {
1014  if(_sequence != NULL) {
1015  delete [] _sequence[0];
1016  delete [] _sequence[1];
1017  delete [] _sequence;
1018  _sequence = NULL;
1019  }
1020  if(_phenotypes != NULL) delete [] _phenotypes;
1021  _phenotypes = NULL;
1022 
1023  if(_init_value) delete [] _init_value;
1024  _init_value = NULL;
1025 }
double * _phenotypes
Definition: ttquanti.h:129
double ** _sequence
Definition: ttquanti.h:128
double * _init_value
Definition: ttquanti.h:132
virtual bool TTQuanti::retrieve_data ( BinaryStorageBuffer reader)
inlinevirtual

Implements StorableComponent.

References _seq_length, _sequence, and BinaryStorageBuffer::read().

106  {reader->read(_sequence[0],_seq_length*sizeof(double));
107  reader->read(_sequence[1],_seq_length*sizeof(double));return true;}
unsigned int _seq_length
Definition: ttquanti.h:131
double ** _sequence
Definition: ttquanti.h:128
void read(void *out, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:147
void TTQuanti::set_allele ( int  locus,
int  allele,
double  value 
)
inline

References _sequence.

Referenced by LCE_QuantiInit::init_allele_freq().

124 {_sequence[allele][locus] = value;}
double ** _sequence
Definition: ttquanti.h:128
virtual void TTQuanti::set_allele_value ( unsigned int  locus,
unsigned int  allele,
double  value 
)
inlinevirtual

Implements TTrait.

References _nb_locus, and _sequence.

91  {assert(locus < _nb_locus && allele < 2); _sequence[allele][locus] = value;}
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_locus
Definition: ttquanti.h:131
void TTQuanti::set_eVariance ( double  var)
inline

References _eVariance.

Referenced by TProtoQuanti::hatch().

122 {_eVariance = var;}
double _eVariance
Definition: ttquanti.h:134
void TTQuanti::set_genomic_mutation_rate ( double  val)
inline

References _genomic_mutation_rate.

Referenced by TProtoQuanti::hatch().

116 {_genomic_mutation_rate = val;}
double _genomic_mutation_rate
Definition: ttquanti.h:132
void TTQuanti::set_inherit_fptr ( void(TProtoQuanti::*)(sex_t, double *, double **)  val)
inline

References _inherit.

Referenced by TProtoQuanti::hatch().

121 {_inherit = val;}
void(TProtoQuanti::* _inherit)(sex_t, double *, double **)
Definition: ttquanti.h:138
void TTQuanti::set_init_value ( double *  val,
unsigned int  doInit 
)

References _doInitMutation.

Referenced by TProtoQuanti::hatch(), and LCE_QuantiInit::init_trait_value().

841 {
842  set_init_value(val);
843 
844  _doInitMutation = doInit;
845 }
void set_init_value(double *val, unsigned int doInit)
Definition: ttquanti.cc:840
unsigned int _doInitMutation
Definition: ttquanti.h:133
void TTQuanti::set_init_value ( double *  val)

References _init_value, and _nb_traits.

850 {
851  assert(_nb_traits != 0);
852 
853  if(_init_value) delete [] _init_value;
854 
855  _init_value = new double [_nb_traits];
856 
857  for(unsigned int i = 0; i < _nb_traits; ++i)
858  _init_value[i] = val[i];
859 }
unsigned int _nb_traits
Definition: ttquanti.h:131
double * _init_value
Definition: ttquanti.h:132
void TTQuanti::set_mutation_fptr ( double *(TProtoQuanti::*)(unsigned int val,
bool  _isHC 
)
inline

References _getMutationValues, _mutationFuncPtr, mutate_HC(), and mutate_noHC().

Referenced by TProtoQuanti::hatch().

double *(TProtoQuanti::* _getMutationValues)(unsigned int)
Definition: ttquanti.h:137
void mutate_HC()
Definition: ttquanti.cc:1062
void(TTQuanti::* _mutationFuncPtr)(void)
Definition: ttquanti.h:139
void mutate_noHC()
Definition: ttquanti.cc:1041
void TTQuanti::set_nb_locus ( unsigned int  val)
inline

References _nb_locus.

Referenced by TProtoQuanti::hatch().

113 {_nb_locus = val;}
unsigned int _nb_locus
Definition: ttquanti.h:131
void TTQuanti::set_nb_traits ( unsigned int  val)
inline

References _nb_traits.

Referenced by TProtoQuanti::hatch().

114 {_nb_traits = val;}
unsigned int _nb_traits
Definition: ttquanti.h:131
void TTQuanti::set_proto ( TProtoQuanti proto)
inline

References _myProto.

Referenced by TProtoQuanti::hatch().

112 {_myProto = proto;}
TProtoQuanti * _myProto
Definition: ttquanti.h:136
void TTQuanti::set_seq_length ( unsigned int  val)
inline

References _seq_length.

Referenced by TProtoQuanti::hatch().

115 {_seq_length = val;}
unsigned int _seq_length
Definition: ttquanti.h:131
virtual void TTQuanti::set_sequence ( void **  seq)
inlinevirtual

Implements TTrait.

References _sequence, and reset().

84 {reset(); _sequence = (double**)seq;}
virtual void reset()
Definition: ttquanti.cc:1012
double ** _sequence
Definition: ttquanti.h:128
virtual void* TTQuanti::set_trait ( void *  value)
inlinevirtual

Implements TTrait.

83 {return value;}
void TTQuanti::set_value ( )
inlinevirtual

Implements TTrait.

References _eVariance, _nb_locus, _nb_traits, _phenotypes, _sequence, and RAND::Gaussian().

Referenced by LCE_QuantiInit::init_allele_freq(), LCE_QuantiInit::init_trait_value(), and operator=().

1083 {
1084  register unsigned int loc;
1085 
1086  for(unsigned int i = 0; i < _nb_traits; ++i)
1087  _phenotypes[i] = 0;
1088 
1089  for(unsigned int j = 0; j < _nb_locus; ++j) {
1090  loc = j * _nb_traits;
1091  for(unsigned int i = 0; i < _nb_traits; ++i) {
1092  _phenotypes[i] += _sequence[0][loc] + _sequence[1][loc];
1093  loc++;
1094  }
1095  }
1096 
1097  if(_eVariance != 0)
1098  for(unsigned int i = 0; i < _nb_traits; ++i)
1100 }
double * _phenotypes
Definition: ttquanti.h:129
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_traits
Definition: ttquanti.h:131
static double Gaussian(double sigma)
Definition: Uniform.h:238
double _eVariance
Definition: ttquanti.h:134
unsigned int _nb_locus
Definition: ttquanti.h:131
void TTQuanti::show_up ( )
virtual

Implements TTrait.

References _nb_locus, _nb_traits, _phenotypes, _sequence, and message().

1120 {
1121  message("\
1122  Trait's type: QUANTI\n\
1123  traits: %i\n\
1124  loci: %i\n",_nb_traits,_nb_locus);
1125 
1126  for(unsigned int i = 0; i < _nb_traits; i++)
1127  message("phenotype %i: %f\n",i+1,_phenotypes[i]);
1128 
1129  message("_sequence: \n0:");
1130  unsigned int loc;
1131  for(unsigned int i = 0; i < _nb_traits; ++i) {
1132  message("\nt%i:",i+1);
1133  for(unsigned int j = 0; (j < _nb_locus); ++j) {
1134  loc = j * _nb_traits + i;
1135  message("%.3f,",_sequence[0][loc]);
1136  }
1137  }
1138  message("\n1:");
1139  for(unsigned int i = 0; i < _nb_traits; ++i) {
1140  message("\nt%i:",i+1);
1141  for(unsigned int j = 0; (j < _nb_locus); ++j) {
1142  loc = j * _nb_traits + i;
1143  message("%.3f,",_sequence[1][loc]);
1144  }
1145  }
1146  message("\n");
1147 
1148 }
void message(const char *message,...)
Definition: output.cc:40
double * _phenotypes
Definition: ttquanti.h:129
double ** _sequence
Definition: ttquanti.h:128
unsigned int _nb_traits
Definition: ttquanti.h:131
unsigned int _nb_locus
Definition: ttquanti.h:131
virtual void TTQuanti::store_data ( BinaryStorageBuffer saver)
inlinevirtual

Implements StorableComponent.

References _seq_length, _sequence, and BinaryStorageBuffer::store().

102  {saver->store(_sequence[0],_seq_length*sizeof(double));
103  saver->store(_sequence[1],_seq_length*sizeof(double));}
unsigned int _seq_length
Definition: ttquanti.h:131
void store(void *stream, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:130
double ** _sequence
Definition: ttquanti.h:128

Member Data Documentation

unsigned int TTQuanti::_doInitMutation
private

Referenced by init_sequence(), and set_init_value().

double TTQuanti::_eVariance
private

Referenced by set_eVariance(), and set_value().

double TTQuanti::_genomic_mutation_rate
private
double*(TProtoQuanti::* TTQuanti::_getMutationValues)(unsigned int)
private
void(TProtoQuanti::* TTQuanti::_inherit)(sex_t, double *, double **)
private

Referenced by inherit(), and set_inherit_fptr().

double * TTQuanti::_init_value
private
void(TTQuanti::* TTQuanti::_mutationFuncPtr)(void)
private

Referenced by mutate(), and set_mutation_fptr().

TProtoQuanti* TTQuanti::_myProto
private
double* TTQuanti::_phenotypes
private
unsigned int TTQuanti::_seq_length
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