Nemo  2.3.46
TProtoQuanti Class Reference

TProtoQuanti. More...

#include <ttquanti.h>

+ Inheritance diagram for TProtoQuanti:
+ Collaboration diagram for TProtoQuanti:

Public Member Functions

 TProtoQuanti ()
 
 TProtoQuanti (const TProtoQuanti &T)
 
virtual ~TProtoQuanti ()
 
unsigned int get_nb_traits ()
 
unsigned int get_nb_locus ()
 
unsigned int get_seq_length ()
 
double get_env_var ()
 
double get_trait_var (unsigned int trait)
 
double get_mutation_correlation ()
 
unsigned int get_allele_model ()
 
double ** get_allele_values () const
 
void reset_mutation_pointers ()
 
bool setMutationParameters ()
 
bool setDiallelicMutationModel ()
 
bool setContinuousMutationModel ()
 
void set_mutation_matrix_decomposition ()
 
double get_init_value (unsigned int i)
 
double * getMutationEffectMultivariateGaussian (unsigned int loc)
 
double * getMutationEffectBivariateGaussian (unsigned int loc)
 
double * getMutationEffectUnivariateGaussian (unsigned int loc)
 
double * getMutationEffectUnivariateDiallelic (unsigned int loc)
 
double * getMutationEffectBivariateDiallelic (unsigned int loc)
 
void inherit_free (sex_t SEX, double *seq, double **parent)
 
void inherit_low (sex_t SEX, double *seq, double **parent)
 
virtual void reset ()
 
virtual TTQuantihatch ()
 
virtual TProtoQuanticlone ()
 
virtual trait_t get_type () const
 
virtual bool setParameters ()
 
virtual void loadFileServices (FileServices *loader)
 
virtual void loadStatServices (StatServices *loader)
 
virtual void store_data (BinaryStorageBuffer *saver)
 
virtual bool retrieve_data (BinaryStorageBuffer *reader)
 
- Public Member Functions inherited from TTProtoWithMap
 TTProtoWithMap ()
 
 TTProtoWithMap (const TTProtoWithMap &TP)
 
virtual ~TTProtoWithMap ()
 
void setMapIndex (unsigned int idx)
 
unsigned int getMapIndex ()
 
bool setGeneticMapParameters (string prefix)
 
void addGeneticMapParameters (string prefix)
 
bool setRecombinationMapRandom ()
 
bool setRecombinationMapNonRandom (vector< vector< double > > *lociPositions)
 
bool setRecombinationMapFixed ()
 
bool setNumLociPerChromosome (string param_name)
 
void reset_recombination_pointers ()
 
void registerGeneticMap ()
 
- Public Member Functions inherited from TraitPrototype
virtual void set_index (int idx)
 Sets the traits index. More...
 
virtual int get_index ()
 Index getter. More...
 
- Public Member Functions inherited from StorableComponent
virtual ~StorableComponent ()
 
- Public Member Functions inherited from SimComponent
 SimComponent ()
 
virtual ~SimComponent ()
 
virtual void loadUpdaters (UpdaterServices *loader)
 Loads the parameters and component updater onto the updater manager. More...
 
virtual void set_paramset (ParamSet *paramset)
 Sets the ParamSet member. More...
 
virtual void set_paramset (std::string name, bool required, SimComponent *owner)
 Sets a new ParamSet and name it. More...
 
virtual void set_paramsetFromCopy (const ParamSet &PSet)
 Reset the set of parameters from a another set. More...
 
virtual ParamSetget_paramset ()
 ParamSet accessor. More...
 
virtual void add_parameter (Param *param)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd, ParamUpdaterBase *updater)
 Interface to add a parameter and its updater to the set. More...
 
virtual Paramget_parameter (std::string name)
 Param getter. More...
 
virtual double get_parameter_value (std::string name)
 Param value getter. More...
 
virtual string get_name ()
 Returnd the name of the ParamSet, i.e. More...
 

Private Attributes

unsigned int _nb_locus
 
unsigned int _nb_traits
 
unsigned int _seq_length
 
unsigned int _allele_model
 
double ** _allele_value
 
TMatrix_mutation_matrix
 
gsl_matrix * _gsl_mutation_matrix
 
gsl_matrix * _evect
 
gsl_vector * _eval
 
gsl_vector * _effects_multivar
 
gsl_vector * _ws
 
double _genomic_mutation_rate
 
double _mutation_correlation
 
double * _mutation_sigma
 
double * _init_value
 
double _effects_bivar [2]
 
unsigned int _doInitMutation
 
bool * _all_chooser
 
size_t _locusByteSize
 
size_t _sizeofLocusType
 
double _eVariance
 
double *(TProtoQuanti::* _mutation_func_ptr )(unsigned int)
 
TTQuantiSH_stats
 
TTQuantiFH_writer
 
TTQFreqExtractor_freqExtractor
 

Friends

class TTQuanti
 

Additional Inherited Members

- Static Public Member Functions inherited from TTProtoWithMap
static void recombine (unsigned long indID)
 
- Static Public Attributes inherited from TTProtoWithMap
static GeneticMap _map
 
- Protected Attributes inherited from TTProtoWithMap
unsigned int _mapIndex
 
double _totRecombEventsMean
 
double _recombRate
 
double _mapResolution
 
unsigned int _numChromosome
 
unsigned int _numLoci
 
double * _recombRatePerChrmsm
 
unsigned int_numLociPerChrmsm
 
unsigned int_chrsmLength
 
unsigned int_lociMapPositions
 
- Protected Attributes inherited from TraitPrototype
int _index
 The trait index in the Individual traits table. More...
 
- Protected Attributes inherited from SimComponent
ParamSet_paramSet
 The parameters container. More...
 

Detailed Description

Constructor & Destructor Documentation

TProtoQuanti::TProtoQuanti ( )

References SimComponent::add_parameter(), TTProtoWithMap::addGeneticMapParameters(), BOOL, DBL, INT, MAT, SimComponent::set_paramset(), and STR.

Referenced by clone().

59  :
60 _nb_locus(0),
61 _nb_traits(0),
62 _seq_length(0),
63 _allele_model(0),
64 _allele_value(0),
67 _evect(0),
68 _eval(0),
70 _ws(0),
74 _init_value(0),
75 _all_chooser(0),
76 _sizeofLocusType(sizeof(double)),
77 _eVariance(0),
79 _stats(0),
80 _writer(0),
82 {
83  set_paramset("quantitative_trait", false, this);
84 
85  add_parameter("quanti_traits",INT,true,false,0,0);
86  add_parameter("quanti_loci",INT,true,false,0,0);
87  add_parameter("quanti_allele_model",STR,false,false,0,0);
88  add_parameter("quanti_allele_value",DBL,false,false,0,0);
89  add_parameter("quanti_init_value",MAT,false,false,0,0);
90  add_parameter("quanti_init_model",INT,false,true,0,4);
91  add_parameter("quanti_environmental_variance",DBL,false,false,0,0);
92 
93  add_parameter("quanti_mutation_rate",DBL,true,true,0,1, 0);
94  add_parameter("quanti_mutation_variance",DBL,false,false,0,0, 0);
95  add_parameter("quanti_mutation_correlation",DBL,false,false,0,0, 0);
96  add_parameter("quanti_mutation_covariance",DBL,false,false,0,0, 0);
97  add_parameter("quanti_mutation_matrix",MAT,false,false,0,0, 0);
98 
99  //genetic map parameters:
101 
102  add_parameter("quanti_output",STR,false,false,0,0);
103  add_parameter("quanti_logtime",INT,false,false,0,0);
104  add_parameter("quanti_dir",STR,false,false,0,0);
105 
106  add_parameter("quanti_freq_output",BOOL,false,false,0,0);
107  add_parameter("quanti_freq_logtime",INT,false,false,0,0);
108 }
TMatrix * _mutation_matrix
Definition: ttquanti.h:206
double _genomic_mutation_rate
Definition: ttquanti.h:210
gsl_matrix * _gsl_mutation_matrix
Definition: ttquanti.h:207
unsigned int _seq_length
Definition: ttquanti.h:201
unsigned int _allele_model
Definition: ttquanti.h:202
virtual void set_paramset(ParamSet *paramset)
Sets the ParamSet member.
Definition: simcomponent.h:86
Definition: types.h:78
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:112
double _mutation_correlation
Definition: ttquanti.h:210
Definition: types.h:78
TTQuantiSH * _stats
Definition: ttquanti.h:224
bool * _all_chooser
Definition: ttquanti.h:215
void addGeneticMapParameters(string prefix)
Definition: ttrait_with_map.cc:77
gsl_matrix * _evect
Definition: ttquanti.h:207
gsl_vector * _eval
Definition: ttquanti.h:208
size_t _sizeofLocusType
Definition: ttquanti.h:216
unsigned int _nb_traits
Definition: ttquanti.h:201
unsigned int _nb_locus
Definition: ttquanti.h:201
TTQFreqExtractor * _freqExtractor
Definition: ttquanti.h:226
gsl_vector * _effects_multivar
Definition: ttquanti.h:208
double *(TProtoQuanti::* _mutation_func_ptr)(unsigned int)
Definition: ttquanti.h:220
Definition: types.h:78
double * _init_value
Definition: ttquanti.h:211
double * _mutation_sigma
Definition: ttquanti.h:211
gsl_vector * _ws
Definition: ttquanti.h:209
Definition: types.h:78
double ** _allele_value
Definition: ttquanti.h:203
TTQuantiFH * _writer
Definition: ttquanti.h:225
Definition: types.h:78
double _eVariance
Definition: ttquanti.h:218
TProtoQuanti::TProtoQuanti ( const TProtoQuanti T)

References _locusByteSize, _nb_traits, SimComponent::_paramSet, and _sizeofLocusType.

112  :
118 _evect(0),
119 _eval(0),
121 _ws(0),
124 _mutation_sigma(0),
125 _init_value(0),
126 _allele_value(0),
127 _all_chooser(0),
128 _eVariance(0),
130 _stats(0),
131 _writer(0),
133 {
134  _locusByteSize = T._nb_traits * sizeof(double);
135  _sizeofLocusType = sizeof(double);
136  _paramSet = new ParamSet( *(T._paramSet) ) ;
137 }
TMatrix * _mutation_matrix
Definition: ttquanti.h:206
double _genomic_mutation_rate
Definition: ttquanti.h:210
gsl_matrix * _gsl_mutation_matrix
Definition: ttquanti.h:207
unsigned int _seq_length
Definition: ttquanti.h:201
double _mutation_correlation
Definition: ttquanti.h:210
size_t _locusByteSize
Definition: ttquanti.h:216
TTQuantiSH * _stats
Definition: ttquanti.h:224
bool * _all_chooser
Definition: ttquanti.h:215
gsl_matrix * _evect
Definition: ttquanti.h:207
gsl_vector * _eval
Definition: ttquanti.h:208
size_t _sizeofLocusType
Definition: ttquanti.h:216
unsigned int _nb_traits
Definition: ttquanti.h:201
unsigned int _nb_locus
Definition: ttquanti.h:201
TTQFreqExtractor * _freqExtractor
Definition: ttquanti.h:226
gsl_vector * _effects_multivar
Definition: ttquanti.h:208
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
double *(TProtoQuanti::* _mutation_func_ptr)(unsigned int)
Definition: ttquanti.h:220
double * _init_value
Definition: ttquanti.h:211
double * _mutation_sigma
Definition: ttquanti.h:211
gsl_vector * _ws
Definition: ttquanti.h:209
Parameters container, implemented in each SimComponent.
Definition: param.h:203
double ** _allele_value
Definition: ttquanti.h:203
TTQuantiFH * _writer
Definition: ttquanti.h:225
double _eVariance
Definition: ttquanti.h:218
TProtoQuanti::~TProtoQuanti ( )
virtual

References _all_chooser, _freqExtractor, _init_value, _stats, _writer, and reset_mutation_pointers().

142 {
144 
145  if(_stats != NULL){delete _stats; _stats = NULL;}
146  if(_writer != NULL){delete _writer; _writer = NULL;}
147  if(_freqExtractor != NULL){delete _freqExtractor; _freqExtractor = NULL;}
148  if(_all_chooser) {delete [] _all_chooser; _all_chooser = NULL;}
149  if(_init_value) {delete[] _init_value;_init_value = NULL;}
150 }
TTQuantiSH * _stats
Definition: ttquanti.h:224
bool * _all_chooser
Definition: ttquanti.h:215
TTQFreqExtractor * _freqExtractor
Definition: ttquanti.h:226
void reset_mutation_pointers()
Definition: ttquanti.cc:557
double * _init_value
Definition: ttquanti.h:211
TTQuantiFH * _writer
Definition: ttquanti.h:225

Member Function Documentation

virtual TProtoQuanti* TProtoQuanti::clone ( )
inlinevirtual

Implements TraitPrototype.

References TProtoQuanti().

184 {return new TProtoQuanti(*this);}
TProtoQuanti()
Definition: ttquanti.cc:59
unsigned int TProtoQuanti::get_allele_model ( )
inline

References _allele_model.

Referenced by LCE_QuantiInit::setParameters().

161 {return _allele_model;}
unsigned int _allele_model
Definition: ttquanti.h:202
double** TProtoQuanti::get_allele_values ( ) const
inline

References _allele_value.

Referenced by TTQFreqExtractor::FHwrite().

162 {return _allele_value;}
double ** _allele_value
Definition: ttquanti.h:203
double TProtoQuanti::get_env_var ( )
inline

References _eVariance.

Referenced by TTQuantiFH::FHwrite(), and TTQuantiSH::init().

158 {return _eVariance;}
double _eVariance
Definition: ttquanti.h:218
double TProtoQuanti::get_init_value ( unsigned int  i)
inline

References _init_value.

Referenced by TTQuanti::init().

170 { return _init_value[i]; }
double * _init_value
Definition: ttquanti.h:211
double TProtoQuanti::get_mutation_correlation ( )
inline

References _mutation_correlation.

160 {return _mutation_correlation;}
double _mutation_correlation
Definition: ttquanti.h:210
unsigned int TProtoQuanti::get_nb_locus ( )
inline

References _nb_locus.

Referenced by TTQuantiFH::FHwrite(), TTQFreqExtractor::FHwrite(), TTQuantiFH::print(), and LCE_QuantiInit::setParameters().

156 {return _nb_locus;}
unsigned int _nb_locus
Definition: ttquanti.h:201
unsigned int TProtoQuanti::get_nb_traits ( )
inline

References _nb_traits.

Referenced by TTQuantiFH::FHwrite(), TTQFreqExtractor::FHwrite(), TTQuantiSH::init(), and TTQuantiFH::print().

155 {return _nb_traits;}
unsigned int _nb_traits
Definition: ttquanti.h:201
unsigned int TProtoQuanti::get_seq_length ( )
inline

References _seq_length.

157 {return _seq_length;}
unsigned int _seq_length
Definition: ttquanti.h:201
double TProtoQuanti::get_trait_var ( unsigned int  trait)
inline

References _mutation_matrix, and TMatrix::get().

159 {return _mutation_matrix->get(trait, trait);}
TMatrix * _mutation_matrix
Definition: ttquanti.h:206
double get(unsigned int i, unsigned int j)
Accessor to element at row i and column j.
Definition: tmatrix.h:120
virtual trait_t TProtoQuanti::get_type ( ) const
inlinevirtual

Implements TraitPrototype.

References QUANT.

185 {return QUANT;}
#define QUANT
Definition: types.h:72
double * TProtoQuanti::getMutationEffectBivariateDiallelic ( unsigned int  loc)

References _allele_value, _effects_bivar, _mutation_correlation, RAND::RandBool(), and RAND::Uniform().

Referenced by setParameters().

547 {
548  bool pos = RAND::RandBool();
549  _effects_bivar[0] = _allele_value[loc][pos];
551  pos : RAND::RandBool()) ];
552  return &_effects_bivar[0];
553 }
double _effects_bivar[2]
Definition: ttquanti.h:211
double _mutation_correlation
Definition: ttquanti.h:210
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
double ** _allele_value
Definition: ttquanti.h:203
double * TProtoQuanti::getMutationEffectBivariateGaussian ( unsigned int  loc)

References _effects_bivar, _mutation_correlation, _mutation_sigma, and RAND::BivariateGaussian().

Referenced by setParameters().

522 {
524  &_effects_bivar[0], &_effects_bivar[1]);
525  return &_effects_bivar[0];
526 }
double _effects_bivar[2]
Definition: ttquanti.h:211
static void BivariateGaussian(double sigma1, double sigma2, double rho, double *out1, double *out2)
Definition: Uniform.h:307
double _mutation_correlation
Definition: ttquanti.h:210
double * _mutation_sigma
Definition: ttquanti.h:211
double * TProtoQuanti::getMutationEffectMultivariateGaussian ( unsigned int  loc)

References _effects_multivar, _eval, _evect, and _ws.

Referenced by setParameters().

514 {
515  RAND::MultivariateGaussian(_eval, _evect, _ws, _effects_multivar);
516  return _effects_multivar->data;
517 }
gsl_matrix * _evect
Definition: ttquanti.h:207
gsl_vector * _eval
Definition: ttquanti.h:208
gsl_vector * _effects_multivar
Definition: ttquanti.h:208
gsl_vector * _ws
Definition: ttquanti.h:209
double * TProtoQuanti::getMutationEffectUnivariateDiallelic ( unsigned int  loc)

References _allele_value, _effects_bivar, and RAND::RandBool().

Referenced by setParameters().

539 {
541  return &_effects_bivar[0];
542 }
double _effects_bivar[2]
Definition: ttquanti.h:211
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:139
double ** _allele_value
Definition: ttquanti.h:203
double * TProtoQuanti::getMutationEffectUnivariateGaussian ( unsigned int  loc)

References _effects_bivar, _mutation_sigma, and RAND::Gaussian().

Referenced by setParameters().

531 {
533  return &_effects_bivar[0];
534 }
double _effects_bivar[2]
Definition: ttquanti.h:211
static double Gaussian(double sigma)
Definition: Uniform.h:238
double * _mutation_sigma
Definition: ttquanti.h:211
TTQuanti * TProtoQuanti::hatch ( )
virtual

Implements TraitPrototype.

References _allele_model, _doInitMutation, _eVariance, _genomic_mutation_rate, _init_value, _mutation_func_ptr, _nb_locus, _nb_traits, TTProtoWithMap::_recombRate, _seq_length, inherit_free(), inherit_low(), TTQuanti::set_eVariance(), TTQuanti::set_genomic_mutation_rate(), TTQuanti::set_inherit_fptr(), TTQuanti::set_init_value(), TTQuanti::set_mutation_fptr(), TTQuanti::set_nb_locus(), TTQuanti::set_nb_traits(), TTQuanti::set_proto(), TTQuanti::set_seq_length(), and TTQuanti.

693 {
694  TTQuanti* kid = new TTQuanti();
695 
696  kid->set_proto(this);
697  kid->set_nb_locus(_nb_locus);
703  if(_recombRate == 0.5) //member of TTProtoWithMap
705  else
707 
709 
710  return kid;
711 }
TTQuanti.
Definition: ttquanti.h:55
void set_seq_length(unsigned int val)
Definition: ttquanti.h:115
void inherit_free(sex_t SEX, double *seq, double **parent)
Definition: ttquanti.cc:603
double _genomic_mutation_rate
Definition: ttquanti.h:210
void set_eVariance(double var)
Definition: ttquanti.h:122
unsigned int _seq_length
Definition: ttquanti.h:201
double _recombRate
Definition: ttrait_with_map.h:176
void set_nb_locus(unsigned int val)
Definition: ttquanti.h:113
void set_genomic_mutation_rate(double val)
Definition: ttquanti.h:116
unsigned int _allele_model
Definition: ttquanti.h:202
void set_proto(TProtoQuanti *proto)
Definition: ttquanti.h:112
void set_mutation_fptr(double *(TProtoQuanti::*val)(unsigned int), bool _isHC)
Definition: ttquanti.h:119
void set_nb_traits(unsigned int val)
Definition: ttquanti.h:114
void set_init_value(double *val, unsigned int doInit)
Definition: ttquanti.cc:840
void set_inherit_fptr(void(TProtoQuanti::*val)(sex_t, double *, double **))
Definition: ttquanti.h:121
unsigned int _nb_traits
Definition: ttquanti.h:201
unsigned int _nb_locus
Definition: ttquanti.h:201
double *(TProtoQuanti::* _mutation_func_ptr)(unsigned int)
Definition: ttquanti.h:220
unsigned int _doInitMutation
Definition: ttquanti.h:212
double * _init_value
Definition: ttquanti.h:211
friend class TTQuanti
Definition: ttquanti.h:222
void inherit_low(sex_t SEX, double *seq, double **parent)
Definition: ttquanti.cc:621
double _eVariance
Definition: ttquanti.h:218
void TProtoQuanti::inherit_free ( sex_t  SEX,
double *  seq,
double **  parent 
)
inline

References _all_chooser, _locusByteSize, _nb_locus, _nb_traits, and RAND::RandBool().

Referenced by hatch().

604 {
605  register unsigned int bloc;
606  assert(_all_chooser);
607  for(unsigned int i = 0; i < _nb_locus; ++i)
609 
610  for(unsigned int i = 0; i < _nb_locus; ++i) {
611 
612  bloc = i*_nb_traits;
613 
614  memcpy(&seq[bloc], &parent[ _all_chooser[i] ][bloc], _locusByteSize);
615 
616  }
617 }
size_t _locusByteSize
Definition: ttquanti.h:216
bool * _all_chooser
Definition: ttquanti.h:215
unsigned int _nb_traits
Definition: ttquanti.h:201
unsigned int _nb_locus
Definition: ttquanti.h:201
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:139
void TProtoQuanti::inherit_low ( sex_t  SEX,
double *  seq,
double **  parent 
)
inline

References TTProtoWithMap::_map, TTProtoWithMap::_mapIndex, _nb_traits, TTProtoWithMap::_numChromosome, TTProtoWithMap::_numLociPerChrmsm, _sizeofLocusType, GeneticMap::getFirstRecPosition(), and GeneticMap::getRecLoci().

Referenced by hatch().

622 {
623  register unsigned int prevLoc = 0, chrm_bloc = 0, prev_bloc, cpy_bloc;
624  register bool flipper;
625 
626  //the table containing the loci at which x-overs happen
627  vector< unsigned int >& recTable = _map.getRecLoci(SEX, _mapIndex);
628 
629  //the table containing which homologous chromosome copy we start with, for each chromosome
630  vector< bool > & firstRecPos = _map.getFirstRecPosition(SEX);
631 
632  //number of x-overs
633  unsigned int nbRec = recTable.size();
634 
635  // cout << "TProtoQuanti::inherit; sex="<<SEX<<"; nb Rec = "<<nbRec;//<<endl;
636 
637  // c is the chromosome number
638  // stride is the number of loci considered so-far
639  // rec is the number of x-over done so-far
640  for(unsigned int c = 0, stride = 0, rec = 0; c < _numChromosome; ++c) {
641 
642  //the copy of the chromosome with which with start
643  flipper = firstRecPos[c];
644 
645  //number of loci copied so-far
646  chrm_bloc = stride + _numLociPerChrmsm[c];
647 
648  //last locus at which a x-over happened, will be first position on current chromosome
649  prevLoc = stride;
650 
651  // cout<<"chrm "<<c<<" side="<<firstRecPos[c]<<endl;
652 
653  // copy blocs of loci between x-over points on current chromosome
654  // skip it if locus is not on this chromosome but a latter one
655  for(; recTable[rec] < chrm_bloc && rec < nbRec; rec++) {
656 
657  // start position of the bloc of values to copy (_nb_traits values per locus)
658  prev_bloc = prevLoc * _nb_traits;
659 
660  // size of the bloc to copy
661  cpy_bloc = (recTable[rec] - prevLoc) * _nb_traits;
662 
663  // cout<<"copy seq from "<<prevLoc<<"("<<prev_bloc<<") to "<<recTable[rec]
664  // <<"("<<(recTable[rec] - prevLoc)<<" loc) ("<<cpy_bloc*_locusByteSize<<"B) side "<<flipper<<endl;
665 
666  memcpy(&seq[prev_bloc], &parent[flipper][prev_bloc], cpy_bloc * _sizeofLocusType);
667 
668  //update the starting locus to the next recombination point
669  prevLoc = recTable[rec];
670 
671  //switch side for next bloc to copy on this chromosome
672  flipper = !flipper;
673  }
674 
675  prev_bloc = prevLoc * _nb_traits;
676 
677  cpy_bloc = (chrm_bloc - prevLoc) * _nb_traits;
678 
679  // cout << "copy end of chrmsm from "<<prevLoc<<" to "<<chrm_bloc
680  // <<"("<<(chrm_bloc - prevLoc)<<" loc) on side "<<flipper<<endl;
681 
682  //copy what's left between the last x-over point and the end of the chrmsme
683  memcpy(&seq[prev_bloc], &parent[flipper][prev_bloc], cpy_bloc * _sizeofLocusType);
684 
685  stride += _numLociPerChrmsm[c];
686  }
687  // cout<<" done"<<endl;
688 }
static GeneticMap _map
Definition: ttrait_with_map.h:190
vector< bool > & getFirstRecPosition(sex_t SEX)
Returns the vector of the first chromosome position for recombination, used for all traits...
Definition: ttrait_with_map.h:155
unsigned int * _numLociPerChrmsm
Definition: ttrait_with_map.h:181
size_t _sizeofLocusType
Definition: ttquanti.h:216
unsigned int _numChromosome
Definition: ttrait_with_map.h:178
unsigned int _nb_traits
Definition: ttquanti.h:201
vector< unsigned int > & getRecLoci(sex_t SEX, unsigned int trait)
Returns a vector of the loci where crossing-overs take place.
Definition: ttrait_with_map.h:149
unsigned int _mapIndex
Definition: ttrait_with_map.h:174
void TProtoQuanti::loadFileServices ( FileServices loader)
virtual

Implements SimComponent.

References _freqExtractor, _writer, FileServices::attach(), SimComponent::get_parameter(), Param::getArg(), Param::getMatrix(), Param::getValue(), Param::isMatrix(), Param::isSet(), TTQFreqExtractor::resetTable(), TraitFileHandler< TP >::set(), FileHandler::set_multi(), and TTQuantiFH::setOutputOption().

716 {
717  int logtime = 0;
718  //writer
719  if(get_parameter("quanti_output")->isSet()) {
720 
721  if(_writer == NULL) _writer = new TTQuantiFH(this);
722 
723  _writer->setOutputOption(get_parameter("quanti_output")->getArg());
724 
725  Param* param = get_parameter("quanti_logtime");
726 
727  if(param->isMatrix()) {
728 
729  TMatrix temp;
730  param->getMatrix(&temp);
731  _writer->set_multi(true, true, 1, &temp, get_parameter("quanti_dir")->getArg());
732 
733  } else // rpl_per, gen_per, rpl_occ, gen_occ, rank (0), path, self-ref
734  _writer->set(true, true, 1, (param->isSet() ? (int)param->getValue() : 0),
735  0, get_parameter("quanti_dir")->getArg(),this);
736 
737  loader->attach(_writer);
738 
739  } else if(_writer != NULL) {
740  delete _writer;
741  _writer = NULL;
742  }
743 
744  //freq extractor
745  if(get_parameter("quanti_freq_output")->isSet()) {
746 
747  if(_freqExtractor == NULL) _freqExtractor = new TTQFreqExtractor(this);
748 
750 
751  Param* param = get_parameter("quanti_freq_logtime");
752 
753  logtime = (param->isSet() ? (int)param->getValue() : 0);
754 
755  //save multiple generations in a single file:
756  _freqExtractor->set(true, true, 1, logtime, 0, get_parameter("quanti_dir")->getArg(),this);
757 
758 // param = get_parameter("quanti_freq_grain");
759 //
760 // if( ! param->isSet() ) {
761 // warning(" parameter \"quanti_freq_grain\" is not set, using 0.1\n");
762 // _freqExtractor->set_granularity(0.1);
763 // } else
764 // _freqExtractor->set_granularity(param->getValue());
765 
766  loader->attach(_freqExtractor);
767 
768  } else if(_freqExtractor != NULL) {
769  delete _freqExtractor;
770  _freqExtractor = NULL;
771  }
772 
773 }
TTQuantiFH.
Definition: ttquanti.h:305
void resetTable()
Definition: ttquanti.cc:2122
virtual void attach(Handler *FH)
Attaches the FileHandler to the current list (_writers) of the FileServices.
Definition: fileservices.cc:57
double getValue()
Returns the argument value according to its type.
Definition: param.cc:319
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:329
bool isMatrix()
Checks if the argument is of matrix type.
Definition: param.h:170
virtual void set(bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path, TP *trait_proto)
Definition: filehandler.h:236
This structure stores one parameter, its definition and its string argument.
Definition: param.h:53
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
TTQFreqExtractor * _freqExtractor
Definition: ttquanti.h:226
virtual void set_multi(bool rpl_per, bool gen_per, int rpl_occ, TMatrix *Occ, string path)
Definition: filehandler.h:197
string getArg()
Definition: param.h:136
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
void setOutputOption(string opt)
Definition: ttquanti.h:313
TTQuantiFH * _writer
Definition: ttquanti.h:225
TTQFreqExtractor.
Definition: ttquanti.h:324
bool isSet()
Definition: param.h:138
void TProtoQuanti::loadStatServices ( StatServices loader)
virtual

Implements SimComponent.

References _stats, and StatServices::attach().

778 {
779  //allocate the stat handler
780  if(_stats == NULL)
781  _stats = new TTQuantiSH(this);
782 
783  if(_stats != NULL) {
784  loader->attach(_stats);
785  }
786 }
TTQuantiSH.
Definition: ttquanti.h:233
TTQuantiSH * _stats
Definition: ttquanti.h:224
virtual void attach(Handler *H)
attach the StatHandler to the current list (_statHandlers) of the StatServices
Definition: statservices.cc:177
virtual void TProtoQuanti::reset ( )
inlinevirtual

Reimplemented from TTProtoWithMap.

References TTProtoWithMap::reset().

virtual void reset()
Definition: ttrait_with_map.cc:505
void TProtoQuanti::reset_mutation_pointers ( )

References _allele_value, _effects_multivar, _eval, _evect, _gsl_mutation_matrix, _mutation_matrix, _mutation_sigma, _nb_locus, and _ws.

Referenced by setMutationParameters(), and ~TProtoQuanti().

558 {
559  if(_allele_value) {
560  for(unsigned int i = 0; i < _nb_locus; ++i)
561  delete [] _allele_value[i];
562  delete [] _allele_value;
563  _allele_value = NULL;
564  }
565 
566  if(_mutation_matrix != NULL) {
567  delete _mutation_matrix;
568  _mutation_matrix = NULL;
569  }
570 
571  if(_gsl_mutation_matrix != NULL)
572  gsl_matrix_free(_gsl_mutation_matrix);
573 
574  if(_mutation_sigma != NULL){
575  delete [] _mutation_sigma;
576  _mutation_sigma = NULL;
577  }
578 
579  if(_evect != NULL) {
580  gsl_matrix_free(_evect);
581  _evect = NULL;
582  }
583 
584  if(_eval != NULL) {
585  gsl_vector_free(_eval);
586  _eval = NULL;
587  }
588 
589  if(_effects_multivar != NULL) {
590  gsl_vector_free(_effects_multivar);
591  _effects_multivar = NULL;
592  }
593 
594  if(_ws) {
595  gsl_vector_free(_ws);
596  _ws = 0;
597  }
598 
599 }
TMatrix * _mutation_matrix
Definition: ttquanti.h:206
gsl_matrix * _gsl_mutation_matrix
Definition: ttquanti.h:207
gsl_matrix * _evect
Definition: ttquanti.h:207
gsl_vector * _eval
Definition: ttquanti.h:208
unsigned int _nb_locus
Definition: ttquanti.h:201
gsl_vector * _effects_multivar
Definition: ttquanti.h:208
double * _mutation_sigma
Definition: ttquanti.h:211
gsl_vector * _ws
Definition: ttquanti.h:209
double ** _allele_value
Definition: ttquanti.h:203
virtual bool TProtoQuanti::retrieve_data ( BinaryStorageBuffer reader)
inlinevirtual

Implements StorableComponent.

References _seq_length, and BinaryStorageBuffer::read().

197  {reader->read(&_seq_length,sizeof(int));return true;}
unsigned int _seq_length
Definition: ttquanti.h:201
void read(void *out, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:147
void TProtoQuanti::set_mutation_matrix_decomposition ( )

References _eval, _evect, _gsl_mutation_matrix, _nb_traits, and message().

Referenced by setContinuousMutationModel().

489 {
490  gsl_matrix *E = gsl_matrix_alloc(_nb_traits,_nb_traits);
491  gsl_matrix_memcpy(E,_gsl_mutation_matrix);
492  gsl_eigen_symmv_workspace * w = gsl_eigen_symmv_alloc (_nb_traits);
493  gsl_eigen_symmv (E, _eval, _evect, w);
494  gsl_eigen_symmv_free (w);
495  gsl_matrix_free(E);
496 #ifdef _DEBUG_
497  message("-- Mutation matrix eigenvalues:\n");
498  for(unsigned int i = 0; i < _nb_traits; i++)
499  cout<<gsl_vector_get(_eval,i)<<" ";
500  cout<<endl;
501 #endif
502  double eval;
503  //take square root of eigenvalues, will be used in Gaussian as stdev
504  for(unsigned int i = 0; i < _nb_traits; i++) {
505  eval = gsl_vector_get(_eval,i);
506  eval = (eval < 0.000001 ? 0 : eval);
507  gsl_vector_set( _eval, i, sqrt(eval) );
508  }
509 }
void message(const char *message,...)
Definition: output.cc:40
gsl_matrix * _gsl_mutation_matrix
Definition: ttquanti.h:207
gsl_matrix * _evect
Definition: ttquanti.h:207
gsl_vector * _eval
Definition: ttquanti.h:208
unsigned int _nb_traits
Definition: ttquanti.h:201
bool TProtoQuanti::setContinuousMutationModel ( )

References _effects_multivar, _eval, _evect, _gsl_mutation_matrix, _mutation_correlation, _mutation_matrix, _mutation_sigma, _nb_traits, _ws, error(), TMatrix::get(), TMatrix::get_dims(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), Param::isSet(), message(), set_mutation_matrix_decomposition(), TMatrix::show_up(), and warning().

Referenced by setMutationParameters().

390 {
391  unsigned int dims[2];
392  //setting the mutation variance-covariance matrix
393  if(get_parameter("quanti_mutation_variance")->isSet()) {
394 
395  if(get_parameter("quanti_mutation_matrix")->isSet()) {
396  warning("both \"quanti_mutation_variance\" and \"quanti_mutation_matrix\" are set, using the matrix only!\n");
397  } else {
398 
399  _mutation_sigma = new double [_nb_traits];
400 
401  double sigma = sqrt( get_parameter_value("quanti_mutation_variance") );
402 
403  for(unsigned int i = 0; i < _nb_traits; i++)
404  _mutation_sigma[i] = sigma;
405 
406  if(_nb_traits > 1) {
407  //setting the mutation matrix
408  _mutation_matrix = new TMatrix();
409 
410  _gsl_mutation_matrix = gsl_matrix_alloc(_nb_traits, _nb_traits);
411 
412  double covar, var = get_parameter_value("quanti_mutation_variance");
413 
414  covar = _mutation_correlation * var;
415 
416  for(unsigned int i = 0; i < _nb_traits; i++)
417  gsl_matrix_set(_gsl_mutation_matrix, i, i, var);
418 
419  for(unsigned int i = 0; i < _nb_traits - 1; i++)
420  for(unsigned int j = i + 1 ; j < _nb_traits; j++) {
421  gsl_matrix_set(_gsl_mutation_matrix, i, j, covar);
422  gsl_matrix_set(_gsl_mutation_matrix, j, i, covar);
423  }
424  _mutation_matrix->set_from_gsl_matrix(_gsl_mutation_matrix);
425  }
426  }
427  }
428 
429  if(get_parameter("quanti_mutation_matrix")->isSet()) {
430 
431  _mutation_matrix = new TMatrix();
432 
433  get_parameter("quanti_mutation_matrix")->getMatrix(_mutation_matrix);
434 
435  _mutation_matrix->get_dims(&dims[0]);
436 
437  if( dims[0] != _nb_traits || dims[1] != _nb_traits) {
438  error("\"quanti_mutation_matrix\" must be a square matrix of size = \"quanti_traits\" x \"quanti_traits\"\n");
439  return false;
440  }
441 
442  _gsl_mutation_matrix = gsl_matrix_alloc(dims[0], dims[1]);
443 
444  _mutation_matrix->get_gsl_matrix(_gsl_mutation_matrix);
445 
446  _mutation_sigma = new double [_nb_traits];
447 
448  for(unsigned int i = 0; i < _nb_traits; i++)
449  _mutation_sigma[i] = sqrt(_mutation_matrix->get(i, i));
450 
451  }
452  else if(!get_parameter("quanti_mutation_variance")->isSet()) {
453  error("\"quanti_mutation_matrix\" or \"quanti_mutation_variance\" must be specified!\n");
454  return false;
455  }
456  //some more initializations
457  if(_mutation_matrix) {
458 
459  _evect = gsl_matrix_alloc(_nb_traits, _nb_traits);
460  _eval = gsl_vector_alloc(_nb_traits);
461 
463 
464  if(_nb_traits == 2) {
465 
467 
468  } else if(_nb_traits > 2) {
469  _effects_multivar = gsl_vector_alloc(_nb_traits);
470  _ws = gsl_vector_alloc(_nb_traits);
471  }
472 #ifdef _DEBUG_
473  message("-- Mutation matrix:\n");
475  message("-- MMatrix decomposition:\n");
476  for(unsigned int i = 0; i < _nb_traits; i++)
477  cout<<gsl_vector_get(_eval,i)<<" ";
478  cout<<endl;
479  if(_nb_traits == 2) message("-- mutation correlation: %f\n",_mutation_correlation);
480 #endif
481  }
482 
483  return true;
484 }
void message(const char *message,...)
Definition: output.cc:40
TMatrix * _mutation_matrix
Definition: ttquanti.h:206
void set_mutation_matrix_decomposition()
Definition: ttquanti.cc:488
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
gsl_matrix * _gsl_mutation_matrix
Definition: ttquanti.h:207
unsigned int get_dims(unsigned int *dims)
Accessor to the matrix dimensions.
Definition: tmatrix.h:134
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:329
double get(unsigned int i, unsigned int j)
Accessor to element at row i and column j.
Definition: tmatrix.h:120
double _mutation_correlation
Definition: ttquanti.h:210
int error(const char *str,...)
Definition: output.cc:73
gsl_matrix * _evect
Definition: ttquanti.h:207
void warning(const char *str,...)
Definition: output.cc:56
gsl_vector * _eval
Definition: ttquanti.h:208
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
unsigned int _nb_traits
Definition: ttquanti.h:201
gsl_vector * _effects_multivar
Definition: ttquanti.h:208
void show_up()
Definition: tmatrix.h:246
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
double * _mutation_sigma
Definition: ttquanti.h:211
gsl_vector * _ws
Definition: ttquanti.h:209
bool isSet()
Definition: param.h:138
bool TProtoQuanti::setDiallelicMutationModel ( )

References _allele_value, _nb_locus, error(), fatal(), TMatrix::get(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), TMatrix::ncols(), and TMatrix::nrows().

Referenced by setMutationParameters().

326 {
327  if (!get_parameter("quanti_allele_value")->isSet()) {
328  error("in \"quanti\" trait, \"quanti_allele_value\" is not set for the diallelic model.\n");
329  return false;
330 
331  } else {
332 
333  assert(_allele_value == NULL);
334  //should be the case as reset_mutation_pointers has been called in setMutationParameters
335 
336 
337  _allele_value = new double* [_nb_locus];
338 
339  for (unsigned i = 0; i < _nb_locus; ++i) _allele_value[i] = new double [2];
340 
341  if (get_parameter("quanti_allele_value")->isMatrix()) { //locus-specific allelic values
342 
343  TMatrix tmp;
344 
345  get_parameter("quanti_allele_value")->getMatrix(&tmp);
346 
347  if (tmp.ncols() != _nb_locus) {
348  fatal("\"quanti_allele_value\" must get a matrix with num. columns = num. loci.\n");
349  return false;
350  }
351 
352  if (tmp.nrows() == 1) { // store + and - allelic values
353 
354  for (unsigned i = 0; i < _nb_locus; ++i) {
355  _allele_value[i][0] = tmp.get(0, i);
356  _allele_value[i][1] = -_allele_value[i][0];
357  }
358 
359  } else if (tmp.nrows() == 2) { // store A and a allelic values
360 
361  for (unsigned i = 0; i < _nb_locus; ++i) {
362  _allele_value[i][0] = tmp.get(0, i);
363  _allele_value[i][1] = tmp.get(1, i);
364  }
365 
366  } else {
367  fatal("\"quanti_allele_value\" must get a matrix with a max. of 2 rows (and num. columns = num. loci).\n");
368  return false;
369  }
370 
371 
372  } else { //no locus-specific allelic values
373 
374  double val = get_parameter_value("quanti_allele_value");
375  for (unsigned i = 0; i < _nb_locus; ++i) {
376  _allele_value[i][0] = val;
377  _allele_value[i][1] = -_allele_value[i][0];
378  }
379 
380  }
381 
382  }
383 
384  return true;
385 }
unsigned int ncols()
Definition: tmatrix.h:143
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:329
double get(unsigned int i, unsigned int j)
Accessor to element at row i and column j.
Definition: tmatrix.h:120
void fatal(const char *str,...)
Definition: output.cc:90
int error(const char *str,...)
Definition: output.cc:73
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
unsigned int _nb_locus
Definition: ttquanti.h:201
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
double ** _allele_value
Definition: ttquanti.h:203
unsigned int nrows()
Definition: tmatrix.h:140
bool TProtoQuanti::setMutationParameters ( )

References _allele_model, _genomic_mutation_rate, _mutation_correlation, _nb_locus, error(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getArg(), reset_mutation_pointers(), setContinuousMutationModel(), and setDiallelicMutationModel().

Referenced by setParameters().

270 {
271  _genomic_mutation_rate = get_parameter_value("quanti_mutation_rate") * 2 * _nb_locus;
272 
273  if(get_parameter("quanti_mutation_correlation")->isSet())
274  _mutation_correlation = get_parameter_value("quanti_mutation_correlation");
275  else
277 
279 
280  //checking allelic model
281  if (get_parameter("quanti_allele_model")->isSet()) {
282 
283  string model = get_parameter("quanti_allele_model")->getArg();
284 
285  if (model == "diallelic") {
286 
287  _allele_model = 1;
288 
289  return setDiallelicMutationModel ();
290 
291  } else if (model == "diallelic_HC") {
292 
293  _allele_model = 2;
294 
295  return setDiallelicMutationModel ();
296 
297  } else if (model == "continuous") {
298 
299  _allele_model = 3;
300 
301  return setContinuousMutationModel ();
302 
303  } else if (model == "continuous_HC") {
304 
305  _allele_model = 4;
306 
307  return setContinuousMutationModel ();
308 
309  } else {
310  error("\"quanti_allele_model\" has options \"diallelic[_HC]\" or \"continuous[_HC]\" only. \n");
311  return false;
312  }
313 
314  }
315  else { //default model
316  _allele_model = 3;
317  return setContinuousMutationModel ();
318  }
319 
320  return true;
321 }
double _genomic_mutation_rate
Definition: ttquanti.h:210
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
bool setDiallelicMutationModel()
Definition: ttquanti.cc:325
unsigned int _allele_model
Definition: ttquanti.h:202
bool setContinuousMutationModel()
Definition: ttquanti.cc:389
double _mutation_correlation
Definition: ttquanti.h:210
int error(const char *str,...)
Definition: output.cc:73
unsigned int _nb_locus
Definition: ttquanti.h:201
void reset_mutation_pointers()
Definition: ttquanti.cc:557
string getArg()
Definition: param.h:136
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
bool TProtoQuanti::setParameters ( )
virtual

Implements SimComponent.

References _all_chooser, _allele_model, _doInitMutation, _eVariance, _init_value, _locusByteSize, _mutation_func_ptr, _nb_locus, _nb_traits, TTProtoWithMap::_recombRate, _seq_length, _sizeofLocusType, fatal(), TMatrix::get(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), getMutationEffectBivariateDiallelic(), getMutationEffectBivariateGaussian(), getMutationEffectMultivariateGaussian(), getMutationEffectUnivariateDiallelic(), getMutationEffectUnivariateGaussian(), TMatrix::getNbCols(), TMatrix::getNbRows(), Param::isSet(), TTProtoWithMap::setGeneticMapParameters(), and setMutationParameters().

155 {
156  if(get_parameter("quanti_mutation_covariance")->isSet()) {
157  fatal("\"quanti_mutation_covariance\" is deprecated, use \"quanti_mutation_correlation\" instead.\n");
158  return false;
159  }
160  _nb_traits = (unsigned int)get_parameter_value("quanti_traits");
161  _nb_locus = (unsigned int)get_parameter_value("quanti_loci");
162  //total nbre of values for both traits in a haploid genome
163  _seq_length = _nb_traits * _nb_locus; //mutations are pleiotropic!!!
164  _locusByteSize = _nb_traits * sizeof(double);
165  _sizeofLocusType = sizeof(double);
166 
167  if(get_parameter("quanti_environmental_variance")->isSet())
168  _eVariance = sqrt(get_parameter_value("quanti_environmental_variance"));
169  else
170  _eVariance = 0;
171 
172  TMatrix tmp_matx;
173 
174  //---------------------------------------------------------------------------------------------
175  //initial values:
176  if(_init_value != NULL) {
177  delete [] _init_value;
178  _init_value = NULL;
179  }
180 
181  if(get_parameter("quanti_init_value")->isSet()) {
182 
183  get_parameter("quanti_init_value")->getMatrix(&tmp_matx);
184 
185  if(tmp_matx.getNbRows() != 1 || tmp_matx.getNbCols() != _nb_traits) {
186  fatal("\"quanti_init_value\" must be a vector of length equal to the number of traits!\n");
187  return false;
188  }
189 
190  _init_value = new double [_nb_traits];
191 
192  for(unsigned int i = 0; i < _nb_traits; i++)
193  _init_value[i] = tmp_matx.get(0,i);
194 
195  }
196  else {
197 
198  _init_value = new double [_nb_traits];
199 
200  for(unsigned int i = 0; i < _nb_traits; i++)
201  _init_value[i] = 0.0;
202  }
203 
204  if(get_parameter("quanti_init_model")->isSet()) {
205 
206  _doInitMutation = (unsigned int)get_parameter_value("quanti_init_model");
207 
208  } else {
209  _doInitMutation = 1;
210  }
211 
212  //---------------------------------------------------------------------------------------
213  if( !setMutationParameters() ) return false; //sets _allele_model
214 
215  //bypass the genetic map for free recombination to save significant time:
216  //this is done only if the parameter is explicitely set to 0.5 (and not {{0.5}})
217  //else, we set the map:
218  if ( get_parameter("quanti_recombination_rate")->isSet() &&
219  get_parameter_value("quanti_recombination_rate") == 0.5 ) {
220 
221  _recombRate = 0.5;
222 
223  //for use in the inherit_free function:
224  if(_all_chooser) delete [] _all_chooser;
225  _all_chooser = new bool[_nb_locus];
226 
227  } else {
228 
229  if( !setGeneticMapParameters("quanti") ) return false;
230 
231  if(_all_chooser) delete [] _all_chooser;
232  _all_chooser = new bool[_nb_locus]; //may still be used if no map parameters are specified
233 
234  }
235 
236 
237  //---------------------------------------------------------------------------------------
238  if(_nb_traits == 1) {
239 
240  if (_allele_model == 1 || _allele_model == 2) {
242  } else {
244  }
245 
246  } else if (_nb_traits == 2) {
247 
248  if (_allele_model == 1 || _allele_model == 2) {
250  } else {
252  }
253 
254  } else if (_nb_traits > 2) {
255 
256  if (_allele_model > 2) {
258  } else {
259  fatal("in \"quanti\" trait, the di-allelic model is only allowed for max. 2 quantitative traits.");
260  }
261 
262  }
263 
264  return true;
265 }
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
unsigned int getNbCols()
Gives the number of columns.
Definition: tmatrix.h:142
unsigned int getNbRows()
Gives the number of rows.
Definition: tmatrix.h:139
unsigned int _seq_length
Definition: ttquanti.h:201
double _recombRate
Definition: ttrait_with_map.h:176
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:329
unsigned int _allele_model
Definition: ttquanti.h:202
double get(unsigned int i, unsigned int j)
Accessor to element at row i and column j.
Definition: tmatrix.h:120
void fatal(const char *str,...)
Definition: output.cc:90
double * getMutationEffectUnivariateGaussian(unsigned int loc)
Definition: ttquanti.cc:530
double * getMutationEffectBivariateDiallelic(unsigned int loc)
Definition: ttquanti.cc:546
size_t _locusByteSize
Definition: ttquanti.h:216
bool * _all_chooser
Definition: ttquanti.h:215
double * getMutationEffectMultivariateGaussian(unsigned int loc)
Definition: ttquanti.cc:513
double * getMutationEffectBivariateGaussian(unsigned int loc)
Definition: ttquanti.cc:521
size_t _sizeofLocusType
Definition: ttquanti.h:216
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
unsigned int _nb_traits
Definition: ttquanti.h:201
unsigned int _nb_locus
Definition: ttquanti.h:201
bool setGeneticMapParameters(string prefix)
Definition: ttrait_with_map.cc:88
double *(TProtoQuanti::* _mutation_func_ptr)(unsigned int)
Definition: ttquanti.h:220
unsigned int _doInitMutation
Definition: ttquanti.h:212
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
double * _init_value
Definition: ttquanti.h:211
double * getMutationEffectUnivariateDiallelic(unsigned int loc)
Definition: ttquanti.cc:538
bool setMutationParameters()
Definition: ttquanti.cc:269
double _eVariance
Definition: ttquanti.h:218
bool isSet()
Definition: param.h:138
virtual void TProtoQuanti::store_data ( BinaryStorageBuffer saver)
inlinevirtual

Implements StorableComponent.

References _seq_length, and BinaryStorageBuffer::store().

194  {saver->store(&_seq_length,sizeof(int));}
unsigned int _seq_length
Definition: ttquanti.h:201
void store(void *stream, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:130

Friends And Related Function Documentation

friend class TTQuanti
friend

Referenced by hatch().

Member Data Documentation

bool* TProtoQuanti::_all_chooser
private
unsigned int TProtoQuanti::_allele_model
private
unsigned int TProtoQuanti::_doInitMutation
private

Referenced by hatch(), and setParameters().

gsl_vector * TProtoQuanti::_effects_multivar
private
double TProtoQuanti::_eVariance
private

Referenced by get_env_var(), hatch(), and setParameters().

TTQFreqExtractor* TProtoQuanti::_freqExtractor
private

Referenced by loadFileServices(), and ~TProtoQuanti().

double TProtoQuanti::_genomic_mutation_rate
private

Referenced by hatch(), and setMutationParameters().

gsl_matrix* TProtoQuanti::_gsl_mutation_matrix
private
double * TProtoQuanti::_init_value
private
size_t TProtoQuanti::_locusByteSize
private
double*(TProtoQuanti::* TProtoQuanti::_mutation_func_ptr)(unsigned int)
private

Referenced by hatch(), and setParameters().

TMatrix* TProtoQuanti::_mutation_matrix
private
unsigned int TProtoQuanti::_seq_length
private
size_t TProtoQuanti::_sizeofLocusType
private
TTQuantiSH* TProtoQuanti::_stats
private

Referenced by loadStatServices(), and ~TProtoQuanti().

TTQuantiFH* TProtoQuanti::_writer
private

Referenced by loadFileServices(), and ~TProtoQuanti().

gsl_vector* TProtoQuanti::_ws
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