Nemo  2.4.0
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
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_num_traits ()
 
unsigned int get_num_locus ()
 
unsigned int get_num_locus (unsigned int trait)
 
unsigned int get_pleiotropy_type ()
 
unsigned int get_seq_length ()
 
size_t get_size_locus_type ()
 
size_t get_locus_byte_size ()
 
vector< double > get_env_var ()
 
vector< double > get_heritability ()
 
unsigned int get_h2_setTime ()
 
bool get_h2_isBroad ()
 
unsigned int get_allele_model ()
 
const TMatrixget_diallele_values ()
 
double get_diallele_value (unsigned int locus, unsigned int allele)
 
double get_seq_diallele_value (unsigned int position, unsigned int allele)
 
bool has_equal_domCoeff ()
 
bool has_equal_effects ()
 
double get_equal_val_0 ()
 
double get_equal_val_1 ()
 
double get_equal_val_diff ()
 
const bitstringget_trait_mask (unsigned int trait) const
 
double get_init_value (unsigned int i)
 
double get_init_variance (unsigned int i)
 
unsigned int get_doInitMutation ()
 
TTQuantiSHget_stater ()
 
const TMatrixget_pleio_matrix ()
 
unsigned int get_locus_seq_pos (unsigned int loc, unsigned int trait)
 
unsigned int get_locus_ID (unsigned int locus, unsigned int trait)
 
unsigned int get_locus_PD (unsigned int locus)
 
unsigned int get_locus_start_pos (unsigned int locus)
 
unsigned int get_sequence_block_size (unsigned int from, unsigned int to)
 
void set_eVarianceSD (unsigned int trait, double SD)
 
void set_init_values (const double *values, unsigned int nval)
 
void set_trait_value_func_ptr (bool withVe)
 
double set_trait_value_VE (const TTQuanti *ind, const unsigned int trait)
 
double set_trait_value_noVE (const TTQuanti *ind, const unsigned int trait)
 
double set_genotype_value_additive (const TTQuanti *ind, const unsigned int trait)
 
double set_genotype_value_dominance (const TTQuanti *ind, const unsigned int trait)
 
int get_allele_position (const unsigned int locus, const unsigned int trait)
 
double get_allele_value (const TTQuanti *ind, const unsigned int allele, const unsigned int locus, const unsigned int trait)
 
double get_genotype_with_dominance (const double a1, const double a2, const unsigned int locus, const unsigned int trait)
 
double get_genotype_dominance_h (double a1, double a2, double h)
 
double get_genotype_dominance_k (double a1, double a2, double k)
 
unsigned int get_dominance_model ()
 
double get_dominance (unsigned int locus, unsigned int trait)
 
const TMatrixget_dominance_effects ()
 
double get_trait_mutation_variance (unsigned int trait)
 
double get_genotypic_value (const TTQuanti *ind, const unsigned int trait)
 
double get_phenotypic_value (const TTQuanti *ind, const unsigned int trait)
 
bool setHeritabilityParams ()
 
bool setInitialValuesParams ()
 
bool setGeneticMapParams ()
 
unsigned int setAlleleModel ()
 
bool setMutationModel_no_pleio ()
 
bool setMutationModel_full_pleio ()
 
bool setMutationModel_var_pleio ()
 
void setTraitAndLocusTables_full_pleio ()
 
void setTraitAndLocusTables_no_pleio (TMatrix &mat)
 
bool setMutationCorrelation ()
 
bool setDominanceParameters ()
 
bool setDiallelicMutationModel ()
 
bool setMutationSigmaFromQuantiMutationVariance ()
 
bool setMutationSigmaFromQuantiMutationVariance_no_pleio ()
 
bool readMatrixFromQuantiMutationMatrix (vector< vector< double >> &varmat)
 
bool setContinuousMutationModel_no_pleio ()
 
bool setContinuousMutationModel_full_pleio ()
 
bool setContinuousMutationModel_var_pleio ()
 
void allocate_gsl_mutation_matrix_space (unsigned int num_locus)
 
void deallocate_gsl_mutation_matrix_space ()
 
gsl_matrix * set_gsl_mutation_matrix_from_sigma (unsigned int loc, unsigned int pleio_deg)
 
gsl_matrix * set_gsl_mutation_matrix (unsigned int pleio_deg, const vector< double > &varcov)
 
void set_mutation_matrix_decomposition (unsigned int loc, unsigned int pleio_deg)
 
double * getMutationEffectMultivariateGaussian (unsigned int loc)
 
double * getMutationEffectBivariateGaussian (unsigned int loc)
 
double * getMutationEffectUnivariateGaussian (unsigned int loc)
 
double * getMutationEffectMultivariateGaussianLocSpec (unsigned int loc)
 
double * getMutationEffectBivariateGaussianLocSpec (unsigned int loc)
 
double * getMutationEffectUnivariateGaussianLocSpec (unsigned int loc)
 
double * getMutationEffectBivariateDiallelic (unsigned int loc)
 
double * getMutationEffects (unsigned int loc)
 
double * getMutationEffectsVarPleio (unsigned int loc)
 
void inherit (sex_t SEX, TTQuanti *ind, const TTQuanti *parent)
 
void inherit_free (sex_t SEX, TTQuanti *ind, const TTQuanti *parent)
 
void inherit_low (sex_t SEX, TTQuanti *ind, const TTQuanti *parent)
 
unsigned int get_num_mutations ()
 
void mutate (TTQuanti *ind)
 
void mutate_nill (TTQuanti *ind)
 
void mutate_full_pleio (TTQuanti *ind)
 
void mutate_var_pleio (TTQuanti *ind)
 
void mutate_no_pleio (TTQuanti *ind)
 
void mutate_inplace_full_pleio (TTQuanti *ind)
 
void mutate_inplace_var_pleio (TTQuanti *ind)
 
void mutate_inplace_no_pleio (TTQuanti *ind)
 
void mutate_diallelic_pleio (TTQuanti *ind)
 
void mutate_diallelic_var_pleio (TTQuanti *ind)
 
void mutate_diallelic_no_pleio (TTQuanti *ind)
 
bool setEpistasisParameters ()
 
unsigned int get_num_epi_coefs ()
 
bool do_epistasis ()
 
const TMatrixget_epi_coefs () const
 
const TMatrixget_epi_coef_index () const
 
TraitPrototype implementations
virtual void reset ()
 
virtual TTQuantihatch ()
 
virtual TProtoQuanticlone ()
 
virtual trait_t get_type () const
 
virtual int get_phenotype_dimension ()
 Returns the dimension of the phenotype of the trait (size of the array accessed with TTrait::getValue() More...
 
virtual int get_allele_number ()
 Returns the number of allele per locus. More...
 
virtual int get_locus_number ()
 Returns the number of locus. More...
 
StorableComponent implementation
virtual void store_data (BinaryStorageBuffer *saver)
 
virtual bool retrieve_data (BinaryStorageBuffer *reader)
 
SimComponent implementation
virtual bool setParameters ()
 
virtual void loadFileServices (FileServices *loader)
 
virtual void loadStatServices (StatServices *loader)
 
virtual bool resetParameterFromSource (std::string param, SimComponent *cmpt)
 
- Public Member Functions inherited from TTProtoWithMap
 TTProtoWithMap ()
 
 TTProtoWithMap (const TTProtoWithMap &TP)
 
virtual ~TTProtoWithMap ()
 
void setMapIndex (unsigned int idx)
 
unsigned int getMapIndex ()
 
double getRecombRate () const
 
bool setGeneticMapParameters (string prefix, unsigned int numLoci=0)
 
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 ()
 
void unregisterFromGeneticMap ()
 
bool areGeneticMapParamSet (string prefix)
 
bool isRecombinationFree (string prefix)
 
void recordRandomMap ()
 
virtual bool is_mappable ()
 Checks if the trait is mappable, i.e., if the loci can be placed on a genetic map. More...
 
virtual bool is_mapped ()
 Checks if the trait's loci are placed on a genetic map. More...
 
virtual vector< unsigned int > get_locus_map_positions ()
 Returns the map positions of the loci in vector. More...
 
- 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...
 
virtual bool has_parameter (std::string name)
 Param getter. More...
 

Protected Attributes

unsigned int _num_locus
 Total number of loci, for all traits. More...
 
unsigned int _2L
 Diploid locus size, to save on useless operations during mutation. More...
 
unsigned int _num_traits
 Number of traits. More...
 
unsigned int _seq_length
 Total number of allelic values stored in individual sequences, no trait x no locus. More...
 
unsigned int _allele_model
 
string _diallele_datatype
 
double _mutation_rate
 
double _genomic_mutation_rate
 
unsigned int _pleio_type
 
- 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...
 

Private Attributes

TMatrix _allele_value
 
double * _sequence_diallele_values [2]
 
bool _equal_effects
 
double _equal_val_0
 
double _equal_val_1
 
double _equal_val_diff
 
vector< bitstring_trait_masks
 
TMatrix _init_value
 
TMatrix _init_variance
 
TMatrix _mutation_correlation
 
TMatrix _mutation_sigma
 
gsl_matrix ** _gsl_mutation_matrix
 
gsl_matrix ** _evect
 
gsl_vector ** _eval
 
gsl_vector ** _effects_multivar
 
gsl_vector ** _ws
 
double _effects_bivar [2]
 
unsigned int _doInitMutation
 
bool _mutationVarianceIsLocusSpecific
 
bool _mutationEffectIsFixedDiAllele
 
unsigned int _dominance_model
 
TMatrix _dominance_effects
 
bool _equal_dom_coeff
 
bool * _all_chooser
 
size_t _locusByteSize
 
size_t _sizeofLocusType
 
vector< double > _eVariance
 
vector< double > _h2
 
unsigned int _h2_setTime
 
bool _h2_isBroad
 
TMatrix _pleio_matx
 Pleiotropy matrix provided in input (num locu X num trait). More...
 
vector< vector< unsigned int > > _trait_table
 Trait table, (num trait X (variable length/trait)), holds, for each trait, the array position of causative alleles in the sequence. More...
 
vector< vector< unsigned int > > _trait_locus_table
 Table storing the locus id of each locus affecting each trait (num trait X (variable length/trait)). More...
 
vector< vector< unsigned int > > _locus_table
 Locus table, num_locus x 2, first column holds the start position of the alleles of each locus in the sequence, second column counts the number of alleles = pleiotropic degree. More...
 
bool _epistasis
 
unsigned int _num_epi_coefs
 
TMatrix _epistatic_coefs_matrix
 
TMatrix _epistatic_coefs_indices
 
void(TProtoQuanti::* _inherit_fun_ptr )(sex_t, TTQuanti *, const TTQuanti *)
 Pointer to inheritance functions: either inherit_free() (r=0.5), or inherit_low() (r<0.5). More...
 
void(TProtoQuanti::* _mutation_func_ptr )(TTQuanti *)
 Pointer to mutation function, which depends on allele on model (HC, noHC, diallelic) More...
 
double *(TProtoQuanti::* _getMutationValues )(unsigned int)
 Pointer to mutation allele value function, which depends on allele model and number of traits affected. More...
 
vector< double *(TProtoQuanti::*)(unsigned int) > _getMutationValuesVarPleio
 Collection of pointers to mutation functions, which generate allele values in dependence of pleiotropic degree. More...
 
double(TProtoQuanti::* _getGenotypeWithDominance )(double, double, double)
 Pointer to either dominance_h() or dominance_k() function computing the genotypic value with dominance. More...
 
double(TProtoQuanti::* _set_trait_value_func_ptr )(const TTQuanti *, const unsigned int)
 Pointer to either set_trait_value_VE() or set_trait_value_noVE() to compute phenotypic values. More...
 
double(TProtoQuanti::* _set_genotype_func_ptr )(const TTQuanti *, const unsigned int)
 Pointer to functions get_genotype_value_additive() or get_genotype_value_dominance() computing the genotypic value of a trait as function of allele effect. More...
 
TTQuantiSH_stats
 
TTQuantiFH_writer
 
TTQuantiFH_reader
 
TTQFreqExtractor_freqExtractor
 
TTQOhtaStats_ohtaStats
 

Friends

class TTQuanti
 
class TTQuanti_continuous
 
class TTQuanti_continuous_full_pleio
 
class TTQuanti_continuous_var_pleio
 
class TTQuanti_continuous_no_pleio
 
class TTQuanti_continuous_single
 

Additional Inherited Members

- Static Public Member Functions inherited from TTProtoWithMap
static GeneticMapgetGeneticMapRef ()
 
static void recombine (unsigned long indID)
 
- Static Public Attributes inherited from TTProtoWithMap
static GeneticMap _map
 

Detailed Description

Constructor & Destructor Documentation

◆ TProtoQuanti() [1/2]

TProtoQuanti::TProtoQuanti ( )
63  :
64  _num_locus(0),
65  _2L(0),
66  _num_traits(0),
67  _seq_length(0),
68  _allele_model(0),
70  _evect(0),
71  _eval(0),
73  _ws(0),
74  _mutation_rate(0),
76  _doInitMutation(0),
79  _h2_setTime(0),
80  _h2_isBroad(0),
81  _pleio_type(0),
83  _all_chooser(0),
84  _locusByteSize(0),
86  _eVariance(0),
87  _epistasis(false),
88  _num_epi_coefs(0),
95  _stats(0),
96  _writer(0),
97  _reader(0),
98  _freqExtractor(0),
99  _ohtaStats(0)
100 {
101  set_paramset("quantitative_trait", false, this);
102 
103  add_parameter("quanti_traits",INT,true,false,0,0); // MANDATORY
104  add_parameter("quanti_loci",INT,true,false,0,0); // MANDATORY
105  add_parameter("quanti_loci_per_trait", MAT, false, false,0,0);
106  add_parameter("quanti_allele_model",STR,true,false,0,0); // MANDATORY
107  add_parameter("quanti_allele_value",DBL,false,false,0,0);
108  add_parameter("quanti_diallele_datatype", STR, false, false, 0, 0);
109  add_parameter("quanti_init_value",MAT,false,false,0,0);
110  add_parameter("quanti_init_variance",DBL,false,false,0,0,0);
111  add_parameter("quanti_init_model",INT,false,true,0,3);
112 
113  // heritability
114  add_parameter("quanti_environmental_variance",DBL,false,false,0,0);
115  add_parameter("quanti_heritability", DBL, false, false, 0, 0);
116  add_parameter("quanti_heritability_setTime",INT, false, false, 0,0);
117  add_parameter("quanti_heritability_isBroad",BOOL, false, false, 0,0);
118 
119  // mutations
120  add_parameter("quanti_mutation_rate",DBL,true,true,0,1, 0); // MANDATORY
121  add_parameter("quanti_mutation_variance",DBL,false,false,0,0, 0); // accept locus-specific values
122 
123  // pleiotropy
124  add_parameter("quanti_pleiotropy", STR, false, false, 0,0, 0); // optional
125  add_parameter("quanti_mutation_correlation",DBL,false,false,0,0, 0); // accept locus-specific values
126  add_parameter("quanti_mutation_matrix",MAT,false,false,0,0, 0);
127  add_parameter("quanti_pleio_matrix",INT,false,true,0,1); // allows user to set pleiotropic degree of loci
128 
129  //dominance
130 // add_parameter("quanti_dominance_model", INT, false, true, 0, 1, 0);
131  add_parameter("quanti_dominance_mean", DBL, false, false, 0, 0, 0);
132  add_parameter("quanti_dominance_sd", DBL, false, false, 0, 0, 0);
133  add_parameter("quanti_dominance_effects", DBL, false, false, 0, 0, 0);
134 
135  //epsistasis
136  add_parameter("quanti_epistatic_effects", MAT, false, false, 0, 0, 0);
137  add_parameter("quanti_epistatic_network", MAT, false, false, 0, 0, 0);
138 
139  //genetic map parameters:
141 
142  // output
143  add_parameter("quanti_output",STR,false,false,0,0);
144  add_parameter("quanti_logtime",INT,false,false,0,0);
145  add_parameter("quanti_dir",STR,false,false,0,0);
146 
147  add_parameter("quanti_freq_output",BOOL,false,false,0,0);
148  add_parameter("quanti_freq_logtime",INT,false,false,0,0);
149 
150  add_parameter("quanti_ohta_output",BOOL,false,false,0,0);
151  add_parameter("quanti_ohta_logtime",INT,false,false,0,0);
152 
153 
154 // some pointer initialization:
155  _sequence_diallele_values[0] = NULL;
156  _sequence_diallele_values[1] = NULL;
157  _equal_effects = false;
158  _equal_val_0 = 0.0;
159  _equal_val_1 = 0.0;
160  _equal_val_diff = 0.0;
161 
162 }
virtual void set_paramset(ParamSet *paramset)
Sets the ParamSet member.
Definition: simcomponent.h:85
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:111
bool _equal_effects
Definition: ttquanti.h:623
vector< double > _eVariance
Definition: ttquanti.h:656
unsigned int _allele_model
Definition: ttquanti.h:609
bool _epistasis
Definition: ttquanti.h:679
size_t _sizeofLocusType
Definition: ttquanti.h:653
unsigned int _doInitMutation
Definition: ttquanti.h:641
unsigned int _dominance_model
Definition: ttquanti.h:646
void(TProtoQuanti::* _inherit_fun_ptr)(sex_t, TTQuanti *, const TTQuanti *)
Pointer to inheritance functions: either inherit_free() (r=0.5), or inherit_low() (r<0....
Definition: ttquanti.h:688
bool _h2_isBroad
Definition: ttquanti.h:659
TTQuantiFH * _reader
Definition: ttquanti.h:723
unsigned int _h2_setTime
Definition: ttquanti.h:658
unsigned int _seq_length
Total number of allelic values stored in individual sequences, no trait x no locus.
Definition: ttquanti.h:608
double _mutation_rate
Definition: ttquanti.h:613
gsl_matrix ** _evect
Definition: ttquanti.h:636
gsl_vector ** _ws
Definition: ttquanti.h:639
bool _mutationVarianceIsLocusSpecific
Definition: ttquanti.h:642
unsigned int _num_epi_coefs
Definition: ttquanti.h:680
unsigned int _num_traits
Number of traits.
Definition: ttquanti.h:606
double * _sequence_diallele_values[2]
Definition: ttquanti.h:622
TTQuantiSH * _stats
Definition: ttquanti.h:721
void(TProtoQuanti::* _mutation_func_ptr)(TTQuanti *)
Pointer to mutation function, which depends on allele on model (HC, noHC, diallelic)
Definition: ttquanti.h:691
gsl_vector ** _effects_multivar
Definition: ttquanti.h:638
double(TProtoQuanti::* _set_genotype_func_ptr)(const TTQuanti *, const unsigned int)
Pointer to functions get_genotype_value_additive() or get_genotype_value_dominance() computing the ge...
Definition: ttquanti.h:712
double _genomic_mutation_rate
Definition: ttquanti.h:614
gsl_matrix ** _gsl_mutation_matrix
Definition: ttquanti.h:635
bool * _all_chooser
Definition: ttquanti.h:651
double(TProtoQuanti::* _getGenotypeWithDominance)(double, double, double)
Pointer to either dominance_h() or dominance_k() function computing the genotypic value with dominanc...
Definition: ttquanti.h:700
double _equal_val_diff
Definition: ttquanti.h:626
double _equal_val_0
Definition: ttquanti.h:624
size_t _locusByteSize
Definition: ttquanti.h:652
double(TProtoQuanti::* _set_trait_value_func_ptr)(const TTQuanti *, const unsigned int)
Pointer to either set_trait_value_VE() or set_trait_value_noVE() to compute phenotypic values.
Definition: ttquanti.h:706
double *(TProtoQuanti::* _getMutationValues)(unsigned int)
Pointer to mutation allele value function, which depends on allele model and number of traits affecte...
Definition: ttquanti.h:694
gsl_vector ** _eval
Definition: ttquanti.h:637
TTQuantiFH * _writer
Definition: ttquanti.h:722
bool _mutationEffectIsFixedDiAllele
Definition: ttquanti.h:643
TTQOhtaStats * _ohtaStats
Definition: ttquanti.h:725
unsigned int _2L
Diploid locus size, to save on useless operations during mutation.
Definition: ttquanti.h:604
unsigned int _num_locus
Total number of loci, for all traits.
Definition: ttquanti.h:602
double _equal_val_1
Definition: ttquanti.h:625
unsigned int _pleio_type
Definition: ttquanti.h:617
TTQFreqExtractor * _freqExtractor
Definition: ttquanti.h:724
void addGeneticMapParameters(string prefix)
Definition: ttrait_with_map.cc:77
@ DBL
Definition: types.h:77
@ MAT
Definition: types.h:77
@ BOOL
Definition: types.h:77
@ STR
Definition: types.h:77
@ INT
Definition: types.h:77

References _equal_effects, _equal_val_0, _equal_val_1, _equal_val_diff, _sequence_diallele_values, SimComponent::add_parameter(), TTProtoWithMap::addGeneticMapParameters(), BOOL, DBL, INT, MAT, SimComponent::set_paramset(), and STR.

Referenced by clone().

+ Here is the caller graph for this function:

◆ TProtoQuanti() [2/2]

TProtoQuanti::TProtoQuanti ( const TProtoQuanti T)
166  :
168  _2L(_2L),
173  _evect(0),
174  _eval(0),
176  _ws(0),
179  _h2_setTime(0),
180  _h2_isBroad(0),
181  _pleio_type(0),
182  _doInitMutation(0),
185  _dominance_model(0),
186  _all_chooser(0),
187  _locusByteSize(0),
189  _eVariance(0),
192  _inherit_fun_ptr(0),
198  _stats(0),
199  _writer(0),
200  _reader(0),
201  _freqExtractor(0),
202  _ohtaStats(0)
203 {
204  _locusByteSize = T._num_traits * sizeof(double);
205  _paramSet = new ParamSet( *(T._paramSet) ) ;
206 
208 
209  _sequence_diallele_values[0] = NULL;
210  _sequence_diallele_values[1] = NULL;
215 
218 
219 }
Parameters container, implemented in each SimComponent.
Definition: param.h:205
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:47
void copy(const TMatrix &mat)
Copy a matrix.
Definition: tmatrix.h:77
TMatrix _pleio_matx
Pleiotropy matrix provided in input (num locu X num trait).
Definition: ttquanti.h:664
TMatrix _epistatic_coefs_matrix
Definition: ttquanti.h:681
TMatrix _epistatic_coefs_indices
Definition: ttquanti.h:682

References _epistatic_coefs_indices, _epistatic_coefs_matrix, _equal_effects, _equal_val_0, _equal_val_1, _equal_val_diff, _locusByteSize, _num_traits, SimComponent::_paramSet, _pleio_matx, _sequence_diallele_values, and TMatrix::copy().

◆ ~TProtoQuanti()

TProtoQuanti::~TProtoQuanti ( )
virtual
224 {
226 
227  if(_stats){delete _stats; _stats = NULL;}
228  if(_writer){delete _writer; _writer = NULL;}
229  if(_reader) delete _reader;
230  if(_freqExtractor){delete _freqExtractor; _freqExtractor = NULL;}
231  if(_ohtaStats) {delete _ohtaStats; _ohtaStats = NULL;}
232  if(_all_chooser) {delete [] _all_chooser; _all_chooser = NULL;}
233 
235  delete [] _sequence_diallele_values[0];
236  _sequence_diallele_values[0] = NULL;
237  }
238 
240  delete [] _sequence_diallele_values[1];
241  _sequence_diallele_values[1] = NULL;
242  }
243 
244 }
void deallocate_gsl_mutation_matrix_space()
Definition: ttquanti.cc:2136

References _all_chooser, _freqExtractor, _ohtaStats, _reader, _sequence_diallele_values, _stats, _writer, and deallocate_gsl_mutation_matrix_space().

Member Function Documentation

◆ allocate_gsl_mutation_matrix_space()

void TProtoQuanti::allocate_gsl_mutation_matrix_space ( unsigned int  num_locus)
2117 {
2118  _eval = new gsl_vector* [num_loc];
2119  _evect = new gsl_matrix* [num_loc];
2120  _effects_multivar = new gsl_vector* [num_loc];;
2121  _ws = new gsl_vector* [num_loc];
2122  _gsl_mutation_matrix = new gsl_matrix* [num_loc];
2123 
2124  // initializing pointers
2125  for(unsigned int i = 0; i < num_loc; ++i) {
2126  _eval[i] = NULL;
2127  _evect[i] = NULL;
2128  _effects_multivar[i] = NULL;
2129  _ws[i] = NULL;
2130  _gsl_mutation_matrix[i] = NULL;
2131  }
2132 }

References _effects_multivar, _eval, _evect, _gsl_mutation_matrix, and _ws.

Referenced by setContinuousMutationModel_full_pleio(), and setContinuousMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ clone()

virtual TProtoQuanti* TProtoQuanti::clone ( )
inlinevirtual

Implements TraitPrototype.

574 {return new TProtoQuanti(*this);}
TProtoQuanti()
Definition: ttquanti.cc:63

References TProtoQuanti().

◆ deallocate_gsl_mutation_matrix_space()

void TProtoQuanti::deallocate_gsl_mutation_matrix_space ( )
2137 {
2138 
2139  unsigned int SIZE = 1;
2140 
2141  if(_mutationVarianceIsLocusSpecific) // this should represent the state of the simulation which did the allocation
2142  SIZE = _num_locus;
2143 
2145 
2146  for(unsigned int i = 0; i < SIZE; ++i)
2147  if(_gsl_mutation_matrix[i]) gsl_matrix_free(_gsl_mutation_matrix[i]);
2148 
2149  delete [] _gsl_mutation_matrix;
2150  _gsl_mutation_matrix = NULL;
2151  }
2152 
2153  if(_evect) {
2154  for(unsigned int i = 0; i < SIZE; ++i)
2155  if(_evect[i]) gsl_matrix_free(_evect[i]);
2156  delete [] _evect;
2157  _evect = NULL;
2158  }
2159 
2160  if(_eval){
2161  for(unsigned int i = 0; i < SIZE; ++i)
2162  if(_eval[i]) gsl_vector_free(_eval[i]);
2163  delete [] _eval;
2164  _eval = NULL;
2165  }
2166 
2167  if(_effects_multivar) {
2168  for(unsigned int i = 0; i < SIZE; ++i)
2169  if(_effects_multivar[i]) gsl_vector_free(_effects_multivar[i]);
2170  delete [] _effects_multivar;
2171  _effects_multivar = NULL;
2172  }
2173 
2174  if(_ws) {
2175  for(unsigned int i = 0; i < SIZE; ++i)
2176  if(_ws[i]) gsl_vector_free(_ws[i]);
2177  delete [] _ws;
2178  _ws = NULL;
2179  }
2180 
2181 }

References _effects_multivar, _eval, _evect, _gsl_mutation_matrix, _mutationVarianceIsLocusSpecific, _num_locus, and _ws.

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

+ Here is the caller graph for this function:

◆ do_epistasis()

bool TProtoQuanti::do_epistasis ( )
inline
566 {return _epistasis;}

References _epistasis.

Referenced by TTQuantiSH::addQuanti(), and TTQuantiSH::addVarPerPatch().

+ Here is the caller graph for this function:

◆ get_allele_model()

◆ get_allele_number()

virtual int TProtoQuanti::get_allele_number ( )
inlinevirtual

Returns the number of allele per locus.

Implements TraitPrototype.

579 {return (_allele_model > 2 ? 3: 2);} //3 just means more than di-allelic

References _allele_model.

◆ get_allele_position()

int TProtoQuanti::get_allele_position ( const unsigned int  locus,
const unsigned int  trait 
)
2468 {
2469  // not assured that the locus is affecting that trait, first check
2470  if(std::any_of(_trait_locus_table[trait].cbegin(), _trait_locus_table[trait].cend(),
2471  [locus](unsigned int i){return (i == locus);})) {
2472 
2473  // we have to find where the locus sits in the table
2474  vector<unsigned int>::const_iterator I = find(_trait_locus_table[trait].cbegin(), _trait_locus_table[trait].cend(),
2475  locus);
2476  // find index of pointer
2477  unsigned int pos = I - _trait_locus_table[trait].cbegin();
2478 
2479  return _trait_table[trait][pos];
2480  }
2481  return -1;
2482 }
vector< vector< unsigned int > > _trait_locus_table
Table storing the locus id of each locus affecting each trait (num trait X (variable length/trait)).
Definition: ttquanti.h:670
vector< vector< unsigned int > > _trait_table
Trait table, (num trait X (variable length/trait)), holds, for each trait, the array position of caus...
Definition: ttquanti.h:667

References _trait_locus_table, and _trait_table.

Referenced by get_allele_value().

+ Here is the caller graph for this function:

◆ get_allele_value()

double TProtoQuanti::get_allele_value ( const TTQuanti ind,
const unsigned int  allele,
const unsigned int  locus,
const unsigned int  trait 
)
2487 {
2488  assert(allele < 2); // can be 0 or 1 only
2489 
2490  int pos = get_allele_position(locus, trait);
2491 
2492  if(pos > -1)
2493  return ind->get_allele_value(pos, allele);
2494  else
2495  return error("TProtoQuanti::get_allele_value::wrong allele position at locus %i for trait %i\n", locus, trait);
2496 }
int get_allele_position(const unsigned int locus, const unsigned int trait)
Definition: ttquanti.cc:2467
virtual double get_allele_value(int loc, int all) const =0
Called to read the value of the allele at a particular locus.
int error(const char *str,...)
Definition: output.cc:78

References error(), get_allele_position(), and TTrait::get_allele_value().

◆ get_diallele_value()

double TProtoQuanti::get_diallele_value ( unsigned int  locus,
unsigned int  allele 
)
inline
436  {return _allele_value.get(locus, allele);}
double get(unsigned int i, unsigned int j) const
Accessor to element at row i and column j.
Definition: tmatrix.h:192
TMatrix _allele_value
Definition: ttquanti.h:621

References _allele_value, and TMatrix::get().

◆ get_diallele_values()

const TMatrix& TProtoQuanti::get_diallele_values ( )
inline
434 {return _allele_value;}

References _allele_value.

Referenced by TTQFreqExtractor::FHwrite(), TTQuantiSH::getVaNoDominance(), and TTQuantiSH::getVaWithDominance().

+ Here is the caller graph for this function:

◆ get_doInitMutation()

◆ get_dominance()

double TProtoQuanti::get_dominance ( unsigned int  locus,
unsigned int  trait 
)
inline

◆ get_dominance_effects()

const TMatrix& TProtoQuanti::get_dominance_effects ( )
inline
480 {return _dominance_effects;}

References _dominance_effects.

Referenced by TTQuanti_continuous_no_pleio::get_dominant_genotype().

+ Here is the caller graph for this function:

◆ get_dominance_model()

unsigned int TProtoQuanti::get_dominance_model ( )
inline

◆ get_env_var()

vector<double> TProtoQuanti::get_env_var ( )
inline
429 {return _eVariance;}

References _eVariance.

Referenced by TTQuantiFH::FHread(), TTQuantiSH::init(), and TTQuantiFH::write_TABLE().

+ Here is the caller graph for this function:

◆ get_epi_coef_index()

◆ get_epi_coefs()

◆ get_equal_val_0()

◆ get_equal_val_1()

double TProtoQuanti::get_equal_val_1 ( )
inline

◆ get_equal_val_diff()

◆ get_genotype_dominance_h()

double TProtoQuanti::get_genotype_dominance_h ( double  a1,
double  a2,
double  h 
)
inline
2557 {
2558  if(a1<a2) return 2*((1-h)*a1 + h*a2);
2559  return 2*((1-h)*a2 + h*a1);
2560 }

◆ get_genotype_dominance_k()

double TProtoQuanti::get_genotype_dominance_k ( double  a1,
double  a2,
double  k 
)
inline
2573 {
2574  return a1 + a2 + k*fabs(a2-a1);
2575 }

Referenced by get_genotype_with_dominance(), and setParameters().

+ Here is the caller graph for this function:

◆ get_genotype_with_dominance()

double TProtoQuanti::get_genotype_with_dominance ( const double  a1,
const double  a2,
const unsigned int  locus,
const unsigned int  trait 
)
2540 {
2541  // let's use the "k" model by default, it's the fastest:
2542  return get_genotype_dominance_k( a1 , a2, get_dominance(locus, trait));
2543 // return (this->*_getGenotypeWithDominance)( a1 , a2, get_dominance(locus, trait));
2544 }
double get_dominance(unsigned int locus, unsigned int trait)
Definition: ttquanti.h:478
double get_genotype_dominance_k(double a1, double a2, double k)
Definition: ttquanti.cc:2572

References get_dominance(), and get_genotype_dominance_k().

Referenced by TTQuanti_continuous_full_pleio::get_dominant_genotype(), TTQuanti_continuous_var_pleio::get_dominant_genotype(), TTQuanti_continuous_single::get_dominant_genotype(), TTQuanti_diallelic_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_full_pleio::get_dominant_genotype(), TTQuanti_diallelic_var_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_var_pleio::get_dominant_genotype(), TTQuanti_continuous_full_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_full_pleio_epistasis::get_dominant_genotype(), TTQuanti_continuous_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::get_dominant_genotype(), and TTQuantiSH::getVaWithDominance().

+ Here is the caller graph for this function:

◆ get_genotypic_value()

double TProtoQuanti::get_genotypic_value ( const TTQuanti ind,
const unsigned int  trait 
)
inline
484  {
485  return (this->*_set_genotype_func_ptr)(ind, trait);
486  }

References _set_genotype_func_ptr.

Referenced by TTQuanti_continuous::get_full_genotype(), TTQuanti_diallelic::get_full_genotype(), and TTQuanti_diallelic_bitstring::get_full_genotype().

+ Here is the caller graph for this function:

◆ get_h2_isBroad()

bool TProtoQuanti::get_h2_isBroad ( )
inline
432 {return _h2_isBroad;}

References _h2_isBroad.

Referenced by TTQuantiSH::getVaWithDominance().

+ Here is the caller graph for this function:

◆ get_h2_setTime()

unsigned int TProtoQuanti::get_h2_setTime ( )
inline
431 {return _h2_setTime;}

References _h2_setTime.

Referenced by LCE_Breed_Quanti::setVefromVa().

+ Here is the caller graph for this function:

◆ get_heritability()

vector<double> TProtoQuanti::get_heritability ( )
inline
430 {return _h2;}
vector< double > _h2
Definition: ttquanti.h:657

References _h2.

Referenced by LCE_QuantiModifier::execute(), TTQuantiSH::init(), LCE_Breed_Quanti::NonWrightFisherPopulation(), and LCE_Breed_Quanti::WrightFisherPopulation().

+ Here is the caller graph for this function:

◆ get_init_value()

double TProtoQuanti::get_init_value ( unsigned int  i)
inline

◆ get_init_variance()

double TProtoQuanti::get_init_variance ( unsigned int  i)
inline

◆ get_locus_byte_size()

◆ get_locus_ID()

◆ get_locus_number()

virtual int TProtoQuanti::get_locus_number ( )
inlinevirtual

Returns the number of locus.

Implements TraitPrototype.

581 {return _num_locus;}

References _num_locus.

◆ get_locus_PD()

unsigned int TProtoQuanti::get_locus_PD ( unsigned int  locus)
inline
456 {return _locus_table[locus][1];}
vector< vector< unsigned int > > _locus_table
Locus table, num_locus x 2, first column holds the start position of the alleles of each locus in the...
Definition: ttquanti.h:675

References _locus_table.

Referenced by TTQuanti_diallelic_bitstring_var_pleio::copy_sequence_1locus(), TTQuanti_continuous_var_pleio::copy_sequence_1locus(), TTQuanti_diallelic_var_pleio::copy_sequence_1locus(), getMutationEffectMultivariateGaussian(), getMutationEffectMultivariateGaussianLocSpec(), and TTQuanti_continuous_var_pleio::init_sequence().

+ Here is the caller graph for this function:

◆ get_locus_seq_pos()

unsigned int TProtoQuanti::get_locus_seq_pos ( unsigned int  loc,
unsigned int  trait 
)
inline
453  {return _trait_table[trait][loc];}

References _trait_table.

Referenced by TTQuantiFH::FHread(), TTQFreqExtractor::FHwrite(), TTQuanti_continuous_var_pleio::get_additive_genotype(), TTQuanti_continuous_no_pleio::get_additive_genotype(), TTQuanti_diallelic_no_pleio::get_additive_genotype(), TTQuanti_diallelic_full_pleio::get_additive_genotype(), TTQuanti_diallelic_var_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_no_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_var_pleio::get_additive_genotype(), TTQuanti_diallelic_full_pleio_epistasis::get_additive_genotype(), TTQuanti_continuous_no_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_no_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_bitstring_no_pleio::get_additive_genotype_equal_effects(), TTQuanti_continuous_var_pleio::get_dominant_genotype(), TTQuanti_continuous_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_full_pleio::get_dominant_genotype(), TTQuanti_diallelic_var_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_var_pleio::get_dominant_genotype(), TTQuanti_diallelic_full_pleio_epistasis::get_dominant_genotype(), TTQuanti_continuous_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::get_dominant_genotype(), TTQuantiSH::getVaWithDominance(), TTQuanti_continuous_var_pleio::init_sequence(), TTQuanti_continuous_no_pleio::init_sequence(), TTQuanti_diallelic_full_pleio::init_sequence(), TTQuanti_diallelic_var_pleio::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio::init_sequence(), TTQuanti_diallelic_bitstring_var_pleio::init_sequence(), TTQuanti_diallelic_full_pleio_epistasis::init_sequence(), TTQuanti_continuous_no_pleio_epistasis::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::init_sequence(), TTQuantiFH::print(), TTQuantiFH::print_PLINK_PED(), setDiallelicMutationModel(), TTQuanti_continuous_var_pleio::show_up(), TTQuanti_continuous_no_pleio::show_up(), TTQuanti_diallelic_no_pleio::show_up(), TTQuanti_diallelic_full_pleio::show_up(), TTQuanti_diallelic_var_pleio::show_up(), TTQuanti_diallelic_bitstring_no_pleio::show_up(), TTQuanti_diallelic_bitstring_full_pleio::show_up(), TTQuanti_diallelic_bitstring_var_pleio::show_up(), TTQuanti_diallelic_full_pleio_epistasis::show_up(), TTQuanti_continuous_no_pleio_epistasis::show_up(), TTQuanti_diallelic_no_pleio_epistasis::show_up(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::show_up(), and TTQuanti_diallelic_bitstring_full_pleio_epistasis::show_up().

◆ get_locus_start_pos()

◆ get_num_epi_coefs()

unsigned int TProtoQuanti::get_num_epi_coefs ( )
inline
565 {return _num_epi_coefs;}

References _num_epi_coefs.

◆ get_num_locus() [1/2]

unsigned int TProtoQuanti::get_num_locus ( )
inline
423 {return _num_locus;}

References _num_locus.

Referenced by TTQuantiFH::FHread(), TTQFreqExtractor::FHwrite(), TTQOhtaStats::FHwrite(), TTQuanti_continuous_full_pleio::get_additive_genotype(), TTQuanti_continuous_var_pleio::get_additive_genotype(), TTQuanti_continuous_no_pleio::get_additive_genotype(), TTQuanti_continuous_single::get_additive_genotype(), TTQuanti_diallelic_no_pleio::get_additive_genotype(), TTQuanti_diallelic_full_pleio::get_additive_genotype(), TTQuanti_diallelic_var_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_no_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_var_pleio::get_additive_genotype(), TTQuanti_continuous_full_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_full_pleio_epistasis::get_additive_genotype(), TTQuanti_continuous_no_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_no_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_bitstring_no_pleio::get_additive_genotype_equal_effects(), TTQuanti_continuous_full_pleio::get_dominant_genotype(), TTQuanti_continuous_var_pleio::get_dominant_genotype(), TTQuanti_continuous_no_pleio::get_dominant_genotype(), TTQuanti_continuous_single::get_dominant_genotype(), TTQuanti_diallelic_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_full_pleio::get_dominant_genotype(), TTQuanti_diallelic_var_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_var_pleio::get_dominant_genotype(), TTQuanti_continuous_full_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_full_pleio_epistasis::get_dominant_genotype(), TTQuanti_continuous_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::get_dominant_genotype(), TTQuantiSH::getVaWithDominance(), TTQuantiSH::init(), TTQuanti_continuous_full_pleio::init_sequence(), TTQuanti_continuous_var_pleio::init_sequence(), TTQuanti_continuous_no_pleio::init_sequence(), TTQuanti_diallelic_no_pleio::init_sequence(), TTQuanti_diallelic_full_pleio::init_sequence(), TTQuanti_diallelic_var_pleio::init_sequence(), TTQuanti_diallelic_bitstring_no_pleio::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio::init_sequence(), TTQuanti_diallelic_bitstring_var_pleio::init_sequence(), TTQuanti_continuous_full_pleio_epistasis::init_sequence(), TTQuanti_diallelic_full_pleio_epistasis::init_sequence(), TTQuanti_continuous_no_pleio_epistasis::init_sequence(), TTQuanti_diallelic_no_pleio_epistasis::init_sequence(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::init_sequence(), TTQuanti_continuous::operator==(), TTQuanti_diallelic::operator==(), TTQuanti_diallelic_bitstring::operator==(), TTQuantiFH::print(), TTQuantiFH::print_PLINK_PED(), setDiallelicMutationModel(), LCE_QuantiInit::setParameters(), TTQuanti_continuous_full_pleio::show_up(), TTQuanti_continuous_var_pleio::show_up(), TTQuanti_continuous_no_pleio::show_up(), TTQuanti_diallelic_no_pleio::show_up(), TTQuanti_diallelic_full_pleio::show_up(), TTQuanti_diallelic_var_pleio::show_up(), TTQuanti_diallelic_bitstring_no_pleio::show_up(), TTQuanti_diallelic_bitstring_full_pleio::show_up(), TTQuanti_diallelic_bitstring_var_pleio::show_up(), TTQuanti_continuous_full_pleio_epistasis::show_up(), TTQuanti_diallelic_full_pleio_epistasis::show_up(), TTQuanti_continuous_no_pleio_epistasis::show_up(), TTQuanti_diallelic_no_pleio_epistasis::show_up(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::show_up(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::show_up(), TTQuantiFH::write_PLINK(), and TTQuantiFH::write_TABLE().

◆ get_num_locus() [2/2]

unsigned int TProtoQuanti::get_num_locus ( unsigned int  trait)
inline
424 {return _trait_table[trait].size();}

References _trait_table.

◆ get_num_mutations()

unsigned int TProtoQuanti::get_num_mutations ( )
inline
542  {
543  return (unsigned int)RAND::Binomial(_mutation_rate, _2L);
544  }
static double Binomial(double p, unsigned int n)
Definition: Uniform.h:489

References _2L, _mutation_rate, and RAND::Binomial().

Referenced by mutate_diallelic_no_pleio(), mutate_diallelic_pleio(), mutate_diallelic_var_pleio(), mutate_full_pleio(), mutate_inplace_full_pleio(), mutate_inplace_no_pleio(), mutate_inplace_var_pleio(), mutate_no_pleio(), and mutate_var_pleio().

+ Here is the caller graph for this function:

◆ get_num_traits()

unsigned int TProtoQuanti::get_num_traits ( )
inline
422 {return _num_traits;}

References _num_traits.

Referenced by LCE_PhenotypeExpression::check_g_index_matrix(), TTQuanti_diallelic_bitstring_full_pleio::copy_sequence_1locus(), TTQuanti_continuous_full_pleio_epistasis::copy_sequence_1locus(), TTQuanti_diallelic_full_pleio_epistasis::copy_sequence_1locus(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::copy_sequence_1locus(), TTQuanti_continuous_full_pleio::copy_sequence_1locus(), TTQuanti_diallelic_full_pleio::copy_sequence_1locus(), TTQuanti_diallelic_bitstring_full_pleio::copy_sequence_block(), TTQuanti_continuous_full_pleio_epistasis::copy_sequence_block(), TTQuanti_diallelic_full_pleio_epistasis::copy_sequence_block(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::copy_sequence_block(), TTQuanti_continuous_full_pleio::copy_sequence_block(), TTQuanti_diallelic_full_pleio::copy_sequence_block(), TTQuantiFH::FHread(), TTQFreqExtractor::FHwrite(), TTQOhtaStats::FHwrite(), TTQuanti_continuous_full_pleio::get_additive_genotype(), TTQuanti_diallelic_full_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_additive_genotype(), TTQuanti_continuous_full_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_full_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::get_additive_genotype(), TTQuanti_continuous_full_pleio::get_dominant_genotype(), TTQuanti_diallelic_full_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_dominant_genotype(), TTQuanti_continuous_full_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_full_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::get_dominant_genotype(), TTQuanti_continuous::init(), TTQuanti_diallelic::init(), TTQuantiSH::init(), TTQuanti_diallelic_bitstring::init(), TTQuanti_continuous_full_pleio::init_sequence(), TTQuanti_continuous_var_pleio::init_sequence(), TTQuanti_continuous_no_pleio::init_sequence(), TTQuanti_diallelic_full_pleio::init_sequence(), TTQuanti_diallelic_var_pleio::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio::init_sequence(), TTQuanti_diallelic_bitstring_var_pleio::init_sequence(), TTQuanti_continuous_full_pleio_epistasis::init_sequence(), TTQuanti_diallelic_full_pleio_epistasis::init_sequence(), TTQuanti_continuous_no_pleio_epistasis::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::init_sequence(), TTQuanti_continuous::operator==(), TTQuanti_diallelic::operator==(), TTQuanti_diallelic_bitstring::operator==(), TTQuantiFH::print(), TTQuantiFH::print_PLINK_FAM(), TTQuantiFH::print_PLINK_PED(), TTQuanti::reset_phenotype_to_genotypic_value(), LCE_PhenotypeExpression::set_g_value_matrix(), TTQuanti::set_value(), LCE_PhenotypeExpression::setParameters(), LCE_QuantiModifier::setVefromVa(), LCE_Breed_Quanti::setVefromVa(), TTQuanti_continuous_full_pleio::show_up(), TTQuanti_continuous_var_pleio::show_up(), TTQuanti_continuous_no_pleio::show_up(), TTQuanti_diallelic_no_pleio::show_up(), TTQuanti_diallelic_full_pleio::show_up(), TTQuanti_diallelic_var_pleio::show_up(), TTQuanti_diallelic_bitstring_no_pleio::show_up(), TTQuanti_diallelic_bitstring_full_pleio::show_up(), TTQuanti_diallelic_bitstring_var_pleio::show_up(), TTQuanti_continuous_full_pleio_epistasis::show_up(), TTQuanti_diallelic_full_pleio_epistasis::show_up(), TTQuanti_continuous_no_pleio_epistasis::show_up(), TTQuanti_diallelic_no_pleio_epistasis::show_up(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::show_up(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::show_up(), TTQuantiFH::write_PLINK(), and TTQuantiFH::write_TABLE().

◆ get_phenotype_dimension()

virtual int TProtoQuanti::get_phenotype_dimension ( )
inlinevirtual

Returns the dimension of the phenotype of the trait (size of the array accessed with TTrait::getValue()

Implements TraitPrototype.

577 {return _num_traits;}

References _num_traits.

◆ get_phenotypic_value()

double TProtoQuanti::get_phenotypic_value ( const TTQuanti ind,
const unsigned int  trait 
)
inline
488  {
489  return (this->*_set_trait_value_func_ptr)(ind, trait);
490  }

References _set_trait_value_func_ptr.

Referenced by TTQuanti::set_value().

+ Here is the caller graph for this function:

◆ get_pleio_matrix()

const TMatrix& TProtoQuanti::get_pleio_matrix ( )
inline
451 {return _pleio_matx;}

References _pleio_matx.

◆ get_pleiotropy_type()

unsigned int TProtoQuanti::get_pleiotropy_type ( )
inline
425 {return _pleio_type;}

References _pleio_type.

Referenced by TTQuanti_continuous::operator==(), TTQuanti_diallelic::operator==(), and TTQuanti_diallelic_bitstring::operator==().

+ Here is the caller graph for this function:

◆ get_seq_diallele_value()

double TProtoQuanti::get_seq_diallele_value ( unsigned int  position,
unsigned int  allele 
)
inline
438  {return _sequence_diallele_values[allele][position];}

References _sequence_diallele_values.

Referenced by TTQuantiFH::FHread(), TTQuanti_diallelic_no_pleio::get_additive_genotype(), TTQuanti_diallelic_full_pleio::get_additive_genotype(), TTQuanti_diallelic_var_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_no_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_additive_genotype(), TTQuanti_diallelic_bitstring_var_pleio::get_additive_genotype(), TTQuanti_diallelic_full_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_no_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::get_additive_genotype(), TTQuanti_diallelic::get_allele_value(), TTQuanti_diallelic_bitstring::get_allele_value(), TTQuanti_diallelic_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_full_pleio::get_dominant_genotype(), TTQuanti_diallelic_var_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_no_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio::get_dominant_genotype(), TTQuanti_diallelic_bitstring_var_pleio::get_dominant_genotype(), TTQuanti_diallelic_full_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::get_dominant_genotype(), TTQuanti_diallelic::set_allele_value(), and TTQuanti_diallelic_bitstring::set_allele_value().

◆ get_seq_length()

unsigned int TProtoQuanti::get_seq_length ( )
inline
426 {return _seq_length;}

References _seq_length.

Referenced by TTQuantiFH::FHread(), TTQFreqExtractor::FHwrite(), TTQuanti_diallelic::get_allele(), TTQuanti_diallelic_bitstring::get_allele(), TTQuanti_continuous::get_allele_value(), TTQuanti_diallelic::get_allele_value(), TTQuanti_diallelic_bitstring::get_allele_value(), TTQuantiSH::getSNPalleleFreqInPatch(), TTQuanti_continuous::init(), TTQuanti_diallelic::init(), TTQuanti_diallelic_bitstring::init(), TTQuanti_diallelic_no_pleio::init_sequence(), TTQuanti_diallelic_full_pleio::init_sequence(), TTQuanti_diallelic_var_pleio::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio::init_sequence(), TTQuanti_diallelic_bitstring_var_pleio::init_sequence(), TTQuanti_diallelic_full_pleio_epistasis::init_sequence(), TTQuanti_diallelic_no_pleio_epistasis::init_sequence(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::init_sequence(), TTQuanti_continuous::operator=(), TTQuanti_diallelic::operator=(), TTQuanti_continuous::operator==(), TTQuanti_diallelic::operator==(), TTQuanti_diallelic_bitstring::operator==(), TTQuanti_continuous::retrieve_data(), TTQuanti_diallelic::retrieve_data(), TTQuanti_diallelic_bitstring::set_allele_bit(), TTQuanti_continuous::set_sequence(), TTQuanti_diallelic::set_sequence(), TTQuanti_continuous_full_pleio::show_up(), TTQuanti_continuous_var_pleio::show_up(), TTQuanti_continuous_no_pleio::show_up(), TTQuanti_diallelic_no_pleio::show_up(), TTQuanti_diallelic_full_pleio::show_up(), TTQuanti_diallelic_var_pleio::show_up(), TTQuanti_diallelic_bitstring_no_pleio::show_up(), TTQuanti_diallelic_bitstring_full_pleio::show_up(), TTQuanti_diallelic_bitstring_var_pleio::show_up(), TTQuanti_continuous_full_pleio_epistasis::show_up(), TTQuanti_diallelic_full_pleio_epistasis::show_up(), TTQuanti_continuous_no_pleio_epistasis::show_up(), TTQuanti_diallelic_no_pleio_epistasis::show_up(), TTQuanti_diallelic_bitstring_no_pleio_epistasis::show_up(), TTQuanti_diallelic_bitstring_full_pleio_epistasis::show_up(), TTQuanti_continuous::store_data(), and TTQuanti_diallelic::store_data().

◆ get_sequence_block_size()

◆ get_size_locus_type()

◆ get_stater()

TTQuantiSH* TProtoQuanti::get_stater ( )
inline
449 {return _stats;}

References _stats.

Referenced by LCE_QuantiModifier::setVefromVa(), and LCE_Breed_Quanti::setVefromVa().

+ Here is the caller graph for this function:

◆ get_trait_mask()

◆ get_trait_mutation_variance()

double TProtoQuanti::get_trait_mutation_variance ( unsigned int  trait)
2580 {
2581  double Vm;
2582 
2583  if(_mutation_sigma.nrows() == 1) // same value for all loci
2584  Vm = 2 * _genomic_mutation_rate * _mutation_sigma.get(0, trait);
2585  else
2586  Vm = _mutation_sigma.colSum(trait) * _mutation_rate * 2;
2587 
2588  return Vm;
2589 }
double colSum(unsigned int col)
Sum all elements in a column.
Definition: tmatrix.h:343
unsigned int nrows() const
Definition: tmatrix.h:212
TMatrix _mutation_sigma
Definition: ttquanti.h:634

References _genomic_mutation_rate, _mutation_rate, _mutation_sigma, TMatrix::colSum(), TMatrix::get(), and TMatrix::nrows().

◆ get_type()

virtual trait_t TProtoQuanti::get_type ( ) const
inlinevirtual

Implements TraitPrototype.

575 {return QUANT;}
#define QUANT
Definition: types.h:71

References QUANT.

Referenced by TTQuantiSH::init(), TTQuantiFH::setOutputOption(), and TTQuantiFH::write_PLINK().

+ Here is the caller graph for this function:

◆ getMutationEffectBivariateDiallelic()

double * TProtoQuanti::getMutationEffectBivariateDiallelic ( unsigned int  loc)
2457 {
2458  bool pos = RAND::RandBool();
2459  _effects_bivar[0] = _allele_value.get(loc, pos);
2461  pos : RAND::RandBool()) );
2462  return &_effects_bivar[0];
2463 }
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:126
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:164
TMatrix _mutation_correlation
Definition: ttquanti.h:633
double _effects_bivar[2]
Definition: ttquanti.h:640

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

Referenced by setMutationModel_full_pleio().

+ Here is the caller graph for this function:

◆ getMutationEffectBivariateGaussian()

double * TProtoQuanti::getMutationEffectBivariateGaussian ( unsigned int  loc)
2414 {
2415  //no need to assert() as we are using a different set of containers and read from mutation_sigma directly
2417  &_effects_bivar[0], &_effects_bivar[1]);
2418  return &_effects_bivar[0];
2419 }
static void BivariateGaussian(double sigma1, double sigma2, double rho, double *out1, double *out2)
Definition: Uniform.h:330

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

Referenced by setMutationModel_full_pleio(), and setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ getMutationEffectBivariateGaussianLocSpec()

double * TProtoQuanti::getMutationEffectBivariateGaussianLocSpec ( unsigned int  loc)
2424 {
2426  &_effects_bivar[0], &_effects_bivar[1]);
2427  return &_effects_bivar[0];
2428 }

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

Referenced by setMutationModel_full_pleio(), and setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ getMutationEffectMultivariateGaussian()

double * TProtoQuanti::getMutationEffectMultivariateGaussian ( unsigned int  loc)
2390 {
2391  // assert we are using the correct mutation environment
2392  assert(get_locus_PD(loc) == _effects_multivar[0]->size);
2393 
2394  RAND::MultivariateGaussian(_eval[0], _evect[0], _ws[0], _effects_multivar[0]);
2395 
2396  return _effects_multivar[0]->data;
2397 }
unsigned int get_locus_PD(unsigned int locus)
Definition: ttquanti.h:456

References _effects_multivar, _eval, _evect, _ws, and get_locus_PD().

Referenced by setMutationModel_full_pleio().

+ Here is the caller graph for this function:

◆ getMutationEffectMultivariateGaussianLocSpec()

double * TProtoQuanti::getMutationEffectMultivariateGaussianLocSpec ( unsigned int  loc)
2402 {
2403  // assert we are using the correct mutation environment
2404  assert(get_locus_PD(loc) == _effects_multivar[loc]->size);
2405 
2406  RAND::MultivariateGaussian(_eval[loc], _evect[loc], _ws[loc], _effects_multivar[loc]);
2407 
2408  return _effects_multivar[loc]->data;
2409 }

References _effects_multivar, _eval, _evect, _ws, and get_locus_PD().

Referenced by setMutationModel_full_pleio(), and setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ getMutationEffects()

double* TProtoQuanti::getMutationEffects ( unsigned int  loc)
inline

◆ getMutationEffectsVarPleio()

double* TProtoQuanti::getMutationEffectsVarPleio ( unsigned int  loc)
inline
535  {
536  return (this->* _getMutationValuesVarPleio[loc]) (loc);
537  }
vector< double *(TProtoQuanti::*)(unsigned int) > _getMutationValuesVarPleio
Collection of pointers to mutation functions, which generate allele values in dependence of pleiotrop...
Definition: ttquanti.h:697

References _getMutationValuesVarPleio.

Referenced by TTQuanti_continuous_var_pleio::init_sequence().

+ Here is the caller graph for this function:

◆ getMutationEffectUnivariateGaussian()

double * TProtoQuanti::getMutationEffectUnivariateGaussian ( unsigned int  loc)
2433 {
2435  return &_effects_bivar[0];
2436 }
static double Gaussian(double sigma)
Definition: Uniform.h:261

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

Referenced by setMutationModel_no_pleio(), and setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ getMutationEffectUnivariateGaussianLocSpec()

double * TProtoQuanti::getMutationEffectUnivariateGaussianLocSpec ( unsigned int  loc)
2441 {
2443  return &_effects_bivar[0];
2444 }

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

Referenced by setMutationModel_no_pleio(), and setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ has_equal_domCoeff()

bool TProtoQuanti::has_equal_domCoeff ( )
inline

◆ has_equal_effects()

◆ hatch()

TTQuanti * TProtoQuanti::hatch ( )
virtual

Implements TraitPrototype.

2898 {
2899  TTQuanti* kid;
2900 
2901  if(_epistasis && _pleio_type == 2)
2902  fatal("quantitative trait loci with variable pleiotropy are not implemented for the epistatic case.\n");
2903 
2904  if(_pleio_type == 0) { //non-pleiotropic cases
2905 
2906  if(_allele_model <= 2) { // diallelic
2907 
2908  if(_epistasis) {
2909  if(_diallele_datatype == "byte")
2911  else
2913  }
2914  else if(_diallele_datatype == "byte") {
2915  kid = new TTQuanti_diallelic_no_pleio();
2916  } else {
2918  }
2919 
2920  } else { // continuous
2921 
2922  if(_epistasis)
2924  else
2925  kid = new TTQuanti_continuous_no_pleio();
2926  }
2927 
2928  } else if (_pleio_type == 1) { //full-pleiotropic cases
2929 
2930  if(_allele_model <= 2) {
2931 
2932  if(_epistasis) {
2933  if(_diallele_datatype == "byte")
2935  else
2937  }
2938  else if(_diallele_datatype == "byte") {
2939  kid = new TTQuanti_diallelic_full_pleio();
2940  } else {
2942  }
2943 
2944  } else {
2945 
2946  if(_epistasis)
2948  else
2949  kid = new TTQuanti_continuous_full_pleio();
2950  }
2951 
2952  } else { // variable pleiotropy cases
2953 
2954  if(_allele_model <= 2) {
2955 
2956  if(_diallele_datatype == "byte")
2957  kid = new TTQuanti_diallelic_var_pleio();
2958  else
2960 
2961  } else {
2962  kid = new TTQuanti_continuous_var_pleio();
2963  }
2964  }
2965 
2966  kid->set_proto(this);
2967 
2968  // set specific optimisations:
2969 
2970 
2971  return kid;
2972 }
friend class TTQuanti_continuous_var_pleio
Definition: ttquanti.h:717
string _diallele_datatype
Definition: ttquanti.h:610
friend class TTQuanti_continuous_no_pleio
Definition: ttquanti.h:718
friend class TTQuanti_continuous_full_pleio
Definition: ttquanti.h:716
TTQuanti_continuous_full_pleio : universal pleiotropy.
Definition: ttquanti_epistasis.h:39
TTQuanti_continuous_no_pleio : multiple non-pleiotropic traits with epistasis.
Definition: ttquanti_epistasis.h:99
TTQuanti_diallelic_bitstring_full_pleio_epistasis : pleiotropic di-allelic bitstring with epistasis.
Definition: ttquanti_epistasis.h:187
TTQuanti_diallelic_bitstring_full_pleio : pleiotropic di-allelic loci, max PD = 2.
Definition: ttquanti_bitstring.h:129
TTQuanti_diallelic_bitstring_no_pleio_epistasis : non-pleiotropic di-allelic bitstring with epistasis...
Definition: ttquanti_epistasis.h:158
TTQuanti_diallelic_bitstring_no_pleio : single or multiple non-pleiotropic traits,...
Definition: ttquanti_bitstring.h:96
TTQuanti_diallelic_bitstring_var_pleio : variable pleiotropic di-allelic loci, max PD = 2.
Definition: ttquanti_bitstring.h:156
TTQuanti_diallelic_full_pleio : pleiotropic di-allelic loci, max PD = 2.
Definition: ttquanti_epistasis.h:69
TTQuanti_diallelic_full_pleio : pleiotropic di-allelic loci, max PD = 2.
Definition: ttquanti.h:355
TTQuanti_diallelic_no_pleio_epistasis : single or multiple non-pleiotropic traits,...
Definition: ttquanti_epistasis.h:128
TTQuanti_diallelic_no_pleio : single or multiple non-pleiotropic traits, di-allelic.
Definition: ttquanti.h:328
TTQuanti_diallelic_var_pleio : variable pleiotropic di-allelic loci, max PD = 2.
Definition: ttquanti.h:382
TTQuanti.
Definition: ttquanti.h:60
void set_proto(TProtoQuanti *proto)
Definition: ttquanti.h:96
void fatal(const char *str,...)
Definition: output.cc:99

References _allele_model, _diallele_datatype, _epistasis, _pleio_type, fatal(), TTQuanti::set_proto(), TTQuanti_continuous_full_pleio, TTQuanti_continuous_no_pleio, and TTQuanti_continuous_var_pleio.

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ inherit()

void TProtoQuanti::inherit ( sex_t  SEX,
TTQuanti ind,
const TTQuanti parent 
)
inline
2594 {
2595  (this->*_inherit_fun_ptr)(SEX, ind, parent);
2596 }

References _inherit_fun_ptr.

Referenced by TTQuanti::inherit().

+ Here is the caller graph for this function:

◆ inherit_free()

void TProtoQuanti::inherit_free ( sex_t  SEX,
TTQuanti ind,
const TTQuanti parent 
)
inline
2639 {
2640 // assert(_all_chooser);
2641 
2642 // for(unsigned int i = 0; i < _num_locus; ++i)
2643 // _all_chooser[i] = RAND::RandBool();
2644 
2645  // copy the information for one locus at a time
2646  for(unsigned int i = 0; i < _num_locus; ++i)
2647 // ind->copy_sequence_block(SEX, _all_chooser[i], i, i+1, parent);
2648  ind->copy_sequence_1locus(SEX, RAND::RandBool(), i, parent);
2649 
2650  // note that more than one value may be copied at a time because of pleiotropy
2651 }
virtual void copy_sequence_1locus(sex_t SEX, unsigned int strand, unsigned int at, const TTQuanti *parent)=0

References _num_locus, TTQuanti::copy_sequence_1locus(), and RAND::RandBool().

Referenced by setGeneticMapParams().

+ Here is the caller graph for this function:

◆ inherit_low()

void TProtoQuanti::inherit_low ( sex_t  SEX,
TTQuanti ind,
const TTQuanti parent 
)
inline
2601 {
2602  unsigned int prevLoc = 0;
2603 
2604  //the table containing the loci at which x-overs happen
2605  vector< pair<unsigned int, unsigned int> > recTable = _map.reduceJunctions(SEX, _mapIndex);
2606 
2607 
2608 #ifdef _REC_DEBUG_
2609  //number of x-overs
2610  unsigned int nbRec = recTable.size();
2611  cout << "TProtoQuanti::inherit_low; nb Rec = "<<nbRec - 1<<endl;
2612  cout << " --sex = "<<SEX<<"\n";
2613 #endif
2614 
2615 // unsigned int num_copied = 0;
2616 
2617  vector< pair<unsigned int, unsigned int> >::const_iterator xover = recTable.begin();
2618 
2619  while(xover != recTable.end()) {
2620 
2621 #ifdef _REC_DEBUG_
2622  cout<< " copy seq from "<<prevLoc<<" to "<<xover->first
2623  <<" ("<<(xover->first - prevLoc)<<" loc) ("
2624  <<(xover->first - prevLoc)*_sizeofLocusType
2625  <<"B) on side "<<xover->second<<std::endl;
2626 #endif
2627 
2628  ind->copy_sequence_block(SEX, xover->second, prevLoc, xover->first, parent);
2629 
2630  prevLoc = xover->first;
2631 
2632  xover++;
2633  }
2634 }
vector< pair< unsigned int, unsigned int > > reduceJunctions(sex_t SEX, unsigned int trait_idx)
Remove multiple x-over at the same locus when traits differ in number of loci.
Definition: ttrait_with_map.cc:1209
static GeneticMap _map
Definition: ttrait_with_map.h:208
unsigned int _mapIndex
Definition: ttrait_with_map.h:192
virtual void copy_sequence_block(sex_t SEX, unsigned int strand, unsigned int from_pos, unsigned int to_pos, const TTQuanti *parent)=0

References TTProtoWithMap::_map, TTProtoWithMap::_mapIndex, _sizeofLocusType, TTQuanti::copy_sequence_block(), and GeneticMap::reduceJunctions().

Referenced by setGeneticMapParams().

+ Here is the caller graph for this function:

◆ loadFileServices()

void TProtoQuanti::loadFileServices ( FileServices loader)
virtual

Implements SimComponent.

2977 {
2978  int logtime = 0;
2979 
2980  //writer
2981  // purge previous settings:
2982  if(_writer) delete _writer;
2983  _writer = NULL;
2984 
2985  if(get_parameter("quanti_output")->isSet()) {
2986 
2987  _writer = new TTQuantiFH(this);
2988 
2989  if(get_parameter("quanti_output")->getArg().find("snp_") != string::npos && get_allele_model() > 2) {
2990  fatal("parameter \"quanti_output\" option \"%s\" can only be selected for di-allelic quantitative loci\n",
2991  get_parameter("quanti_output")->getArg().c_str());
2992  }
2993 
2994  _writer->setOutputOption(get_parameter("quanti_output")->getArg());
2995 
2996  if(!get_parameter("quanti_logtime")->isSet())
2997  fatal("quant trait::parameter \"quanti_logtime\" is missing!\n");
2998 
2999  Param* param = get_parameter("quanti_logtime");
3000 
3001  logtime = (param->isSet() ? (int)param->getValue() : 0);
3002 
3003  if(param->isMatrix()) {
3004 
3005  TMatrix temp;
3006  param->getMatrix(&temp);
3007  _writer->set_multi(true, true, 1, &temp, get_parameter("quanti_dir")->getArg(), this);
3008 
3009  } else // rpl_per, gen_per, rpl_occ, gen_occ, rank (0), path, self-ref
3010  _writer->set(true, true, 1, logtime, 0, get_parameter("quanti_dir")->getArg(),this);
3011 
3012  loader->attach(_writer);
3013 
3014  }
3015 
3016  //freq extractor
3017  if(_freqExtractor) delete _freqExtractor;
3018  _freqExtractor = NULL;
3019 
3020  if(get_parameter("quanti_freq_output")->isSet()) {
3021 
3022  if(get_allele_model() > 2) {
3023 
3024  error("option \"quanti_freq_output\" only works with di-allelic quantitative loci. This option will be ignored.\n");
3025 
3026  }else {
3027 
3028  _freqExtractor = new TTQFreqExtractor(this);
3029 
3031 
3032  Param* param = get_parameter("quanti_freq_logtime");
3033 
3034  if(!param->isSet())
3035  fatal("quant trait::parameter \"quanti_freq_logtime\" is missing!\n");
3036 
3037  if(param->isMatrix())
3038  fatal("parameter \"quanti_freq_logtime\" only accepts a single log-time value and not an array of values.\n\
3039  A single '.qfreq' output file contains the allele frequencies computed every log-time generation.\n");
3040 
3041  logtime = (int)param->getValue();
3042 
3043  //save multiple generations in a single file:
3044  _freqExtractor->set(true, true, 1, logtime, 0, get_parameter("quanti_dir")->getArg(),this);
3045 
3046  loader->attach(_freqExtractor);
3047  }
3048 
3049  }
3050 
3051  // Ohta's (1982) D statistics
3052  if(_ohtaStats) delete _ohtaStats;
3053  _ohtaStats = NULL;
3054 
3055  if(get_parameter("quanti_ohta_output")->isSet()) {
3056 
3057  if ((_allele_model > 2) || (_num_traits > 1) || (SIMenv::MainSim->get_pop()->getPatchNbr() < 2)) {
3058  fatal("output option \"quanti_ohta_output\" is only valid for diallelic QTL affecting one trait in multiple patches!\n");
3059  }
3060 
3061  _ohtaStats = new TTQOhtaStats(this);
3062 
3063  Param* param = get_parameter("quanti_ohta_logtime");
3064 
3065  if(!param->isSet())
3066  fatal("quant trait::parameter \"quanti_ohta_logtime\" is missing!\n");
3067 
3068  if(param->isMatrix()) {
3069 
3070  TMatrix temp;
3071  param->getMatrix(&temp);
3072  _ohtaStats->set_multi(true, true, 1, &temp, get_parameter("quanti_dir")->getArg(), this);
3073 
3074  } else // rpl_per, gen_per, rpl_occ, gen_occ, rank (0), path, self-ref
3075  _ohtaStats->set(true, true, 1, (param->isSet() ? (int)param->getValue() : 0),
3076  0, get_parameter("quanti_dir")->getArg(),this);
3077 
3078  loader->attach(_ohtaStats);
3079  }
3080 
3081  //load the reader:
3082  if(_reader) delete _reader;
3083  _reader = new TTQuantiFH(this);
3084  _reader->set_isInputHandler(true);
3085  loader->attach_reader(_reader);
3086 }
void set_isInputHandler(bool val)
Definition: filehandler.h:154
virtual void attach_reader(FileHandler *FH)
Attaches the FileHandler to the current list (_readers) of the FileServices.
Definition: fileservices.cc:73
virtual void attach(Handler *FH)
Attaches the FileHandler to the current list (_writers) of the FileServices.
Definition: fileservices.cc:60
This structure stores one parameter, its definition and its string argument.
Definition: param.h:53
double getValue()
Returns the argument value according to its type.
Definition: param.cc:367
bool isMatrix()
Checks if the argument is of matrix type.
Definition: param.h:171
string getArg()
Definition: param.h:137
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:377
bool isSet()
Definition: param.h:139
static SimRunner * MainSim
Definition: simenv.h:41
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:138
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
unsigned int get_allele_model()
Definition: ttquanti.h:433
TTQFreqExtractor.
Definition: ttquanti.h:835
void resetTable()
Definition: ttquanti.cc:6319
TTQOhtaStats.
Definition: ttquanti.h:854
TTQuantiFH.
Definition: ttquanti.h:809
void setOutputOption(string opt)
Definition: ttquanti.cc:5676
virtual void set_multi(bool rpl_per, bool gen_per, int rpl_occ, TMatrix *Occ, string path, TP *trait_proto)
Definition: filehandler.h:247
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:240

References _allele_model, _freqExtractor, _num_traits, _ohtaStats, _reader, _writer, FileServices::attach(), FileServices::attach_reader(), error(), fatal(), get_allele_model(), SimComponent::get_parameter(), Param::getArg(), Param::getMatrix(), Param::getValue(), Param::isMatrix(), Param::isSet(), SIMenv::MainSim, TTQFreqExtractor::resetTable(), TraitFileHandler< TP >::set(), FileHandler::set_isInputHandler(), TraitFileHandler< TP >::set_multi(), and TTQuantiFH::setOutputOption().

◆ loadStatServices()

void TProtoQuanti::loadStatServices ( StatServices loader)
virtual

Implements SimComponent.

3091 {
3092  //allocate the stat handler
3093  if(_stats)
3094  delete _stats; // this will reset internal state for the new simulation, safest solution
3095 
3096  _stats = new TTQuantiSH(this);
3097 
3098  loader->attach(_stats);
3099 }
virtual void attach(Handler *H)
attach the StatHandler to the current list (_statHandlers) of the StatServices
Definition: statservices.cc:176
TTQuantiSH.
Definition: ttquanti.h:733

References _stats, and StatServices::attach().

◆ mutate()

void TProtoQuanti::mutate ( TTQuanti ind)
inline
2656 {
2657  (this->*_mutation_func_ptr)(ind);
2658 }

References _mutation_func_ptr.

Referenced by TTQuanti::mutate().

+ Here is the caller graph for this function:

◆ mutate_diallelic_no_pleio()

void TProtoQuanti::mutate_diallelic_no_pleio ( TTQuanti ind)
inline
2878 {
2879  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2880  unsigned int mut_locus, mut_all;
2881 
2882  while(NbMut != 0) {
2883 
2884  mut_locus = RAND::Uniform(_num_locus);
2885  mut_all = RAND::RandBool();
2886 
2887  // here just flips the bit at the mutating allele, value argument is ignored
2888  ind->mutate_inplace( mut_locus, mut_all, 1);
2889 
2890  NbMut--;
2891  }
2892 
2893 }
unsigned int get_num_mutations()
Definition: ttquanti.h:542
virtual void mutate_inplace(unsigned int position, unsigned int allele, double value)=0

References _num_locus, get_num_mutations(), TTQuanti::mutate_inplace(), RAND::RandBool(), and RAND::Uniform().

Referenced by setMutationModel_no_pleio().

+ Here is the caller graph for this function:

◆ mutate_diallelic_pleio()

void TProtoQuanti::mutate_diallelic_pleio ( TTQuanti ind)
inline
2812 {
2813  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2814  unsigned int mut_locus, mut_all, pos;
2815  bool allele;
2816 
2817  while(NbMut != 0) {
2818 
2819  mut_locus = RAND::Uniform(_num_locus);
2820  mut_all = RAND::RandBool(); // which of the two copies is mutated
2821 
2822  pos = mut_locus*_num_traits; //where it stands in the sequence (full pleio)
2823 
2824  allele = !(ind->get_allele_bit(pos, mut_all));
2825 
2826  // flip the bit, mutate to the alt. allele
2827  ind->mutate_inplace( pos, mut_all, allele);
2828 
2829  // There cannot be more than two traits in this case, as set during startup
2830  // set second value:
2831  pos++;
2832  // The allele affecting the second trait may receive the same mutation depending on the
2833  // mutational correlation
2835  ind->set_allele_bit(pos, mut_all, allele); // calling ind->mutate_add(pos,...) would be equivalent
2836  else
2837  ind->set_allele_bit(pos, mut_all, RAND::RandBool()); // may or may not flip the bit, avoids spurious correlation
2838 
2839  NbMut--;
2840  }
2841 
2842 }
virtual void set_allele_bit(unsigned int position, unsigned int allele, bool value)=0
virtual bool get_allele_bit(unsigned int position, unsigned int allele) const =0

References _mutation_correlation, _num_locus, _num_traits, TMatrix::get(), TTQuanti::get_allele_bit(), get_num_mutations(), TTQuanti::mutate_inplace(), RAND::RandBool(), TTQuanti::set_allele_bit(), and RAND::Uniform().

Referenced by setMutationModel_full_pleio().

+ Here is the caller graph for this function:

◆ mutate_diallelic_var_pleio()

void TProtoQuanti::mutate_diallelic_var_pleio ( TTQuanti ind)
inline
2847 {
2848  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2849  unsigned int mut_locus, mut_all, pos;
2850 
2851  while(NbMut != 0) {
2852 
2853  mut_locus = RAND::Uniform(_num_locus);
2854  mut_all = RAND::RandBool();
2855 
2856  pos = _locus_table[mut_locus][0];
2857 
2858  ind->mutate_inplace(pos, mut_all, 1); // value argument is ignored, flips the bit
2859 
2860  if(_locus_table[mut_locus][1] == 2) { // only degree of pleiotropy allowed
2861 
2862  pos++;
2863 
2865  ind->set_allele_bit(pos, mut_all, ind->get_allele_bit(pos-1, mut_all));
2866  else
2867  ind->set_allele_bit(pos, mut_all, RAND::RandBool()); //avoids spurious correlations
2868  }
2869 
2870  NbMut--;
2871  }
2872 
2873 }

References _locus_table, _mutation_correlation, _num_locus, TMatrix::get(), TTQuanti::get_allele_bit(), get_num_mutations(), TTQuanti::mutate_inplace(), RAND::RandBool(), TTQuanti::set_allele_bit(), and RAND::Uniform().

Referenced by setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ mutate_full_pleio()

void TProtoQuanti::mutate_full_pleio ( TTQuanti ind)
inline
2691 {
2692  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2693  unsigned int mut_locus, mut_all, pos;
2694  double *effects;
2695 
2696  while(NbMut != 0) {
2697  mut_locus = RAND::Uniform(_num_locus);
2698  mut_all = RAND::RandBool();
2699 
2700  effects = (this->*_getMutationValues)(mut_locus);
2701 
2702  pos = mut_locus*_num_traits;
2703 
2704  //cycle through all alleles at the mutated locus, depending on the PD of the locus
2705  for(unsigned int i = 0; i < _num_traits; ++i, ++pos) {
2706  ind->mutate_add( pos, mut_all, effects[i]);
2707  }
2708 
2709  NbMut--;
2710  }
2711 
2712 }
virtual void mutate_add(unsigned int position, unsigned int allele, double value)=0

References _getMutationValues, _num_locus, _num_traits, get_num_mutations(), TTQuanti::mutate_add(), RAND::RandBool(), and RAND::Uniform().

Referenced by setMutationModel_full_pleio().

+ Here is the caller graph for this function:

◆ mutate_inplace_full_pleio()

void TProtoQuanti::mutate_inplace_full_pleio ( TTQuanti ind)
inline
2763 {
2764  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2765  unsigned int mut_locus, mut_all, pos;
2766  double *effects;
2767 
2768  while(NbMut != 0) {
2769  mut_locus = RAND::Uniform(_num_locus);
2770  mut_all = RAND::RandBool();
2771 
2772  effects = (this->*_getMutationValues)(mut_locus);
2773 
2774  pos = mut_locus*_num_traits; //start location of the locus in the sequence
2775 
2776  //cycle through all alleles at the mutated locus, depending on the PD of the locus
2777  for(unsigned int i = 0; i < _num_traits; ++i, ++pos) {
2778  ind->mutate_inplace( pos, mut_all, effects[i]);
2779  }
2780 
2781  NbMut--;
2782  }
2783 }

References _getMutationValues, _num_locus, _num_traits, get_num_mutations(), TTQuanti::mutate_inplace(), RAND::RandBool(), and RAND::Uniform().

Referenced by setMutationModel_full_pleio().

+ Here is the caller graph for this function:

◆ mutate_inplace_no_pleio()

void TProtoQuanti::mutate_inplace_no_pleio ( TTQuanti ind)
inline
2743 {
2744  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2745  unsigned int mut_locus, mut_all;
2746  double *effects;
2747 
2748  while(NbMut != 0) {
2749  mut_locus = RAND::Uniform(_num_locus);
2750  mut_all = RAND::RandBool();
2751 
2752  effects = (this->*_getMutationValues)(mut_locus);
2753 
2754  ind->mutate_inplace( mut_locus, mut_all, effects[0]);
2755 
2756  NbMut--;
2757  }
2758 }

References _getMutationValues, _num_locus, get_num_mutations(), TTQuanti::mutate_inplace(), RAND::RandBool(), and RAND::Uniform().

Referenced by setMutationModel_no_pleio().

+ Here is the caller graph for this function:

◆ mutate_inplace_var_pleio()

void TProtoQuanti::mutate_inplace_var_pleio ( TTQuanti ind)
inline
2788 {
2789  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2790  unsigned int mut_locus, mut_all, pos;
2791  double *effects;
2792 
2793  while(NbMut != 0) {
2794  mut_locus = RAND::Uniform(_num_locus);
2795  mut_all = RAND::RandBool();
2796 
2797  effects = (this->*_getMutationValuesVarPleio[mut_locus])(mut_locus);
2798 
2799  pos = _locus_table[mut_locus][0];
2800 
2801  for(unsigned int i = 0; i < _locus_table[mut_locus][1]; ++i, ++pos){
2802  ind->mutate_inplace( pos, mut_all, effects[i]);
2803  }
2804 
2805  NbMut--;
2806  }
2807 }

References _getMutationValuesVarPleio, _locus_table, _num_locus, get_num_mutations(), TTQuanti::mutate_inplace(), RAND::RandBool(), and RAND::Uniform().

Referenced by setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ mutate_nill()

void TProtoQuanti::mutate_nill ( TTQuanti ind)
inline
2663 {
2664  //nill
2665 }

Referenced by setMutationModel_full_pleio(), setMutationModel_no_pleio(), and setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ mutate_no_pleio()

void TProtoQuanti::mutate_no_pleio ( TTQuanti ind)
inline
2670 {
2671  unsigned int NbMut = get_num_mutations(); //(unsigned int)RAND::Poisson(_genomic_mutation_rate);
2672  unsigned int mut_locus, mut_all;
2673  double *effects;
2674 
2675  while(NbMut != 0) {
2676  mut_locus = RAND::Uniform(_num_locus);
2677  mut_all = RAND::RandBool();
2678 
2679  effects = (this->*_getMutationValues)(mut_locus);
2680 
2681  ind->mutate_add( mut_locus, mut_all, effects[0]);
2682 
2683  NbMut--;
2684  }
2685 
2686 }

References _getMutationValues, _num_locus, get_num_mutations(), TTQuanti::mutate_add(), RAND::RandBool(), and RAND::Uniform().

Referenced by setMutationModel_no_pleio().

+ Here is the caller graph for this function:

◆ mutate_var_pleio()

void TProtoQuanti::mutate_var_pleio ( TTQuanti ind)
inline
2717 {
2718  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2719  unsigned int mut_locus, mut_all, pos;
2720  double *effects;
2721 
2722  while(NbMut != 0) {
2723 
2724  mut_locus = RAND::Uniform(_num_locus);
2725  mut_all = RAND::RandBool();
2726 
2727  effects = (this->* _getMutationValuesVarPleio[mut_locus])(mut_locus);
2728 
2729  pos = _locus_table[mut_locus][0];
2730 
2731  //cycle through all alleles at the mutated locus, depending on the PD of the locus
2732  for(unsigned int i = 0; i < _locus_table[mut_locus][1]; ++i, ++pos) {
2733  ind->mutate_add( pos, mut_all, effects[i]);
2734  }
2735 
2736  NbMut--;
2737  }
2738 }

References _getMutationValuesVarPleio, _locus_table, _num_locus, get_num_mutations(), TTQuanti::mutate_add(), RAND::RandBool(), and RAND::Uniform().

Referenced by setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ readMatrixFromQuantiMutationMatrix()

bool TProtoQuanti::readMatrixFromQuantiMutationMatrix ( vector< vector< double >> &  varmat)
2058 {
2059 // message("quant::found \"quanti_mutation_matrix\" in input, analyzing the matrix for pleiotropic loci\n");
2060 
2061  get_parameter("quanti_mutation_matrix")->getVariableMatrix(&varmat);
2062 
2063  // check dimensionality of the matrix: ------------------------------------------------
2064  size_t numRows = varmat.size();
2065  size_t numEl;
2066  size_t maxNumEl = varmat[0].size(); //number of elements in the first row, as a start
2067  bool rowsAreDifferent = false;
2068 
2069  int numCovariance = (_num_traits - 1)*_num_traits/2; // number of off-diagonal elements
2070 
2071  for(size_t i = 0; i < numRows; ++i) {
2072 
2073  numEl = varmat[i].size();
2074 
2075  if(_pleio_type == 1) { //full pleio
2076  if( numEl != _num_traits && numEl != numCovariance + _num_traits) {
2077  return error("number of values in \"quanti_mutation_matrix\" at row %i \
2078 does not match with the pleiotropic degree of %i. Rows must contain either %i or %i variance-covariance values.\n",
2079 i+1, _num_traits, _num_traits, _num_traits + numCovariance);
2080  }
2081  }
2082 
2083  if(maxNumEl != numEl) rowsAreDifferent = true;
2084 
2085  maxNumEl = max(numEl, maxNumEl);
2086 
2087  }
2088 
2089  // assess if locus-specific matrices have been provided:
2090  if(numRows == _num_traits && maxNumEl == _num_traits && !rowsAreDifferent) {
2091 
2092 // if(_pleio_type == 1)
2093 // message("quant::\"quanti_mutation_matrix\" is a single square, num. traits x num. traits matrix. It will be used for all loci equally.\n");
2094 
2095  if(_pleio_type == 2)
2096  warning("\"quanti_mutation_matrix\" is a single square, num. traits x num. traits matrix but loci have variable pleiotropy. \
2097 The matrix will be interpreted as a set of locus-specific mutation matrices.");
2098 
2100 
2101  } else {
2102 
2103 // message("quant::\"quanti_mutation_matrix\" is not a square, num. traits x num. traits matrix. Rows will be treated as locus-specific mutation matrices.");
2104 
2105  if( numRows > _num_locus )
2106  return error("\"quanti_mutation_matrix\" has too many rows, it must be a matrix with max num. rows = \"quanti_loci\" or \"quanti_traits\" \n");
2107 
2109  }
2110 
2111  return true;
2112 }
void getVariableMatrix(vector< vector< double > > *mat)
Definition: param.cc:461
void warning(const char *str,...)
Definition: output.cc:57

References _mutationVarianceIsLocusSpecific, _num_locus, _num_traits, _pleio_type, error(), SimComponent::get_parameter(), Param::getVariableMatrix(), and warning().

Referenced by setContinuousMutationModel_full_pleio(), and setContinuousMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ reset()

virtual void TProtoQuanti::reset ( )
inlinevirtual

Reimplemented from TTProtoWithMap.

virtual void reset()
Definition: ttrait_with_map.cc:637

References TTProtoWithMap::reset().

◆ resetParameterFromSource()

virtual bool TProtoQuanti::resetParameterFromSource ( std::string  param,
SimComponent cmpt 
)
inlinevirtual

Implements SimComponent.

596 {return false;}

◆ retrieve_data()

virtual bool TProtoQuanti::retrieve_data ( BinaryStorageBuffer reader)
inlinevirtual

Implements StorableComponent.

589  {reader->read(&_seq_length,sizeof(int));return true;}
void read(void *out, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:220

References _seq_length, and BinaryStorageBuffer::read().

◆ set_eVarianceSD()

void TProtoQuanti::set_eVarianceSD ( unsigned int  trait,
double  SD 
)
2380 {
2381  if(_eVariance.size() < trait + 1) //trait is expected to be the element's index
2382  _eVariance.push_back(SD);
2383  else
2384  _eVariance[trait] = SD;
2385 }

References _eVariance.

Referenced by LCE_QuantiModifier::setVefromVa(), and LCE_Breed_Quanti::setVefromVa().

+ Here is the caller graph for this function:

◆ set_genotype_value_additive()

double TProtoQuanti::set_genotype_value_additive ( const TTQuanti ind,
const unsigned int  trait 
)
2525 {
2526  return ind->get_additive_genotype(trait);
2527 }
virtual double get_additive_genotype(const unsigned int trait) const =0

References TTQuanti::get_additive_genotype().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ set_genotype_value_dominance()

double TProtoQuanti::set_genotype_value_dominance ( const TTQuanti ind,
const unsigned int  trait 
)
2532 {
2533  return ind->get_dominant_genotype(trait);
2534 }
virtual double get_dominant_genotype(const unsigned int trait) const =0

References TTQuanti::get_dominant_genotype().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ set_gsl_mutation_matrix()

gsl_matrix * TProtoQuanti::set_gsl_mutation_matrix ( unsigned int  pleio_deg,
const vector< double > &  varcov 
)
2186 {
2187  // varcov must be a one-line matrix
2188  unsigned int numCovariance = (pleio_deg - 1)*pleio_deg/2; // number of off-diagonal elements
2189  unsigned int cov_pos = pleio_deg; //first covariance term in the array
2190  size_t numEl = varcov.size(); //dimension check has been done already
2191 
2192  gsl_matrix* mat = gsl_matrix_alloc(pleio_deg, pleio_deg);
2193 
2194  for(unsigned int i = 0; i < pleio_deg; ++i){
2195 
2196  //set the diagonal = variances, we know they are the first pleio_deg elements in the matrix
2197  gsl_matrix_set(mat,i,i,varcov[i]);
2198 
2199  if (numEl == numCovariance + pleio_deg ) { // covariance values also provided, set the off-diagonal
2200 
2201  //setting covariance given in input as: e.g. {{v1,v2,v3,cov12,cov13,cov23}} with pleio_deg = 3
2202  for(unsigned long int j = i+1; j < pleio_deg && cov_pos < numEl; ++j){
2203  gsl_matrix_set(mat,i,j,varcov[cov_pos]);
2204  gsl_matrix_set(mat,j,i,varcov[cov_pos++]); // the matrix is symmetrical
2205  }
2206 
2207  } else {
2208  // no covariance provided in input, set off-diagonal to zero
2209  for(unsigned long int j = i+1; j < pleio_deg ; ++j){
2210  gsl_matrix_set(mat,i,j,0);
2211  gsl_matrix_set(mat,j,i,0); // the matrix is symmetrical
2212  }
2213 
2214  }
2215  }
2216 
2217  return mat;
2218 }

Referenced by set_gsl_mutation_matrix_from_sigma(), setContinuousMutationModel_full_pleio(), and setContinuousMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ set_gsl_mutation_matrix_from_sigma()

gsl_matrix * TProtoQuanti::set_gsl_mutation_matrix_from_sigma ( unsigned int  loc,
unsigned int  pleio_deg 
)
2223 {
2224  // variance are identical across traits (in a row of _mutation_sigma) at this stage (mutation_matrix not set in input)
2225 
2226  unsigned int numCov = (pleio_deg-1)*pleio_deg / 2;
2227 
2228  vector<double> varcov(pleio_deg + numCov);
2229 
2230  // fill in the varcov array as a one-line matrix {{var1, var2, ..., covar12, covar13, ...}}
2231 
2232  // must be carefull as the mutation_sigma matrix may have only one row if variances are not locus specific
2233  // check for locus specificity:
2234  unsigned int pos = (_mutationVarianceIsLocusSpecific ? loc : 0);
2235 
2236  unsigned int cov_pos = pleio_deg; //starting place where covariance are recorded, after the variances
2237 
2238  for(unsigned int i = 0; i < pleio_deg; ++i) {
2239  varcov[i] = _mutation_sigma.get(pos, i)*_mutation_sigma.get(pos, i);
2240 
2241  for(unsigned int j = i; j < pleio_deg - 1 && cov_pos < (pleio_deg + numCov); ++j)
2242  varcov[cov_pos++] = _mutation_correlation.get(0, loc) * _mutation_sigma.get(pos, i)*_mutation_sigma.get(pos, j+1);
2243  }
2244 
2245 #ifdef _DEBUG_
2246  message("quanti:: Locus %i\n--setting mutation matrix from mutation variance and correlation\n", loc+1);
2247  message("-- one-line reduced matrix:\n");
2248  for(unsigned int i = 0; i < varcov.size(); ++i)
2249  message("%.3f ",varcov[i]);
2250  message("\n");
2251 #endif
2252 
2253  return set_gsl_mutation_matrix(pleio_deg, varcov);
2254 }
gsl_matrix * set_gsl_mutation_matrix(unsigned int pleio_deg, const vector< double > &varcov)
Definition: ttquanti.cc:2185
void message(const char *message,...)
Definition: output.cc:39

References _mutation_correlation, _mutation_sigma, _mutationVarianceIsLocusSpecific, TMatrix::get(), message(), and set_gsl_mutation_matrix().

Referenced by setContinuousMutationModel_full_pleio(), and setContinuousMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ set_init_values()

void TProtoQuanti::set_init_values ( const double *  values,
unsigned int  nval 
)
2501 {
2502  assert(nval == _num_traits);
2503 
2504  _init_value.reset(1, _num_traits, values);
2505 
2506 }
void reset(unsigned int rows, unsigned int cols)
Re-allocate the existing matrix with assigned rows and cols dimensions and all elements to 0.
Definition: tmatrix.h:160

References _init_value, _num_traits, and TMatrix::reset().

Referenced by LCE_QuantiInit::execute().

+ Here is the caller graph for this function:

◆ set_mutation_matrix_decomposition()

void TProtoQuanti::set_mutation_matrix_decomposition ( unsigned int  loc,
unsigned int  pleio_deg 
)
2259 {
2260  _evect[loc] = gsl_matrix_alloc(pleio_deg, pleio_deg);
2261  _eval[loc] = gsl_vector_alloc(pleio_deg);
2262  _effects_multivar[loc] = gsl_vector_alloc(pleio_deg);
2263  _ws[loc] = gsl_vector_alloc(pleio_deg);
2264 
2265  gsl_matrix *E = gsl_matrix_alloc(pleio_deg, pleio_deg);
2266  gsl_matrix_memcpy(E,_gsl_mutation_matrix[loc]);
2267  gsl_eigen_symmv_workspace * w = gsl_eigen_symmv_alloc (pleio_deg);
2268  gsl_eigen_symmv (E, _eval[loc], _evect[loc], w);
2269  gsl_eigen_symmv_free (w);
2270  gsl_matrix_free(E);
2271 
2272  #ifdef _DEBUG_
2273  message("-- Mutation matrix eigenvalues:\n");
2274  for(unsigned int i = 0; i < pleio_deg; i++)
2275  cout<<gsl_vector_get(_eval[loc],i)<<" ";
2276  cout<<endl;
2277  #endif
2278 
2279  double eval;
2280  //take square root of eigenvalues, will be used in Gaussian as stdev
2281  for(unsigned int i = 0; i < pleio_deg; i++) {
2282 
2283  // check for positive matrix
2284  if(gsl_vector_get(_eval[loc],i) < 0)
2285  fatal("quanti::the mutation matrix is not a positive matrix (at least one eigenvalue is negative)\n\
2286  Please correct the values inside the matrix provided in input.\n");
2287 
2288  eval = gsl_vector_get(_eval[loc],i);
2289  eval = (eval < 0.000001 ? 0 : eval);
2290  gsl_vector_set( _eval[loc], i, sqrt(eval) );
2291  }
2292 
2293  #ifdef _DEBUG_
2294  // DEBUG OUTPUT ------------------------------------------------------
2295  cout << "_gsl_mutation_matrix eigen values (sqrt-ed): ";
2296  for(unsigned int i = 0; i < pleio_deg; i++)
2297  cout<<gsl_vector_get(_eval[loc],i)<<" ";
2298  cout << "\n_gsl_mutation_matrix eigen vectors: \n";
2299  for(unsigned int i = 0; i < pleio_deg; i++){
2300  for(unsigned int j = 0; j < pleio_deg; j++){
2301  cout<<gsl_matrix_get(_evect[loc],i,j)<<" | ";
2302  }
2303  cout<<endl;
2304  }
2305  #endif
2306 
2307 }// ----------------------------------------------------------------------------------------

References _effects_multivar, _eval, _evect, _gsl_mutation_matrix, _ws, fatal(), and message().

Referenced by setContinuousMutationModel_full_pleio(), and setContinuousMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ set_trait_value_func_ptr()

void TProtoQuanti::set_trait_value_func_ptr ( bool  withVe)
679 {
680  if(withVe)
682  else
684 }
double set_trait_value_VE(const TTQuanti *ind, const unsigned int trait)
Definition: ttquanti.cc:2510
double set_trait_value_noVE(const TTQuanti *ind, const unsigned int trait)
Definition: ttquanti.cc:2517

References _set_trait_value_func_ptr, set_trait_value_noVE(), and set_trait_value_VE().

Referenced by LCE_QuantiModifier::execute(), and LCE_Breed_Quanti::setVefromVa().

+ Here is the caller graph for this function:

◆ set_trait_value_noVE()

double TProtoQuanti::set_trait_value_noVE ( const TTQuanti ind,
const unsigned int  trait 
)
inline
2518 {
2519  return (this->*_set_genotype_func_ptr)(ind, trait);
2520 }

References _set_genotype_func_ptr.

Referenced by set_trait_value_func_ptr(), set_trait_value_VE(), and setParameters().

+ Here is the caller graph for this function:

◆ set_trait_value_VE()

double TProtoQuanti::set_trait_value_VE ( const TTQuanti ind,
const unsigned int  trait 
)
inline
2511 {
2512  return set_trait_value_noVE(ind, trait) + RAND::Gaussian( _eVariance[trait] );
2513 }

References _eVariance, RAND::Gaussian(), and set_trait_value_noVE().

Referenced by set_trait_value_func_ptr(), and setParameters().

+ Here is the caller graph for this function:

◆ setAlleleModel()

unsigned int TProtoQuanti::setAlleleModel ( )
805 {
806  string model("continuous");
807 
808  unsigned int ret_val;
809 
810  //checking allelic model
811  if (get_parameter("quanti_allele_model")->isSet()) {
812 
813  model = get_parameter("quanti_allele_model")->getArg();
814 
815  //---------------------------------------------------------------------------------------
816  // DIALLELIC MODELS
817 
818  if (model == "diallelic" || model == "diallelic_HC") { //for backward-compatibility with v <2.4.0
819 
820  // symmetrical allelic values are centered on zero with -a/+a values
821 
822  if(get_parameter("quanti_init_value")->isSet()){
823  error("\"quanti_allele_model diallelic\" needs to be initialized with \"quanti_init_freq\" provided by LCE \"quanti_init\" instead of \"quanti_init_value\". \n");
824  }
825 
826  ret_val = 1;
827 
828  } else if (model == "diallelic_asymmetrical") {
829 
830  // asymmetrical model allows for two arbitrary allelic values a/b at a locus
831 
832  if(get_parameter("quanti_init_value")->isSet()){
833  error("\"quanti_allele_model diallelic_HC\" needs to be initialized with \"quanti_init_freq\" provided by LCE \"quanti_init\" instead of \"quanti_init_value\". \n");
834  }
835 
836  ret_val = 2;
837 
838  //---------------------------------------------------------------------------------------
839  // CONTIUUM OF ALLELE MODELS
840 
841  } else if (model == "continuous") {
842 
843  ret_val = 3;
844 
845  } else if (model == "continuous_in_place" || model == "continuous_HC") { //for backward-compatibility with v <2.4.0
846 
847  ret_val = 4;
848 
849 
850  } else {
851  return error("\"quanti_allele_model\" has options \"diallelic\", \"diallelic_asymmetrical\", \"continuous\" or \"continuous_in_place\". \n");
852  }
853 
854  }
855  else { //default model: 'continuous"
856  ret_val = 3;
857  }
858 
859 
860 #ifdef _DEBUG_
861  message("quant::allele model is \"%s\"\n",model.c_str());
862 #endif
863  return ret_val;
864 }

References error(), SimComponent::get_parameter(), Param::getArg(), and message().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ setContinuousMutationModel_full_pleio()

bool TProtoQuanti::setContinuousMutationModel_full_pleio ( )
1502 {
1503  //setting the mutation variance-covariance matrix
1504 
1505  // the pointer has been freed previously by a call to TProtoQuanti::deallocate_gsl_mutation_matrix_space in TProtoQuanti::setMutationParameters
1506  // we double-check with assert
1507  assert(_gsl_mutation_matrix == NULL);
1508  assert(_eval == NULL);
1509  assert(_evect == NULL);
1510  assert(_effects_multivar == NULL);
1511  assert(_ws == NULL);
1512 
1513  if(get_parameter("quanti_mutation_variance")->isSet()) {
1514 
1515  if(get_parameter("quanti_mutation_matrix")->isSet()) {
1516 
1517  warning("both \"quanti_mutation_variance\" and \"quanti_mutation_matrix\" are set, using the matrix only!\n");
1518 
1519  } else {
1520  // the variance are passed as single values because they apply to all traits equally
1521  // the sqrt-variance(s) are stored in _mutation_sigma, can be locus-specific
1522 
1523  if(!setMutationSigmaFromQuantiMutationVariance()) return false;
1524 
1525  //check if variance are locus-specific
1527 
1528  // pleiotropic loci for more than 2 traits, we need the full mutation matrix:
1529  if(_num_traits > 2) {
1530 
1531  //setting the mutation matrix
1532 
1534 
1535  // allocate memory for one m-matrix per locus
1537 
1538  for(unsigned int l = 0; l < _num_locus; ++l) {
1540 
1542  }
1543 
1544  } else { // !_mutationVarianceIsLocusSpecific
1545 
1546  // allocate memory for a single mutation matrix used for all loci
1548 
1550 
1552  }
1553  }
1554  }
1555  } //_end_ if quanti_mutation_variance is set
1556 
1557  if(get_parameter("quanti_mutation_matrix")->isSet()) {
1558 
1559  // full mutation matrix given in input, we need to check what kind of matrix is passed (if locus-specific or not)
1560  vector< vector<double> > _mut_matrix;
1561 
1562  // check the structure of the matrix passed in input, and set the locus-specific flag
1563  if(!readMatrixFromQuantiMutationMatrix(_mut_matrix)) return false;
1564 
1565  // fill and create mutation matrices --------------------------------------------------
1566  int loc_pos;
1567  size_t numRows = _mut_matrix.size();
1568 
1570  // set a new mutation matrix for each locus separately
1571  //each row of the input matrix will be used as a locus-specific m-matrix
1573 
1574  _mutation_sigma.reset(_num_locus, _num_traits); // this is used when PD = 2 or 1
1575 
1576  // checking that _mutation_correlation has been set:
1578 
1579  for(unsigned int loc = 0; loc < _num_locus; loc++){
1580 
1581  loc_pos = loc % numRows; //user may pass only a few rows that will be repeated across loci
1582 
1583  for(unsigned int i = 0; i < _num_traits; i++) // first _num_traits elements are the per-trait mut variance
1584  _mutation_sigma.set(loc, i, sqrt(_mut_matrix[loc_pos][i]));
1585 
1586  //set the locus-specific mutation matrix:
1587  _gsl_mutation_matrix[loc] = set_gsl_mutation_matrix(_num_traits, _mut_matrix[loc_pos]);
1588 
1589  if(_num_traits == 2) { // special case for bivariate Gaussian models
1590 
1591  _mutation_correlation.set(0, loc, gsl_matrix_get(_gsl_mutation_matrix[loc],0,1) / _mutation_sigma.get(loc,0) / _mutation_sigma.get(loc,1));
1592 
1593  } else {
1594 
1596  }
1597 
1598 #ifdef _DEBUG_
1599  cout << "\n-- _gsl_mutation_matrix for locus " << loc+1 << " \n";
1600  for(unsigned int i=0; i<_num_traits; ++i){
1601  for(unsigned int j=0; j<_num_traits; ++j){
1602  cout << gsl_matrix_get(_gsl_mutation_matrix[loc],i,j) << " | ";
1603  }
1604  cout << endl;
1605  }
1606 
1607  message("-- M-matrix decomposition:\n");
1608  for(unsigned int i = 0; i < _num_traits; i++)
1609  cout<<gsl_vector_get(_eval[loc],i)<<" ";
1610  cout<<endl;
1611  if(_num_traits == 2) message("-- mutation correlation: %f\n",_mutation_correlation.get(0,loc));
1612 #endif
1613  } //END for locus
1614 
1615  } else { //mutation is not locus-specific
1616  //create a single mutation matrix
1618 
1619  _mutation_sigma.reset(1, _num_traits); // this is used when PD = 2 or 1
1620 
1621  for(unsigned int i = 0; i < _num_traits; i++) // the diagonal of the input matrix elements are the per-trait mut variance
1622  _mutation_sigma.set(0, i, sqrt(_mut_matrix[i][i]));
1623 
1624  //set the mutation matrix: we have to read the input matrix as a full square matrix, not as an array-matrix
1625  _gsl_mutation_matrix[0] = gsl_matrix_alloc(_num_traits, _num_traits);
1626 
1627  //easiest is to read the input matrix into a TMatrix object (we know it isn't a variable matrix by now)
1628  TMatrix mat;
1629  get_parameter("quanti_mutation_matrix")->getMatrix(&mat);
1630 
1631  //convert it into a gsl_matrix
1632  mat.get_gsl_matrix(_gsl_mutation_matrix[0]);
1633 
1634  if(_num_traits == 2) { // special case for bivariate Gaussian models
1635 
1636  // reset the _mutation_correlation matrix for non-locus specific case:
1638 
1639  _mutation_correlation.set(0, 0, gsl_matrix_get(_gsl_mutation_matrix[0],0,1) / _mutation_sigma.get(0,0) / _mutation_sigma.get(0,1));
1640 
1641  } else { // more traits
1642 
1644  }
1645 
1646 
1647 #ifdef _DEBUG_
1648  message("-- Mutation matrix:\n");
1649  mat.show_up();
1650  message("-- M-matrix decomposition:\n");
1651  for(unsigned int i = 0; i < _num_traits; i++)
1652  cout<<gsl_vector_get(_eval[0],i)<<" ";
1653  cout<<endl;
1654  if(_num_traits == 2) message("-- mutation correlation: %f\n",_mutation_correlation.get(0,1));
1655 #endif
1656 
1657  }
1658  } // END if(get_parameter("quanti_mutation_matrix")->isSet())
1659  else if(!get_parameter("quanti_mutation_variance")->isSet()) {
1660  return error("\"quanti_mutation_matrix\" or \"quanti_mutation_variance\" must be specified!\n");
1661  }
1662 
1663  return true;
1664 }
void show_up()
Definition: tmatrix.h:363
unsigned int ncols() const
Definition: tmatrix.h:215
void set(unsigned int i, unsigned int j, double val)
Sets element at row i and column j to value val.
Definition: tmatrix.h:102
bool setMutationSigmaFromQuantiMutationVariance()
Definition: ttquanti.cc:1921
void set_mutation_matrix_decomposition(unsigned int loc, unsigned int pleio_deg)
Definition: ttquanti.cc:2258
gsl_matrix * set_gsl_mutation_matrix_from_sigma(unsigned int loc, unsigned int pleio_deg)
Definition: ttquanti.cc:2222
bool readMatrixFromQuantiMutationMatrix(vector< vector< double >> &varmat)
Definition: ttquanti.cc:2057
void allocate_gsl_mutation_matrix_space(unsigned int num_locus)
Definition: ttquanti.cc:2116

References _effects_multivar, _eval, _evect, _gsl_mutation_matrix, _mutation_correlation, _mutation_sigma, _mutationVarianceIsLocusSpecific, _num_locus, _num_traits, _ws, allocate_gsl_mutation_matrix_space(), error(), TMatrix::get(), SimComponent::get_parameter(), Param::getMatrix(), message(), TMatrix::ncols(), TMatrix::nrows(), readMatrixFromQuantiMutationMatrix(), TMatrix::reset(), TMatrix::set(), set_gsl_mutation_matrix(), set_gsl_mutation_matrix_from_sigma(), set_mutation_matrix_decomposition(), setMutationSigmaFromQuantiMutationVariance(), TMatrix::show_up(), and warning().

Referenced by setMutationModel_full_pleio().

+ Here is the caller graph for this function:

◆ setContinuousMutationModel_no_pleio()

bool TProtoQuanti::setContinuousMutationModel_no_pleio ( )
1826 {
1827  //setting the mutation variance matrix
1828 
1829  if(get_parameter("quanti_mutation_variance")->isSet()) {
1830 
1831  if(get_parameter("quanti_mutation_matrix")->isSet()) {
1832 
1833  warning("both \"quanti_mutation_variance\" and \"quanti_mutation_matrix\" are set, not using the matrix in the non-pleiotropic case!\n");
1834 
1835  }
1836  // the variance are passed as single values because they apply to all traits equally
1837  // the sqrt-variance(s) are stored in _mutation_sigma, can be locus-specific
1838 #ifdef _DEBUG_
1839  message("quant::setting mutation variance (param is set).\n");
1840 #endif
1841 
1843 
1844  //check if variance are locus-specific
1846 
1847  } //_end_ if quanti_mutation_variance is set
1848 
1849  else if(get_parameter("quanti_mutation_matrix")->isSet()) {
1850 
1851  return error("quant::parameter \"quanti_mutation_matrix\" is not used under non-pleiotropic model, use \"quanti_mutation_variance\" instead.\n");
1852 
1853  } // END if(get_parameter("quanti_mutation_matrix")->isSet())
1854  else if(!get_parameter("quanti_mutation_variance")->isSet()) {
1855  return error("\"quanti_mutation_variance\" must be specified for the non-pleiotropic model of quantitative loci!\n");
1856  }
1857 
1858  return true;
1859 }
bool setMutationSigmaFromQuantiMutationVariance_no_pleio()
Definition: ttquanti.cc:1991

References _mutation_sigma, _mutationVarianceIsLocusSpecific, error(), SimComponent::get_parameter(), Param::isSet(), message(), TMatrix::nrows(), setMutationSigmaFromQuantiMutationVariance_no_pleio(), and warning().

Referenced by setMutationModel_no_pleio().

+ Here is the caller graph for this function:

◆ setContinuousMutationModel_var_pleio()

bool TProtoQuanti::setContinuousMutationModel_var_pleio ( )
1669 {
1670 // cout << "TProtoQuanti::setContinuousMutationModel_var_pleio\n";
1671 
1672  // the pointer has been freed previously in TProtoQuanti_var_pleio::setMutationParameters
1673  // we double-check with assert
1674  assert(_gsl_mutation_matrix == NULL);
1675  assert(_eval == NULL);
1676  assert(_evect == NULL);
1677  assert(_effects_multivar == NULL);
1678  assert(_ws == NULL);
1679 
1680  // allocate memory
1682 
1683  unsigned int pleio_deg;
1684 
1685  //setting the mutation variance
1686  if(get_parameter("quanti_mutation_variance")->isSet()) {
1687 
1688  if(get_parameter("quanti_mutation_matrix")->isSet()) {
1689 
1690  warning("both \"quanti_mutation_variance\" and \"quanti_mutation_matrix\" are set, using the matrix only!\n");
1691 
1692  } else {
1693  // the variance are passed as single values because they apply to all traits equally
1694  // the sqrt-variance(s) are stored in _mutation_sigma, can be locus-specific
1695 
1696  if(!setMutationSigmaFromQuantiMutationVariance()) return false;
1697 
1698  //check if variance are locus-specific
1700 
1701  // we need one m-matrix per locus if locus is pleiotropic
1702  // even if all have same variance and _mutationVarianceIsLocusSpecific = false bcse PD varies among loci
1703  for(unsigned int loc = 0; loc < _num_locus; loc++){
1704 
1705  pleio_deg = _locus_table[loc][1];
1706 
1707  if(pleio_deg > 1) {
1708  //set the M-matrix for all pleiotropic loci, even though it is not used when PD == 2
1709  //setting the mutation matrix
1711 
1712  set_mutation_matrix_decomposition(loc, pleio_deg);
1713 
1714 
1715 #ifdef _DEBUG_
1716  cout << "_gsl_mutation_matrix for locus " << loc+1 << " \n";
1717  for(unsigned int i=0; i<pleio_deg; ++i){
1718  for(unsigned int j=0; j<pleio_deg; ++j){
1719  cout << gsl_matrix_get(_gsl_mutation_matrix[loc],i,j) << " | ";
1720  }
1721  cout << endl;
1722  }
1723 #endif
1724 
1725  } // END if PD > 1
1726  } // END for locus
1727  } // END if get_parameter("quanti_mutation_matrix")->isSet()
1728  } // END if(get_parameter("quanti_mutation_variance")->isSet())
1729 
1730 
1731 
1732  if(get_parameter("quanti_mutation_matrix")->isSet()) {
1733 
1734  vector< vector<double> > _mut_matrix;
1735 
1736  if(!readMatrixFromQuantiMutationMatrix(_mut_matrix)) return false;
1737 
1738  // we will store sigma in case some loci have PD = 1 or PD = 2
1740 
1741  // checking that _mutation_correlation has been set:
1743 
1744  int numVarInRow;
1745  int numRows = _mut_matrix.size();
1746  int numCovariance;
1747  int loc_pos;
1748 
1749  // set the mutation matrix for each locus separately
1750  for(unsigned int loc = 0; loc < _num_locus; loc++){
1751 
1752  pleio_deg = _locus_table[loc][1];
1753 
1754  loc_pos = loc % numRows; //user may pass only one row that will be repeated for all loci
1755 
1756  numVarInRow = _mut_matrix[loc_pos].size(); // number of diagonal elements
1757  numCovariance = (pleio_deg - 1)*pleio_deg/2; // number of off-diagonal elements
1758 
1759  // we accept 1 value (same var on all traits, no covar), pleio_deg values, or pleio_deg +numCovariance values:
1760  if( numVarInRow > 1 && numVarInRow != (int)pleio_deg && numVarInRow != (numCovariance + (int)pleio_deg) ){
1761  return error("number of values (%i) for locus %i in \"quanti_mutation_matrix\" at row %i \
1762 does not match with its pleiotropic degree of %i \n", numVarInRow, loc+1, loc_pos+1, pleio_deg);
1763  }
1764 
1765 #ifdef _DEBUG_
1766  // Print out mut_matrix for debugging purposes
1767  message("\nquant::input M-matrix for locus %i\n", loc_pos+1);
1768  for(unsigned int j=0; j<_mut_matrix[loc_pos].size(); ++j){
1769  message("%.3f | ",_mut_matrix[loc_pos][j]);
1770  }
1771  message("\n");
1772 #endif
1773 
1774  // we build the varcov vector in case only a single variance was passed:
1775  vector<double> varcov(pleio_deg);
1776 
1777  for(unsigned int i = 0; i < pleio_deg; i++) { // first pleio_deg elements are the per-trait mut variance
1778  _mutation_sigma.set(loc, i, sqrt(_mut_matrix[loc_pos][ i%numVarInRow]) ); //recycle if single value passed
1779  varcov[i] = _mut_matrix[loc_pos][ i%numVarInRow];
1780  }
1781  //set the mutation matrix: we either pass a pleio_deg copied set of a single variance or the original M-matrix
1782  _gsl_mutation_matrix[loc] = set_gsl_mutation_matrix(pleio_deg, (numVarInRow == 1 ? varcov : _mut_matrix[loc_pos] ) );
1783 
1784  set_mutation_matrix_decomposition(loc, pleio_deg);
1785 
1786  if(pleio_deg == 2) { // special case for bivariate Gaussian models
1787  _mutation_correlation.set(0, loc, gsl_matrix_get(_gsl_mutation_matrix[loc],0,1) / _mutation_sigma.get(loc,0) / _mutation_sigma.get(loc,1));
1788  }
1789 
1790 #ifdef _DEBUG_
1791  message("quant::GSL M-matrix for locus %i\n", loc+1);
1792  for(unsigned int i=0; i<pleio_deg; ++i){
1793  for(unsigned int j=0; j<pleio_deg; ++j){
1794  message("%.3f | ",gsl_matrix_get(_gsl_mutation_matrix[loc],i,j));
1795  }
1796  message("\n");
1797  }
1798 #endif
1799 
1800 
1801 #ifdef _DEBUG_
1802  message("-- Mutation matrix for locus %i with PD=%i:\n", loc+1, pleio_deg);
1803  // _mutation_matrix[loc].show_up();
1804  message("-- MMatrix decomposition:\n");
1805  for(unsigned int i = 0; i < pleio_deg; i++)
1806  message("%.3f ", gsl_vector_get(_eval[loc],i));
1807  cout<<endl;
1808  if(_num_traits == 2)
1809  message("-- mutation correlation: %f\n", _mutation_correlation.get(0,loc) ) ;
1810 #endif
1811 
1812  } //END for locus
1813 
1814  } // END if(get_parameter("quanti_mutation_matrix")->isSet())
1815  else if(!get_parameter("quanti_mutation_variance")->isSet()) {
1816  return error("\"quanti_mutation_matrix\" or \"quanti_mutation_variance\" must be specified!\n");
1817  }
1818 
1819 // cout << "TProtoQuanti::setContinuousMutationModel_var_pleio::end\n";
1820  return true;
1821 }

References _effects_multivar, _eval, _evect, _gsl_mutation_matrix, _locus_table, _mutation_correlation, _mutation_sigma, _mutationVarianceIsLocusSpecific, _num_locus, _num_traits, _ws, allocate_gsl_mutation_matrix_space(), error(), TMatrix::get(), SimComponent::get_parameter(), message(), TMatrix::ncols(), TMatrix::nrows(), readMatrixFromQuantiMutationMatrix(), TMatrix::reset(), TMatrix::set(), set_gsl_mutation_matrix(), set_gsl_mutation_matrix_from_sigma(), set_mutation_matrix_decomposition(), setMutationSigmaFromQuantiMutationVariance(), and warning().

Referenced by setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ setDiallelicMutationModel()

bool TProtoQuanti::setDiallelicMutationModel ( )
1348 {
1349  static bool warn_allele_once = false;
1350 
1351  if (!get_parameter("quanti_allele_value")->isSet()) {
1352 
1353  return error("in \"quanti\" trait, \"quanti_allele_value\" is not set for the diallelic model.\n");
1354 
1355  } else {
1356 
1357  // allele_value is a matrix nb_locus x 2 values
1358 
1359  // IMPORTANT:: This interface doesn't allow for trait-specific allelic values!!
1360 
1362 
1363  if (get_parameter("quanti_allele_value")->isMatrix()) { //locus-specific allelic values
1364 
1365  TMatrix tmp;
1366 
1367  get_parameter("quanti_allele_value")->getMatrix(&tmp);
1368 
1369  if (tmp.ncols() != _num_locus) {
1370  if(tmp.ncols() < _num_locus && !warn_allele_once) {
1371  warning("\"quanti_allele_value\" has less values than the number of loci, allelic values will be recycled among loci.\n");
1372  warn_allele_once = true;
1373  }
1374 
1375  if(tmp.ncols() > _num_locus && !warn_allele_once) {
1376  warning("\"quanti_allele_value\" has more values than the number of loci, only the first %i values will be used.\n", _num_locus);
1377  warn_allele_once = true;
1378  }
1379  }
1380 
1381  unsigned int nval = tmp.ncols();
1382 
1383  // we need to order the allele in decreasing order for later calculations of allele frequencies
1384  // such that p = freq of trait-increasing allele, q = freq of trait-decreasing allele
1385 
1386  double a1, a2;
1387 
1388  if (tmp.nrows() == 1) { // only 'a' is provided
1389 
1390 
1391  if(_allele_model == 1) { // store +a and -a allelic values, with +a at position 0
1392  for (unsigned i = 0; i < _num_locus; ++i) {
1393 
1394  a1 = tmp.get(0, i % nval); // recycle allelic values among loci, if necessary
1395 
1396  if(a1 < 0) a1 = -1.0*a1; // we need the positive value in the first position
1397 
1398  a2 = -1.0*a1;
1399 
1400  _allele_value.set(i, 0, a1);
1401  _allele_value.set(i, 1, a2);
1402  }
1403  }
1404  else if (_allele_model == 2) // "asymmetrical case, create allele values {0, a}
1405  {
1406  for (unsigned i = 0; i < _num_locus; ++i) {
1407 
1408  a1 = tmp.get(0, i % nval); // recycle allelic values among loci, if necessary
1409  _allele_value.set(i, 0, 0.0); // first allele is the ancestral allele with value 0
1410  _allele_value.set(i, 1, a1); // second allele is the derived allele with a != 0
1411  }
1412  } else
1413  return error("parameter \"quanti_allele_value\" should only be used with the \"diallelic\" allele models.\n ");
1414 
1415  } else if (tmp.nrows() == 2) { // store A and a allelic values, a != -A
1416 
1417 
1418  for (unsigned i = 0; i < _num_locus; ++i) {
1419 
1420  a1 = tmp.get(0, i % nval); // recycle allelic values among loci
1421  a2 = tmp.get(1, i % nval);
1422 
1423  //smallest first; but we keep the "ancestral" allele (value 0, if provided) at position 0 in all cases
1424  if(a1 != 0.0 && a1 > a2) {
1425  a1 = a2;
1426  a2 = tmp.get(0, i % nval);
1427  }
1428  _allele_value.set(i, 0, a1);
1429  _allele_value.set(i, 1, a2);
1430  }
1431 
1432  } else {
1433  return error("\"quanti_allele_value\" must get a matrix with a max. of 2 rows (and max. num. columns = num. loci).\n");
1434  }
1435 
1436  } else { //not a matrix, therefore no locus-specific allelic values
1437 
1438  double a1 = get_parameter_value("quanti_allele_value"), a2;
1439 
1440  if(a1 < 0) a1 = -1.0*a1;
1441  a2 = -1.0*a1;
1442 
1443  _allele_value.set_col(0, a1);
1444  _allele_value.set_col(1, a2);
1445 
1446  }
1447  }
1448 
1449  // we need a mapping of sequence position to allele value to read the allele value from the sequence
1450  if(_sequence_diallele_values[0]) {
1451  delete [] _sequence_diallele_values[0];
1452  _sequence_diallele_values[0] = NULL;
1453  }
1454 
1455  if(_sequence_diallele_values[1]) {
1456  delete [] _sequence_diallele_values[1];
1457  _sequence_diallele_values[1] = NULL;
1458  }
1459 
1460  _sequence_diallele_values[0] = new double [_seq_length];
1461  _sequence_diallele_values[1] = new double [_seq_length];
1462 
1463  unsigned int pos, locID;
1464  for(unsigned int i = 0; i < _num_traits; ++i) {
1465  for(unsigned int j = 0; j < get_num_locus(i); ++j) {
1466  pos = get_locus_seq_pos(j, i);
1467  locID = get_locus_ID(j, i);
1468  _sequence_diallele_values[0][pos] = _allele_value.get(locID, 0);
1469  _sequence_diallele_values[1][pos] = _allele_value.get(locID, 1);
1470  }
1471  }
1472 
1473  // detect equal-effects case for bulk bitstring genotype computation
1474  _equal_val_0 = _allele_value.get(0, 0);
1475  _equal_val_1 = _allele_value.get(0, 1);
1476  _equal_effects = true;
1477  for (unsigned int i = 1; i < _num_locus; ++i) {
1478  if (_allele_value.get(i, 0) != _equal_val_0 ||
1479  _allele_value.get(i, 1) != _equal_val_1) {
1480  _equal_effects = false;
1481  break;
1482  }
1483  }
1485 
1486  // build trait masks for bulk bitstring genotype computation
1487  // one bitstring per trait, with 1s at sequence positions belonging to that trait
1488  // works for all pleiotropy types (no_pleio, full_pleio, var_pleio)
1489  _trait_masks.clear();
1490  for (unsigned int t = 0; t < _num_traits; ++t) {
1491  _trait_masks.push_back(bitstring(_seq_length));
1492  for (unsigned int l = 0; l < get_num_locus(t); ++l)
1493  _trait_masks[t].set(_trait_table[t][l], true);
1494  }
1495 
1496  return true;
1497 }
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:142
void set_col(unsigned int i, double val)
Sets element at column i to value val.
Definition: tmatrix.h:132
unsigned int get_locus_ID(unsigned int locus, unsigned int trait)
Definition: ttquanti.h:454
unsigned int get_locus_seq_pos(unsigned int loc, unsigned int trait)
Definition: ttquanti.h:452
unsigned int get_num_locus()
Definition: ttquanti.h:423
Non-template and faster implementation of std::bitset.
Definition: bitstring.h:56

References _allele_model, _allele_value, _equal_effects, _equal_val_0, _equal_val_1, _equal_val_diff, _num_locus, _num_traits, _seq_length, _sequence_diallele_values, _trait_masks, _trait_table, error(), TMatrix::get(), get_locus_ID(), get_locus_seq_pos(), get_num_locus(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), TMatrix::ncols(), TMatrix::nrows(), TMatrix::reset(), TMatrix::set(), TMatrix::set_col(), and warning().

Referenced by setMutationModel_full_pleio(), setMutationModel_no_pleio(), and setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ setDominanceParameters()

bool TProtoQuanti::setDominanceParameters ( )
2311 {
2312  TMatrix tmp_mat;
2313 
2314 #ifdef _DEBUG_
2315  message("quant::setting dominance parameters\n");
2316 #endif
2317 
2318  _dominance_model = 0; // no dominance by default
2320 
2322  if(get_parameter("quanti_dominance_effects")->isSet())
2323  {
2324 
2326 
2327  if(get_parameter("quanti_dominance_effects")->isMatrix())
2328  {
2329 
2330  get_parameter("quanti_dominance_effects")->getMatrix(&tmp_mat);
2331 
2332  if(tmp_mat.nrows() > _num_traits)
2333  return error("the dominance effect matrix must hold at most as many rows as the number of quantitative trait.\n");
2334 
2335  if(tmp_mat.ncols() > _num_locus)
2336  return error("the dominance effect matrix must hold at most as many columns as the number of quantitative loci.\n");
2337 
2339 
2340  _equal_dom_coeff = true;
2341  double k = _dominance_effects.get(0,0);
2342  for(unsigned int i=0; i < _dominance_effects.nrows(); ++i) {
2343  for(unsigned int j=0; j < _dominance_effects.ncols(); ++j) {
2344  if(k != _dominance_effects.get(i,j)) {
2345  _equal_dom_coeff = false;
2346  break;
2347  }
2348  }
2349  }
2350  }
2351  else {
2352  _dominance_effects.assign( get_parameter_value("quanti_dominance_effects") );
2353  _equal_dom_coeff = true;
2354  }
2355 
2356  // set dominance flag active
2357  _dominance_model = 1; // internally, model 0 = no dominance
2358  }
2359 
2360 
2361 #ifdef _DEBUG_
2362  message("quant::dominance is set ? \"%s\"\n", (_dominance_model == 0 ? " no" : "yes"));
2363  if(_dominance_model) {
2364 
2365  message("quant::dominance coefficients (trait x locus table, 20 first loci):\n");
2366  for(unsigned int i = 0; i < _dominance_effects.nrows(); ++i)
2367  for(unsigned int j = 0; j < _dominance_effects.ncols() && j < 20; ++j)
2368  message("%.3f ", _dominance_effects.get(i,j));
2369  }
2370  message("\n");
2371 #endif
2372 
2373  return true;
2374 }
void assign(double val)
Assigns a value to all element of the matrix.
Definition: tmatrix.h:154
void copy_recycle(const TMatrix &mat)
Copy elements of 'mat', recycling elements of 'mat' if its size is smaller than current matrix.
Definition: tmatrix.h:89

References _dominance_effects, _dominance_model, _equal_dom_coeff, _num_locus, _num_traits, TMatrix::assign(), TMatrix::copy_recycle(), error(), TMatrix::get(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), message(), TMatrix::ncols(), TMatrix::nrows(), and TMatrix::reset().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ setEpistasisParameters()

bool TProtoQuanti::setEpistasisParameters ( )
689 {
690 
691  _epistasis = false;
692 
693  // set epistatic coefficients:
694 
695  if(get_parameter("quanti_epistatic_effects")->isSet()) {
696 
697  if(get_parameter("quanti_epistatic_network")->isSet()) {
698 
699  // --- sparse/network mode ---
700 
701  vector< vector<double> > net_mat, efx_mat;
702 
703  get_parameter("quanti_epistatic_network")->getVariableMatrix(&net_mat);
704  get_parameter("quanti_epistatic_effects")->getVariableMatrix(&efx_mat);
705 
706  if(net_mat.size() != efx_mat.size())
707  return error("\"quanti_epistatic_network\" and \"quanti_epistatic_effects\" must have the same number of rows (%i vs %i).\n",
708  (int)net_mat.size(), (int)efx_mat.size());
709 
710  // validate and count total interactions
711  _num_epi_coefs = 0;
712 
713  for(size_t r = 0; r < net_mat.size(); ++r) {
714 
715  unsigned int M = net_mat[r].size();
716 
717  if(M < 2)
718  return error("\"quanti_epistatic_network\" row %i must contain at least 2 loci (got %i).\n", (int)(r+1), M);
719 
720  unsigned int n_pairs = M * (M - 1) / 2;
721 
722  if(efx_mat[r].size() != n_pairs)
723  return error("\"quanti_epistatic_effects\" row %i must have %i values for %i loci (%i*(%i-1)/2), got %i.\n",
724  (int)(r+1), n_pairs, M, M, M, (int)efx_mat[r].size());
725 
726  for(unsigned int i = 0; i < M; ++i) {
727  int loc = (int)net_mat[r][i];
728  if(loc < 1 || loc > (int)_num_locus)
729  return error("\"quanti_epistatic_network\" row %i: locus index %i is out of range [1, %i].\n",
730  (int)(r+1), loc, _num_locus);
731  }
732 
733  _num_epi_coefs += n_pairs;
734  }
735 
738 
739  unsigned int idx = 0;
740 
741  for(size_t r = 0; r < net_mat.size(); ++r) {
742 
743  unsigned int M = net_mat[r].size();
744  unsigned int efx_idx = 0;
745 
746  for(unsigned int i = 0; i < M - 1; ++i) {
747  for(unsigned int j = i + 1; j < M; ++j) {
748  unsigned int loc_i = (unsigned int)net_mat[r][i] - 1; // 1-based to 0-based
749  unsigned int loc_j = (unsigned int)net_mat[r][j] - 1;
750  _epistatic_coefs_indices.set(idx, 0, min(loc_i, loc_j));
751  _epistatic_coefs_indices.set(idx, 1, max(loc_i, loc_j));
752  _epistatic_coefs_matrix.set(0, idx, efx_mat[r][efx_idx]);
753  efx_idx++;
754  idx++;
755  }
756  }
757  }
758 
759  } else {
760 
761  // --- dense mode (existing behavior) ---
762 
764 
765  unsigned int num_interact = _num_locus*(_num_locus-1)/2.0; //num of pairwise interactions
766 
767  assert(num_interact == _num_epi_coefs);
768 
770 
771  TMatrix readEpiCoefs;
772 
773  get_parameter("quanti_epistatic_effects")->getMatrix(&readEpiCoefs);
774 
775  if(readEpiCoefs.nrows() > 1)
776  return error("\"quanti_epistatic_effects\" must be an array, i.e., have one row only\n");
777 
778  if(readEpiCoefs.ncols() > _num_epi_coefs){
779 
780  return error("The number of epistatic coefficients provided with \"quanti_epistatic_effects\"\
781  must be at most equal to the total number of pairwise locus interactions (%i for %i loci).\n", _num_epi_coefs, _num_locus);
782 
783  }
784 
786 
788 
789  // Here _epistatic_coefs_indices covers only pairwise epistatic interactions
790  // and has dimensions nbCoefs x 2
792 
793  }
794 
795  _epistasis = true;
796  }
797 
798 
799  return true;
800 }
unsigned int length() const
Returns the number of elements in the matrix.
Definition: tmatrix.h:217
TMatrix nChooseKVec(int n, int k)
Definition: utils.cc:197
unsigned long nChooseK(int n, int k)
Definition: utils.cc:173

References _epistasis, _epistatic_coefs_indices, _epistatic_coefs_matrix, _num_epi_coefs, _num_locus, TMatrix::copy(), TMatrix::copy_recycle(), error(), SimComponent::get_parameter(), Param::getMatrix(), Param::getVariableMatrix(), TMatrix::length(), nChooseK(), nChooseKVec(), TMatrix::ncols(), TMatrix::nrows(), TMatrix::reset(), and TMatrix::set().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ setGeneticMapParams()

bool TProtoQuanti::setGeneticMapParams ( )
648  {
649 
650  //bypass the genetic map for free recombination to save significant time:
651  //this is done whenever the recombination rate is set to 0.5
652 
653  if( TTProtoWithMap::isRecombinationFree("quanti")) { //test all possible options to set recomb rate = 0.5
654 
656 
658 
659  //necessary for the inherit_free function:
660  if(_all_chooser) delete [] _all_chooser;
661  _all_chooser = new bool[_num_locus];
662 
663  } else {
664  // loci are not independent, ie recomb rate < 0.5
665 
666  // the loci positions will be registered in the genetic map
667  if( !setGeneticMapParameters("quanti", _num_locus) ) return false;
668 
670 
671  }
672 
673  return true;
674 }
void inherit_low(sex_t SEX, TTQuanti *ind, const TTQuanti *parent)
Definition: ttquanti.cc:2600
void inherit_free(sex_t SEX, TTQuanti *ind, const TTQuanti *parent)
Definition: ttquanti.cc:2638
double _recombRate
Definition: ttrait_with_map.h:194
bool setGeneticMapParameters(string prefix, unsigned int numLoci=0)
Definition: ttrait_with_map.cc:125
bool isRecombinationFree(string prefix)
Definition: ttrait_with_map.cc:98

References _all_chooser, _inherit_fun_ptr, _num_locus, TTProtoWithMap::_recombRate, inherit_free(), inherit_low(), TTProtoWithMap::isRecombinationFree(), and TTProtoWithMap::setGeneticMapParameters().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ setHeritabilityParams()

bool TProtoQuanti::setHeritabilityParams ( )
437  {
438 
439  // temporary TMatrix for parameters read-in
440  TMatrix tmp_mat;
441 
442 #ifdef _DEBUG_
443  message("quant::setting heritability parameters\n");
444 #endif
445  //---------------------------------------------------------------------------------------------
446  // ENVIRONMENTAL VARIANCE and HERITABILITY
447 
448  _eVariance.clear(); //it is empty by default, signaling that we do not add Ve to trait genotype
449 
450  if(get_parameter("quanti_environmental_variance")->isSet()){
451 
452  if(get_parameter("quanti_environmental_variance")->isMatrix())
453  {
454  // environmental effects can be trait-specific
455  get_parameter("quanti_environmental_variance")->getMatrix(&tmp_mat);
456 
457  if(tmp_mat.nrows() > 1)
458  return error("\"quanti_environmental_variance\" accepts only an array with one row. \
459 The matrix has %i rows.\n", tmp_mat.nrows());
460 
461  if(tmp_mat.ncols() > _num_traits)
462  return error("\"quanti_environmental_variance\" accepts an array with as many values as the number of traits. \
463 The matrix has %i columns.\n", tmp_mat.ncols());
464 
465  if(tmp_mat.ncols() < _num_traits)
466  warning("\"quanti_environmental_variance\" received an array with less values (%i) than the number of traits (%i). \
467 The values will be recycled among traits.", tmp_mat.ncols(), _num_traits);
468 
469  double var;
470 
471  for(unsigned int i = 0; i < _num_traits; i++) {
472 
473  var = tmp_mat.get(0, i%tmp_mat.ncols()); // recycle values if less values provided than number of traits
474 
475  if( var < 0 )
476  return error("\"quanti_environmental_variance\" received a negative value for trait %i!\n", i+1 );
477  else
478  _eVariance.push_back( sqrt(var) ); // store the SD to save time later
479  }
480 
481  } else { // single value provided, copied for all traits
482 
483  double var = get_parameter_value("quanti_environmental_variance");
484 
485  if( var < 0 )
486  return error("\"quanti_environmental_variance\" received a negative value!\n");
487 
488  for(unsigned int i = 0; i < _num_traits; ++i) {
489  _eVariance.push_back( sqrt(var) ); // store the SD to save time later
490  }
491 
492  }
493 
494  } // END if env variance
495 
496 #ifdef _DEBUG_
497  if(_eVariance.size() > 0) {
498 
499  message("quant::environmental variance is set to: ");
500 
501  for(unsigned int i = 0; i < _eVariance.size(); ++i)
502  message("%.3f, ", _eVariance[i]);
503 
504  message("\n");
505 
506  } else {
507 
508  message("quant::no environmental variance is set\n");
509  }
510 
511 #endif
512 
513  _h2.clear();
514 
515  if(get_parameter("quanti_heritability")->isSet()){
516 
517  if(get_parameter("quanti_heritability")->isMatrix()) // can be trait-specific
518  {
519  get_parameter("quanti_heritability")->getMatrix(&tmp_mat);
520 
521  if(tmp_mat.nrows() > 1)
522  return error("\"quanti_heritability\" accepts only an array with one row. \
523 The matrix has %i rows.\n", tmp_mat.nrows());
524 
525  if(tmp_mat.ncols() > _num_traits)
526  return error("\"quanti_heritability\" accepts an array with as many values as the number of traits. \
527 The matrix has %i columns.\n", tmp_mat.ncols());
528 
529  if(tmp_mat.ncols() < _num_traits)
530  warning("\"quanti_heritability\" received an array with less values (%i) than the number of traits (%i). \
531 The values will be recycled among traits.", tmp_mat.ncols(), _num_traits);
532 
533 
534  double h2;
535 
536  for(unsigned int i = 0; i < _num_traits; i++) {
537 
538  h2 = tmp_mat.get(0, i%_num_traits); // value recycling
539 
540  if( h2< 0 )
541  return error("\"quanti_heritability\" received a negative value for trait %i!\n", i+1 );
542  else
543  _h2.push_back( h2 ); // store the SD to save time later
544  }
545 
546  } else {
547 
548  double h2 = get_parameter_value("quanti_heritability");
549 
550  if( h2 < 0 )
551  return error("\"quanti_heritability\" received a negative value!\n");
552 
553  for(unsigned int i = 0; i < _num_traits; ++i) {
554  _h2.push_back( h2 ); // store the SD to save time later
555  }
556 
557  }
558  } //END IF isSet heritability
559 
560  _h2_setTime = 0;
561  if(get_parameter("quanti_heritability_setTime")->isSet()){
562  _h2_setTime = (unsigned int)get_parameter_value("quanti_heritability_setTime");
563  }
564 
565  _h2_isBroad = false;
566  if(get_parameter("quanti_heritability_isBroad")->isSet())
567  _h2_isBroad = (bool)get_parameter_value("quanti_heritability_isBroad");
568 
569 #ifdef _DEBUG_
570  if(_h2.size() > 0) {
571 
572  message("quant::heritability is set to: ");
573 
574  for(unsigned int i = 0; i < _eVariance.size(); ++i)
575  message("%.3f, ", _h2[i]);
576 
577  message("\n");
578 
579  } else {
580 
581  message("quant::no heritability is set, it will bepend on Ve (see above)\n");
582  }
583 
584  if(_h2_isBroad)
585  message("quant::heritability is set to \"broad sense\"\n");
586 #endif
587 
588  return true;
589 }

References _eVariance, _h2, _h2_isBroad, _h2_setTime, _num_traits, error(), TMatrix::get(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), Param::isSet(), message(), TMatrix::ncols(), TMatrix::nrows(), and warning().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ setInitialValuesParams()

bool TProtoQuanti::setInitialValuesParams ( )
593  {
594 
595  //---------------------------------------------------------------------------------------------
596  // INITIAL VALUES:
597 
598  if(get_parameter("quanti_init_value")->isSet()) {
599 
600  get_parameter("quanti_init_value")->getMatrix(&_init_value);
601 
602  if(_init_value.nrows() != 1 || _init_value.ncols() != _num_traits) {
603  return error("\"quanti_init_value\" must be an array of length equal to the number of traits!\n");
604  }
605 
606  }
607  else {
608  _init_value.reset(1,_num_traits, 0.0);
609  }
610 
611  if(get_parameter("quanti_init_model")->isSet()) {
612 
613  _doInitMutation = (unsigned int)get_parameter_value("quanti_init_model");
614 
615  } else {
616  _doInitMutation = 0;
617  }
618 
619  if(get_parameter("quanti_init_variance")->isSet()) {
620 
621  if(get_parameter("quanti_init_variance")->isMatrix()) {
622 
623  get_parameter("quanti_init_variance")->getMatrix(&_init_variance);
624 
626  return error("\"quanti_init_variance\" must be an array of length equal to the number of traits!\n");
627  }
628 
629  } else {
630  _init_variance.reset(1, _num_traits, get_parameter_value("quanti_init_variance"));
631  }
632 
633  }
634  else { // initial variance is not set
635 
636  // verify that the initial variance is set when needed
637  if(_doInitMutation == 2 && _allele_model > 2)
638  return error("the initial trait variance must be set with \"quanti_init_variance\" for init model 2 and continuous allelic model.\n");
639 
641  }
642 
643  return true;
644 }

References _allele_model, _doInitMutation, _init_value, _init_variance, _num_traits, error(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), Param::isMatrix(), Param::isSet(), TMatrix::ncols(), TMatrix::nrows(), and TMatrix::reset().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ setMutationCorrelation()

bool TProtoQuanti::setMutationCorrelation ( )
1864 {
1865  //---------------------------------------------------------------------------------------
1866  // MUTATIONAL CORRELATION
1867 
1868  // temporary TMatrix for parameters read-in
1869  TMatrix tmp_mat;
1870 
1871  _mutation_correlation.reset(1, _num_locus); // sets all elements to 0
1872 
1873  if(get_parameter("quanti_mutation_correlation")->isSet()) {
1874 
1875  if( get_parameter("quanti_mutation_matrix")->isSet() ){
1876 
1877  warning("\"quanti_mutation_correlation\" and \"quanti_mutation_matrix\" are set, we only use the mutation matrix. \"quanti_mutation_correlation\" is ignored.");
1878 
1879  } else if (_num_traits == 1) {
1880 
1881  warning("\"quanti_mutation_correlation\" is set but only one trait is modeled. Parameter is ignored.");
1882 
1883  } else {
1884 
1885  if(get_parameter("quanti_mutation_correlation")->isMatrix()) {
1886 
1887  get_parameter("quanti_mutation_correlation")->getMatrix(&tmp_mat);
1888 
1889  if(tmp_mat.nrows() > 1)
1890  return error("\"quanti_mutation_correlation\" must be an array with one row. The matrix has %i rows.\n", tmp_mat.nrows());
1891 
1892  if(tmp_mat.ncols() > _num_locus)
1893  return error("\"quanti_mutation_correlation\" accepts an array with as many values as the number of loci. \
1894 The array has %i values.\n", tmp_mat.ncols());
1895 
1896  if(tmp_mat.ncols() < _num_locus)
1897  warning("\"quanti_mutation_correlation\" received an array with less values (%i) than the number of loci (%i). \
1898 The values will be recycled among loci.", tmp_mat.ncols(), _num_locus);
1899 
1901 
1902  } else { // not a matrix but a single value
1903 
1904  double val = get_parameter_value("quanti_mutation_correlation");
1905 
1906  if(val < -1.0 || val > 1.0)
1907  return error("quant::value assigned to \"quanti_mutation_correlation\" must be within [-1, 1].\n");
1908 
1910 
1911  }
1912 
1913  }
1914  } // _end_ if param->isSet()
1915 
1916  return true;
1917 }

References _mutation_correlation, _num_locus, _num_traits, TMatrix::assign(), TMatrix::copy_recycle(), error(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), TMatrix::ncols(), TMatrix::nrows(), TMatrix::reset(), and warning().

Referenced by setMutationModel_full_pleio(), and setMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ setMutationModel_full_pleio()

bool TProtoQuanti::setMutationModel_full_pleio ( )
869 {
870 
871  //store a few important numbers
873 
874  // memory size of a single allele value
875 // _sizeofLocusType = sizeof(double); --> this is set in setParameters() depending on the allele type
876 
877  // size of data used to store pleiotropic allelic values at a locus
879 
880  // mutation correlation set from "quanti_mutation_correlation"
881  if(!setMutationCorrelation()) return false;
882 
883  // set the set trait/locus_table, will be used by stat and file handlers to access data
885 
886  if( _allele_model == 1 || _allele_model ==2 ) {
887  //---------------------------------------------------------------------------------------
888  // DIALLELIC LOCI
889 
890  if (_num_traits > 2) { // multivariate models, only for non-diallelic loci
891 
892  return error("quant::the di-allelic model with pleiotropy is only allowed for max. 2 quantitative traits.\n");
893 
894  } else { // there are 2 traits, otherwise the "no_pleio" version of the function is called
895 
896  if(!setDiallelicMutationModel()) return false;
897 
899 
900  }
901 
902  } else {
903  //---------------------------------------------------------------------------------------
904  // CONTIUUM OF ALLELE MODEL
905 
906  if(!setContinuousMutationModel_full_pleio()) return false;
907 
908  if (_num_traits == 2) { // bivariate models, only for non-diallelic loci
909 
912  else
914 
915 
916  } else if (_num_traits > 2) { // multivariate models, only for non-diallelic loci
917 
920  else
922 
923  }
924  }
925 
926  // SET POINTER TO MUTATE FUNCTION
927 
928  if(_genomic_mutation_rate == 0) {
929 
931 
932  } else if(_allele_model <= 2) { // diallelic models
933 
935 
936  } else if(_allele_model == 3) { // continuous
938  } else // continuous in-place
940 
941 
942  return true;
943 }
double * getMutationEffectMultivariateGaussian(unsigned int loc)
Definition: ttquanti.cc:2389
void setTraitAndLocusTables_full_pleio()
Definition: ttquanti.cc:1272
void mutate_nill(TTQuanti *ind)
Definition: ttquanti.cc:2662
double * getMutationEffectBivariateGaussian(unsigned int loc)
Definition: ttquanti.cc:2413
void mutate_inplace_full_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2762
double * getMutationEffectBivariateDiallelic(unsigned int loc)
Definition: ttquanti.cc:2456
void mutate_diallelic_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2811
double * getMutationEffectBivariateGaussianLocSpec(unsigned int loc)
Definition: ttquanti.cc:2423
double * getMutationEffectMultivariateGaussianLocSpec(unsigned int loc)
Definition: ttquanti.cc:2401
bool setDiallelicMutationModel()
Definition: ttquanti.cc:1347
bool setMutationCorrelation()
Definition: ttquanti.cc:1863
void mutate_full_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2690
bool setContinuousMutationModel_full_pleio()
Definition: ttquanti.cc:1501

References _allele_model, _genomic_mutation_rate, _getMutationValues, _locusByteSize, _mutation_func_ptr, _mutationVarianceIsLocusSpecific, _num_locus, _num_traits, _seq_length, _sizeofLocusType, error(), getMutationEffectBivariateDiallelic(), getMutationEffectBivariateGaussian(), getMutationEffectBivariateGaussianLocSpec(), getMutationEffectMultivariateGaussian(), getMutationEffectMultivariateGaussianLocSpec(), mutate_diallelic_pleio(), mutate_full_pleio(), mutate_inplace_full_pleio(), mutate_nill(), setContinuousMutationModel_full_pleio(), setDiallelicMutationModel(), setMutationCorrelation(), and setTraitAndLocusTables_full_pleio().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ setMutationModel_no_pleio()

bool TProtoQuanti::setMutationModel_no_pleio ( )
1144 {
1145 
1146  //---------------------------------------------------------------------------------------------
1147  // NON-PLEIOTROPIC TRAITS
1148 
1149  // size of data used to store allelic values at a locus -- here non-pleiotropic
1151 
1152  TMatrix tmp;
1153 
1154  if(_num_traits > 1) {
1155 #ifdef _DEBUG_
1156  message("quant::setting num loci per trait without pleiotropy.\n");
1157 #endif
1158 
1159 
1160  if(get_parameter("quanti_loci_per_trait")->isSet()) {
1161 
1162  get_parameter("quanti_loci_per_trait")->getMatrix(&tmp);
1163 
1164  if( tmp.nrows() > 1)
1165  return error("\"quanti_loci_per_trait\" must be an array with one row.\n");
1166 
1167  if( !(tmp.ncols() == _num_traits) )
1168  return error("\"quanti_loci_per_trait\" must hold a number of loci for each trait. Use \"quanti_loci\" if loci are equally distributed among traits.\n");
1169 
1170  if(tmp.rowSum(0) != _num_locus)
1171  return error("\"quanti_loci_per_trait\" must specify a total number of loci equal to \"quanti_loci\"\n");
1172 
1173 #ifdef _DEBUG_
1174  message("quant::found trait-specific number of loci.\n");
1175 #endif
1176 
1177  } else {
1178  // divide the tot num of loci into num of traits
1179  tmp.reset(1, _num_traits);
1180 
1181  unsigned int loc_per_trait = _num_locus / _num_traits;
1182 
1183  tmp.assign(loc_per_trait);
1184 
1185  if( _num_locus % _num_traits != 0) {
1186  warning("quant::number of loci is not a multiple of the number of trait, setting the number of loci per trait to %i.\n", _num_locus / _num_traits);
1187  warning("quant::resetting the total number of quantitative loci to %i\n", loc_per_trait*_num_traits);
1188  }
1189 
1190  _num_locus = loc_per_trait*_num_traits;
1191 
1192 #ifdef _DEBUG_
1193  message("quant::set equal number of loci per trait (%i).\n", (unsigned int)tmp.get(0,0));
1194 #endif
1195 
1196  }
1197 
1198 #ifdef _DEBUG_
1199  message("quant::setting trait and locus table for no-pleiotropy case.\n");
1200 #endif
1201 
1203  }
1204  else {
1205 
1206  tmp.reset(1, 1, _num_locus);
1207 
1209  }
1210 
1211  // _seq_length is equal to _num_locus
1213 
1214  //-----------------------------------------------------------------------------------------
1215  // SET MUTATION MODEL
1216 
1217 
1218  if( _allele_model <= 2 ) {
1219  //---------------------------------------------------------------------------------------
1220  // DIALLELIC LOCI
1221 
1222  if(!setDiallelicMutationModel()) return false;
1223 
1224  } else {
1225  //---------------------------------------------------------------------------------------
1226  // CONTIUUM OF ALLELE MODEL
1227 #ifdef _DEBUG_
1228  message("quant::setting continuous allele model for no-pleiotropy case.\n");
1229 #endif
1230 
1231  if(!setContinuousMutationModel_no_pleio()) return false;
1232 
1235  else
1237  }
1238 
1239  //-----------------------------------------------------------------------------------------
1240  // SET POINTER TO MUTATE FUNCTION
1241 
1242  if(_genomic_mutation_rate == 0) {
1243 
1245 
1246  } else if(_allele_model <= 2) {// di-allelic models
1247 
1249 
1250  } else if(_allele_model == 3) {
1251 
1253 
1254  } else
1256 
1257 //-----------------------------------------------------------------------------------------
1258 // ADDITIONAL CHECKS
1259 
1260  if(_paramSet->isSet("quanti_mutation_correlation"))
1261  warning("quant trait::\"quanti_mutation_correlation\" has no effect on non-pleiotropic loci, it can be removed.\n");
1262 
1263  if(_paramSet->isSet("quanti_pleio_matrix"))
1264  warning("quant trait::\"quanti_pleio_matrix\" has no effect on non-pleiotropic loci, it can be removed.\n");
1265 
1266 
1267  return true;
1268 }
bool isSet()
Accessor to the status flag.
Definition: param.h:287
double rowSum(unsigned int row)
Sum all elements in a row.
Definition: tmatrix.h:353
double * getMutationEffectUnivariateGaussian(unsigned int loc)
Definition: ttquanti.cc:2432
bool setContinuousMutationModel_no_pleio()
Definition: ttquanti.cc:1825
void mutate_diallelic_no_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2877
void mutate_inplace_no_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2742
double * getMutationEffectUnivariateGaussianLocSpec(unsigned int loc)
Definition: ttquanti.cc:2440
void setTraitAndLocusTables_no_pleio(TMatrix &mat)
Definition: ttquanti.cc:1304
void mutate_no_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2669

References _allele_model, _genomic_mutation_rate, _getMutationValues, _locusByteSize, _mutation_func_ptr, _mutationVarianceIsLocusSpecific, _num_locus, _num_traits, SimComponent::_paramSet, _seq_length, _sizeofLocusType, TMatrix::assign(), error(), TMatrix::get(), SimComponent::get_parameter(), Param::getMatrix(), getMutationEffectUnivariateGaussian(), getMutationEffectUnivariateGaussianLocSpec(), ParamSet::isSet(), message(), mutate_diallelic_no_pleio(), mutate_inplace_no_pleio(), mutate_nill(), mutate_no_pleio(), TMatrix::ncols(), TMatrix::nrows(), TMatrix::reset(), TMatrix::rowSum(), setContinuousMutationModel_no_pleio(), setDiallelicMutationModel(), setTraitAndLocusTables_no_pleio(), and warning().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ setMutationModel_var_pleio()

bool TProtoQuanti::setMutationModel_var_pleio ( )
948 {
949 
950  //---------------------------------------------------------------------------------------------
951  // VARIABLE PLEIOTROPY: Jobran Chebib
952 
953  // size of data used to store pleiotropic allelic values at a locus,
954  //here set same as sizeof a single allele as PD varies per locus
956 
957  // initializes pleiotropic connectivity matrix -- "quanti_pleio_matx" in init file
958  // the connectivity matrix holds 0's in absence of a locus effect on a trait, and 1's otherwise
959  // loci are fully pleiotropic by default (1's everywhere)
960 
961  // a matrix is provided in input
962 
963  get_parameter("quanti_pleio_matrix")->getMatrix(&_pleio_matx); //this resets/builds the TMatrix
964 
966  return error("quant::\"quanti_pleio-matrix\" must be an m by n matrix of length m equal to the number of loci and n equal to the number of traits!\n");
967  }
968 
969  // end reading pleiot matrix
970 
971 
972 #ifdef _DEBUG_
973  // print _pleio_matrix
974  message("\nquant::pleiotropy matrix dimensions: rows(loci) = %i, columns(traits) = %i, (first 25 loci)\n",_pleio_matx.getNbRows(),_pleio_matx.getNbCols());
975  for(unsigned int i = 0; i < _pleio_matx.getNbRows() && i < 25; i++) {
976  for(unsigned int j = 0; j < _pleio_matx.getNbCols(); j++){
977  message("%.0f ",_pleio_matx.get(i,j));
978  message(" | ");
979  }
980  message("\n");
981  }
982 #endif
983 
984  // create temp_table from _pleio_matx to build _trait_table and _locus_table
985  // records the locus-specific allele position affecting each trait, which depends on the PD of each locus
986 
987  vector< vector<unsigned int> > temp_table(_pleio_matx.ncols(),vector<unsigned int>(_pleio_matx.nrows()));
988 
989  if(_trait_locus_table.size() != 0) _trait_locus_table.clear();
990  // build table:
991  _trait_locus_table.assign(_pleio_matx.ncols(),vector<unsigned int>()); //trait X locus table, size of each row unknown yet
992 
993  unsigned int PD = 0, pos = 1; //pos = 1 because '0' is for no-effect of locus i on trait j
994 
995  for(unsigned int i = 0; i < _pleio_matx.nrows(); ++i){
996  // check that at least one trait is affected for each locus (row)
997  PD = 0;
998  for(unsigned int j = 0; j < _pleio_matx.ncols(); ++j){
999 
1000  if(_pleio_matx.get(i,j) == 1){
1001  temp_table[j][i] = pos; // pos is the array index in the sequence where the allelic value will be located
1002  pos++;
1003  PD++;
1004  _trait_locus_table[j].push_back(i); //add locus ID if that locus affects trait j
1005  }
1006  else if(_pleio_matx.get(i,j) == 0){
1007  temp_table[j][i] = 0;
1008  }
1009  else return error("quant::\"quanti_pleio_matrix\" must only contain 0s and 1s \n");
1010  }
1011 
1012  if(PD == 0)
1013  return error("quanti_pleio_matrix has only 0's for locus %i. Loci must affect at least one trait.\n", i+1);
1014  }
1015 
1016 #ifdef _DEBUG_
1017  // print temp_table (for debugging purposes only)
1018  message("quant::pleiotropic locus sequence position per trait (temp_table) (first 25 loci/trait): \n");
1019  for(unsigned int i=0; i<temp_table.size(); ++i){
1020  for(unsigned int j=0; j<temp_table[i].size() && j < 25; ++j){
1021  cout << temp_table[i][j] << " | ";
1022  }
1023  message("\n");
1024  }
1025 #endif
1026 
1027  // build _trait_table from temp_table (trait x locus)
1028  // it sets the array index of each allele affecting each trait in the QTL sequence
1029  // the sequence is organized as locus-trait: alleles affecting a given trait are NOT contiguous in the sequence
1030  if(_trait_table.size() != 0) _trait_table.clear();
1031 
1032  for(size_t i = 0; i < temp_table.size(); ++i){ //trait-wise
1033 
1034  _trait_table.push_back(vector<unsigned int>());
1035 
1036  for(size_t j = 0; j < temp_table[i].size(); ++j){ //locus-wise, size is the number of loci affecting trait i
1037 
1038  if(temp_table[i][j] != 0){
1039  _trait_table[i].push_back(temp_table[i][j]-1); //position in sequence where causative alleles are located
1040  }
1041  }
1042  }
1043 
1044  // build _locus_table from _pleio_matx
1045  // table holding { start locus index in sequence , pleiotropic degree } on each row
1046  if(_locus_table.size() != 0) _locus_table.clear();
1047 
1048  unsigned int pos4 = 0; //counts position in sequence
1049  unsigned int tsize = 0; //counts n traits affected = PD
1050 
1051  for(unsigned int i=0; i<_pleio_matx.getNbRows(); ++i){ //locus-wise
1052 
1053  _locus_table.push_back(vector<unsigned int> (2));
1054 
1055  _locus_table[i][0] = pos4;
1056 
1057  for(unsigned int j=0; j<_pleio_matx.getNbCols(); ++j){ //trait-wise, sum the row
1058 
1059  if(_pleio_matx.get(i,j) == 1)
1060  tsize++;
1061  }
1062 
1063  _locus_table[i][1] = tsize;
1064 
1065  pos4 += tsize;
1066 
1067  tsize = 0;
1068  }
1069 
1070  // calculate _seq_length from _trait_table
1071  _seq_length = 0;
1072  for(unsigned int i=0; i<_trait_table.size(); ++i){
1073  _seq_length += _trait_table[i].size();
1074  }
1075 
1076  //-----------------------------------------------------------------------------------------
1077  // SET MUTATION MODEL
1078 
1079  // mutation correlation set from "quanti_mutation_correlation"
1080  if(!setMutationCorrelation()) return false;
1081 
1082  if(_allele_model < 3 && !setDiallelicMutationModel()) return false;
1083 
1084  if(_allele_model > 2 && ! setContinuousMutationModel_var_pleio()) return false;
1085 
1086  _getMutationValuesVarPleio.clear(); // dimensionality of mutations depends on pleiotropic degree
1087 
1088  for(unsigned int i=0; i < _num_locus; ++i){
1089 
1090  if (_locus_table[i][1] == 1) { // PD = 1, no pleiotropy at this locus
1091 
1094  else
1096 
1097  } else if (_locus_table[i][1] == 2) { // PD = 2
1098 
1101  else
1103 
1104  } else if (_locus_table[i][1] > 2) { // PD > 2
1105 
1106  if (_allele_model > 2) {
1107 
1108 // if(_mutationVarianceIsLocusSpecific)
1110 // else
1111 // _getMutationValuesVarPleio.push_back(&TProtoQuanti::getMutationEffectMultivariateGaussian);
1112 
1113  } else {
1114  return error("quant::the di-allelic model with pleiotropy is only allowed for max. 2 quantitative traits (locus %i has PD = %i)\n.", i+1, _locus_table[i][1]);
1115  }
1116 
1117  }
1118  }
1119 
1120  //-----------------------------------------------------------------------------------------
1121  // SET POINTER TO MUTATE FUNCTION
1122 
1123  if(_genomic_mutation_rate == 0) {
1124 
1126 
1127  } else if(_allele_model <= 2) {// di-allelic models
1128 
1130 
1131  } else if(_allele_model == 3) {// continuous model
1132 
1134 
1135  } else //model 4, in-place continuous model
1137 
1138  return true;
1139 }
unsigned int getNbRows() const
Gives the number of rows.
Definition: tmatrix.h:211
unsigned int getNbCols() const
Gives the number of columns.
Definition: tmatrix.h:214
void mutate_inplace_var_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2787
void mutate_diallelic_var_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2846
void mutate_var_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2716
bool setContinuousMutationModel_var_pleio()
Definition: ttquanti.cc:1668

References _allele_model, _genomic_mutation_rate, _getMutationValuesVarPleio, _locus_table, _locusByteSize, _mutation_func_ptr, _mutationVarianceIsLocusSpecific, _num_locus, _num_traits, _pleio_matx, _seq_length, _sizeofLocusType, _trait_locus_table, _trait_table, error(), TMatrix::get(), SimComponent::get_parameter(), Param::getMatrix(), getMutationEffectBivariateGaussian(), getMutationEffectBivariateGaussianLocSpec(), getMutationEffectMultivariateGaussianLocSpec(), getMutationEffectUnivariateGaussian(), getMutationEffectUnivariateGaussianLocSpec(), TMatrix::getNbCols(), TMatrix::getNbRows(), message(), mutate_diallelic_var_pleio(), mutate_inplace_var_pleio(), mutate_nill(), mutate_var_pleio(), TMatrix::ncols(), TMatrix::nrows(), setContinuousMutationModel_var_pleio(), setDiallelicMutationModel(), and setMutationCorrelation().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ setMutationSigmaFromQuantiMutationVariance()

bool TProtoQuanti::setMutationSigmaFromQuantiMutationVariance ( )
1922 {
1923 
1924 // message("quant::found \"quanti_mutation_variance\" in input, checking dimensionality: ");
1925 
1926  if(get_parameter("quanti_mutation_variance")->isMatrix()) {
1927 
1928 #ifdef _DEBUG_
1929  message("\nquant::found locus-specific mutation variance (param is matrix).\n");
1930 #endif
1931 
1932  TMatrix tmp;
1933 
1934  get_parameter("quanti_mutation_variance")->getMatrix(&tmp);
1935 
1936 // message("%i x %i\n",tmp.nrows(), tmp.ncols());
1937 
1938  if(tmp.nrows() > 1) {
1939  error("\"quanti_mutation_variance\" must be an array with a single row and as many columns as the number of loci.\
1940 The matrix passed has %i rows.\n", tmp.nrows());
1941 
1942  error("Note: use \"quanti_mutation_matrix\" to specify different variance-covariance parameters for different traits\n");
1943  return false;
1944  }
1945 
1946  if(tmp.ncols() > _num_locus)
1947  return error("\"quanti_mutation_variance\" accepts an array with max. as many values as the number of loci. \
1948 The array has %i columns.\n", tmp.ncols());
1949 
1950  if(tmp.ncols() < _num_locus)
1951  warning("\"quanti_mutation_variance\" received an array with less values (%i) than the number of loci (%i). \
1952 The values will be recycled among loci.\n", tmp.ncols(), _num_locus);
1953 
1954  // using an array means that the mutation effect size is different among loci
1955  // we do not look at locus-specific pleiotropy here, but set the matrix to the maximum pleiotropic degree = num traits
1956 
1958 
1959 // message("quant::setting locus-specific mutation variance\n");
1960 
1961  // copy the values for each locus to all traits equally
1962  for(unsigned int i = 0; i < _num_locus; ++i) {
1963 
1964  if(tmp.get(0, i % tmp.ncols()) < 0)
1965  return error("quant::values assigned to \"quanti_mutation_variance\" must by > 0.\n");
1966 
1967  _mutation_sigma.set_row(i, sqrt( tmp.get(0, i % tmp.ncols()) ) );
1968  }
1969 
1970  } else { // not a matrix but a single value, the matrix has a single row
1971 
1972 // message("1 x 1\nquant::setting equal mutation variance on all traits and for all loci\n");
1973 
1974  if(get_parameter_value("quanti_mutation_variance") < 0)
1975  return error("quant::value assigned to \"quanti_mutation_variance\" must by > 0.\n");
1976 
1977  _mutation_sigma.reset(1, _num_traits, sqrt( get_parameter_value("quanti_mutation_variance") ));
1978 
1979  }
1980 
1981 #ifdef _DEBUG_
1982  message("quant::mutation sigma matrix:\n");
1984 #endif
1985 
1986  return true;
1987 }
void set_row(unsigned int i, double val)
Sets all elements at row i to value val.
Definition: tmatrix.h:110

References _mutation_sigma, _num_locus, _num_traits, error(), TMatrix::get(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), message(), TMatrix::ncols(), TMatrix::nrows(), TMatrix::reset(), TMatrix::set_row(), TMatrix::show_up(), and warning().

Referenced by setContinuousMutationModel_full_pleio(), and setContinuousMutationModel_var_pleio().

+ Here is the caller graph for this function:

◆ setMutationSigmaFromQuantiMutationVariance_no_pleio()

bool TProtoQuanti::setMutationSigmaFromQuantiMutationVariance_no_pleio ( )
1992 {
1993 // message("quant::found \"quanti_mutation_variance\" in input, checking dimensionality for non-pleiotropic loci: ");
1994 
1995  if(get_parameter("quanti_mutation_variance")->isMatrix()) {
1996 
1997  TMatrix tmp;
1998 
1999  get_parameter("quanti_mutation_variance")->getMatrix(&tmp);
2000 
2001 // message("%i x %i\n",tmp.nrows(), tmp.ncols());
2002 
2003  if(tmp.nrows() > _num_traits)
2004  return error("\"quanti_mutation_variance\" has more rows than the number of traits for non-pleiotropic loci. Ignoring extra rows.\n", tmp.nrows());
2005 
2006  if(tmp.ncols() > _num_locus)
2007  return error("\"quanti_mutation_variance\" has more columns than the number of loci. The matrix has %i columns.\n", tmp.ncols());
2008 
2009  if(tmp.ncols() < _num_locus || tmp.nrows() < _num_traits)
2010  warning("quant::\"quanti_mutation_variance\" received less values than expected from the number of loci or traits. \
2011 The values will be recycled among loci and traits.\n");
2012 
2013  // using an array means the mutation effect size is different among loci
2014  // we do not look at locus-specific pleiotropy here, but set the matrix to the maximum pleiotropic degree = num traits
2015 
2016 // message("quant::setting locus-specific mutation variance for non-pleiotropic loci\n");
2017 
2018  _mutation_sigma.reset(_num_locus, 1); //each locus is affecting one trait only
2019 
2020  TMatrix expanded_mat(_num_traits, _num_locus);
2021 
2022  // copy elements at the right place when provided as trait-specific variance per block of loci, for instance.
2023  expanded_mat.copy_recycle(tmp);
2024 
2025  // copy trait-specific variances into the mutation sigma matrix first column
2026  for(unsigned int i = 0; i < _num_traits; ++i) {
2027  for(unsigned int j = 0, pos = _trait_table[i][0]; j < _trait_table[i].size(); ++j, ++pos){
2028 
2029  if(expanded_mat.get(i,pos) < 0)
2030  return error("quant::values assigned to \"quanti_mutation_variance\" must by > 0.\n");
2031 
2032  _mutation_sigma.set(pos, 0, sqrt(expanded_mat.get(i,pos)));
2033  }
2034  }
2035 
2036  } else { // not a matrix but a single value, the matrix has a single row
2037 
2038 // message("1 x 1\nquant::setting equal mutation variance across all quantitative loci\n");
2039 
2040  if(get_parameter_value("quanti_mutation_variance") < 0)
2041  return error("quant::value assigned to \"quanti_mutation_variance\" must by > 0.\n");
2042 
2043  _mutation_sigma.reset(1, 1, sqrt( get_parameter_value("quanti_mutation_variance") ));
2044 
2045  }
2046 
2047 #ifdef _DEBUG_
2048  message("quant::mutation sigma matrix:\n");
2050 #endif
2051 
2052  return true;
2053 }

References _mutation_sigma, _num_locus, _num_traits, _trait_table, TMatrix::copy_recycle(), error(), TMatrix::get(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getMatrix(), message(), TMatrix::ncols(), TMatrix::nrows(), TMatrix::reset(), TMatrix::set(), TMatrix::show_up(), and warning().

Referenced by setContinuousMutationModel_no_pleio().

+ Here is the caller graph for this function:

◆ setParameters()

bool TProtoQuanti::setParameters ( )
virtual

Implements SimComponent.

249 {
250 #ifdef _DEBUG_
251  message("Trait quant::setting parameters\n");
252 #endif
253 
254  // reset all pointers to GSL matrices and vectors etc.
255  // do it here, before changing num trait and num loci for a new simulation
257 
258  //---------------------------------------------------------------------------------------
259  // Mandatory parameters:
260 
261  // number of quantitative traits
262  _num_traits = (unsigned int)get_parameter_value("quanti_traits");
263 
264  // number of loci
265  _num_locus = (unsigned int)get_parameter_value("quanti_loci");
266 
267  _2L = 2*_num_locus;
268 
269  // set the genomic mutation rate
270  _mutation_rate = get_parameter_value("quanti_mutation_rate");
271 
273 
274  // set the allelic model
275  if( !(_allele_model = setAlleleModel()) ) return false;
276 
277  // check and set the datatype of the alleles, and size thereof
278  if(get_parameter("quanti_diallele_datatype")->isSet()) {
279 
280  _diallele_datatype = get_parameter("quanti_diallele_datatype")->getArg();
281 
282  if(_diallele_datatype != "byte" && _diallele_datatype != "bit")
283  return error("\"quanti_diallele_datatype\" received \"%s\", valid options are \"byte\" or \"bit\"\n",
284  _diallele_datatype.c_str());
285  }
286  else
287  _diallele_datatype = "bit";
288 
289  if(_allele_model <= 2)
290  _sizeofLocusType = sizeof(unsigned char); // only used for "byte" datatype; i.e. di-allelic loci
291  else
292  _sizeofLocusType = sizeof(double);
293 
294  //---------------------------------------------------------------------------------------
295  // type of pleiotropy and pleiotropy-dpdt parameters:
296 
297  string pleio = get_parameter("quanti_pleiotropy")->getArg();
298 
299  if(_num_traits == 1 || pleio == "no" || pleio == "n" || pleio == "") {
300 
301  _pleio_type = 0;
302 
303 #ifdef _DEBUG_
304  message("quant::%s pleiotropy, %i trait(s), %i loci\n", "no", _num_traits, _num_locus);
305 #endif
306 
307  if(!setMutationModel_no_pleio()) return false;
308 
309  } else if (pleio == "full" || pleio == "f") {
310 
311  if(get_parameter("quanti_pleio_matrix")->isSet())
312  warning("\"quanti_pleio_matrix\" is ignored when pleiotropy type is \"full\".\n");
313 
314  _pleio_type = 1;
315 
316 #ifdef _DEBUG_
317  message("quant::%s pleiotropy, %i trait(s), %i loci\n", "full", _num_traits, _num_locus);
318 #endif
319 
320  if (!setMutationModel_full_pleio()) return false;
321 
322  } else if (pleio == "var" || pleio == "variable" || pleio == "v") {
323 
324  if(!get_parameter("quanti_pleio_matrix")->isSet())
325  return error("\"quanti_pleio_matrix\" must be provided when pleiotropy type is \"variable\".\n");
326 
327  _pleio_type = 2;
328 
329 #ifdef _DEBUG_
330  message("quant::%s pleiotropy, %i trait(s), %i loci\n", "variable", _num_traits, _num_locus);
331 #endif
332 
333  if(!setMutationModel_var_pleio()) return false;
334 
335  } else {
336  return error("\"quanti_pleiotropy\" takes options: full (f), var(iable) (v), or no (n)\n");
337  }
338 
339 #ifdef _DEBUG_
340  // print _trait_table (for debugging purposes only
341  message("quant::pleiotropic locus sequence position per trait (_trait_table) (ID:pos of first 10 loci/trait): \n");
342  for(unsigned int i=0; i<_trait_table.size(); ++i){
343  message("trait %i:\n", i);
344  for(unsigned int j=0; j <_trait_table[i].size() && j < 10; ++j){
345  message("%i:%i | ", _trait_locus_table[i][j], _trait_table[i][j]);
346  }
347  message("\n");
348  }
349  message("\n_trait_size: %i\n", _trait_table.size());
350 
351  // print _locus_table (for debugging purposes only)
352  message("quant::pleiotropic degree per locus (_locus_table) (first position in sequence of a locus : PD; for the first 25 loci): \n");
353  for(unsigned int i = 0; i <_locus_table.size() && i < 25; ++i){
354  message(" %i: %i \n", _locus_table[i][0], _locus_table[i][1]);
355  }
356 
357  message("quant::total sequence length: %i\n", _seq_length);
358 #endif
359 
360  //---------------------------------------------------------------------------------------
361  // ENVIRONMENTAL VARIANCE AND HERITABILITY
362 
363  // check and set environmental variance and heritability parameters:
364  if( !setHeritabilityParams()) return false;
365 
366  // setting the pointer to the phenotype setter function
367  // called in TProtoQuanti::get_phenotypic_value, itself called by TTQuanti::set_value()
368  if(_eVariance.size() != 0 ) {
369 
371 
372  } else { // no environmental effect
373 
375 
376  }
377 
378  //---------------------------------------------------------------------------------------
379  // INITIAL TRAIT VALUES
380  if( !setInitialValuesParams()) return false;
381 
382  //---------------------------------------------------------------------------------------
383  // COMPUTING GENOTYPE VALUES: ADDITVITY and DOMINANCE
384 
385  if( !setDominanceParameters() ) return false;
386 
387  //---------------------------------------------------------------------------------------
388  // EPISTASIS
389  if( !setEpistasisParameters() ) return false;
390 
391 
392  //---------------------------------------------------------------------------------------
393  // set pointers to genotype value setter
394 
395  // epistasis is hidden in the additive and dominance value setter of the "epistatic" classes
396  // epistasis is thus allowed on top of dominance
397 
398 
399  // set function pointers to default k-dominance model if dominance is added
400  if(_dominance_model) {
401 
404 
405  } else {
406 
409 
410  }
411 
412 
413 
414  //---------------------------------------------------------------------------------------
415  // GENETIC MAP AND INHERIT FUNCTION POINTER
416 
417  if( !setGeneticMapParams()) return false;
418 
419 #ifdef _DEBUG_
420 
421  TTQuanti* trait = hatch();
422 
423  trait->init();
424  trait->init_sequence();
425  message("quant::parameters are set; display individual trait info:\n");
426  trait->show_up();
427 
428  delete trait;
429 
430 #endif
431 
432  return true;
433 }
unsigned int setAlleleModel()
Definition: ttquanti.cc:804
double set_genotype_value_dominance(const TTQuanti *ind, const unsigned int trait)
Definition: ttquanti.cc:2531
double set_genotype_value_additive(const TTQuanti *ind, const unsigned int trait)
Definition: ttquanti.cc:2524
bool setMutationModel_var_pleio()
Definition: ttquanti.cc:947
bool setMutationModel_no_pleio()
Definition: ttquanti.cc:1143
bool setDominanceParameters()
Definition: ttquanti.cc:2310
bool setInitialValuesParams()
Definition: ttquanti.cc:593
bool setGeneticMapParams()
Definition: ttquanti.cc:648
virtual TTQuanti * hatch()
Definition: ttquanti.cc:2897
bool setEpistasisParameters()
Definition: ttquanti.cc:688
bool setHeritabilityParams()
Definition: ttquanti.cc:437
bool setMutationModel_full_pleio()
Definition: ttquanti.cc:868
virtual void show_up()=0
Writes some info to stdout.
virtual void init()=0
Called to allocate the trait's genotypic sequences.
virtual void init_sequence()=0
Called at the start of each replicate, sets the initial genotypes.

References _2L, _allele_model, _diallele_datatype, _dominance_model, _eVariance, _genomic_mutation_rate, _getGenotypeWithDominance, _locus_table, _mutation_rate, _num_locus, _num_traits, _pleio_type, _seq_length, _set_genotype_func_ptr, _set_trait_value_func_ptr, _sizeofLocusType, _trait_locus_table, _trait_table, deallocate_gsl_mutation_matrix_space(), error(), get_genotype_dominance_k(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getArg(), hatch(), TTrait::init(), TTrait::init_sequence(), message(), set_genotype_value_additive(), set_genotype_value_dominance(), set_trait_value_noVE(), set_trait_value_VE(), setAlleleModel(), setDominanceParameters(), setEpistasisParameters(), setGeneticMapParams(), setHeritabilityParams(), setInitialValuesParams(), setMutationModel_full_pleio(), setMutationModel_no_pleio(), setMutationModel_var_pleio(), TTrait::show_up(), and warning().

◆ setTraitAndLocusTables_full_pleio()

void TProtoQuanti::setTraitAndLocusTables_full_pleio ( )
1273 {
1274  // set the number of loci per trait in the _trait_table
1275  _trait_table.clear();
1276  _trait_table.assign(_num_traits, vector<unsigned int>(_num_locus));
1277 
1278  for(unsigned int i = 0; i < _num_traits; ++i) {
1279  for(unsigned int j = 0; j < _num_locus; ++j)
1280  _trait_table[i][j] = j*_num_traits + i;
1281  }
1282 
1283  // set the ID of loci affecting each trait in the _trait_locus_table
1284  _trait_locus_table.clear();
1285  _trait_locus_table.assign(_num_traits, vector<unsigned int>(_num_locus));
1286 
1287  for(unsigned int i = 0; i < _num_traits; ++i)
1288  for(unsigned int j = 0; j < _num_locus; ++j)
1289  _trait_locus_table[i][j] = j;
1290 
1291  // build _locus_table from _pleio_matx
1292  // table holding { start locus index in sequence , pleiotropic degree } on each row
1293  _locus_table.clear();
1294  _locus_table.assign(_num_locus, vector<unsigned int>(2));
1295 
1296  for(unsigned int i = 0; i < _num_locus; ++i) {
1297  _locus_table[i][0] = i*_num_traits;
1298  _locus_table[i][1] = _num_traits;
1299  }
1300 }

References _locus_table, _num_locus, _num_traits, _trait_locus_table, and _trait_table.

Referenced by setMutationModel_full_pleio().

+ Here is the caller graph for this function:

◆ setTraitAndLocusTables_no_pleio()

void TProtoQuanti::setTraitAndLocusTables_no_pleio ( TMatrix mat)
1305 {
1306  // loci are contiguous, separated in chunks each affecting different traits
1307 
1308  // set the number of loci array position in the _trait_table
1309  // starting position in the sequence array of each locus set is the first value of each row
1310  _trait_table.clear();
1311 
1312  unsigned int loc = 0;
1313 
1314  for(unsigned int i = 0; i < _num_traits; ++i) {
1315 
1316  _trait_table.push_back(vector<unsigned int>(numLoc.get(0,i)));
1317 
1318  for(unsigned int j = 0; j < numLoc.get(0,i); ++j)
1319 
1320  _trait_table[i][j] = loc++;
1321  }
1322 
1323  assert(loc == _num_locus);
1324 
1325  // set the ID of loci affecting each trait in the _trait_locus_table,
1326  _trait_locus_table.clear();
1327  _trait_locus_table.assign(_num_traits, vector<unsigned int>());
1328 
1329  // here we just copy the _trait_table
1330  for(unsigned int i = 0; i < _num_traits; ++i) {
1331  _trait_locus_table[i].assign(_trait_table[i].begin(), _trait_table[i].end());
1332  }
1333 
1334  // build _locus_table from _pleio_matx
1335  // table holding { start locus index in sequence , pleiotropic degree } on each row
1336  _locus_table.clear();
1337  _locus_table.assign(_num_locus, vector<unsigned int>(2));
1338 
1339  for(unsigned int i = 0; i < _num_locus; ++i) {
1340  _locus_table[i][0] = i;
1341  _locus_table[i][1] = 1;
1342  }
1343 }

References _locus_table, _num_locus, _num_traits, _trait_locus_table, _trait_table, and TMatrix::get().

Referenced by setMutationModel_no_pleio().

+ Here is the caller graph for this function:

◆ store_data()

virtual void TProtoQuanti::store_data ( BinaryStorageBuffer saver)
inlinevirtual

Implements StorableComponent.

586  {saver->store(&_seq_length,sizeof(int));}
void store(void *stream, unsigned int nb_bytes)
Definition: binarystoragebuffer.cc:37

References _seq_length, and BinaryStorageBuffer::store().

Friends And Related Function Documentation

◆ TTQuanti

friend class TTQuanti
friend

◆ TTQuanti_continuous

friend class TTQuanti_continuous
friend

◆ TTQuanti_continuous_full_pleio

friend class TTQuanti_continuous_full_pleio
friend

Referenced by hatch().

◆ TTQuanti_continuous_no_pleio

friend class TTQuanti_continuous_no_pleio
friend

Referenced by hatch().

◆ TTQuanti_continuous_single

friend class TTQuanti_continuous_single
friend

◆ TTQuanti_continuous_var_pleio

friend class TTQuanti_continuous_var_pleio
friend

Referenced by hatch().

Member Data Documentation

◆ _2L

unsigned int TProtoQuanti::_2L
protected

Diploid locus size, to save on useless operations during mutation.

Referenced by get_num_mutations(), and setParameters().

◆ _all_chooser

bool* TProtoQuanti::_all_chooser
private

◆ _allele_model

◆ _allele_value

◆ _diallele_datatype

string TProtoQuanti::_diallele_datatype
protected

Referenced by hatch(), and setParameters().

◆ _doInitMutation

unsigned int TProtoQuanti::_doInitMutation
private

◆ _dominance_effects

TMatrix TProtoQuanti::_dominance_effects
private

◆ _dominance_model

unsigned int TProtoQuanti::_dominance_model
private

◆ _effects_bivar

◆ _effects_multivar

◆ _epistasis

bool TProtoQuanti::_epistasis
private

◆ _epistatic_coefs_indices

TMatrix TProtoQuanti::_epistatic_coefs_indices
private

◆ _epistatic_coefs_matrix

TMatrix TProtoQuanti::_epistatic_coefs_matrix
private

◆ _equal_dom_coeff

bool TProtoQuanti::_equal_dom_coeff
private

◆ _equal_effects

bool TProtoQuanti::_equal_effects
private

◆ _equal_val_0

double TProtoQuanti::_equal_val_0
private

◆ _equal_val_1

double TProtoQuanti::_equal_val_1
private

◆ _equal_val_diff

double TProtoQuanti::_equal_val_diff
private

◆ _eval

◆ _eVariance

vector<double> TProtoQuanti::_eVariance
private

◆ _evect

◆ _freqExtractor

TTQFreqExtractor* TProtoQuanti::_freqExtractor
private

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

◆ _genomic_mutation_rate

◆ _getGenotypeWithDominance

double(TProtoQuanti::* TProtoQuanti::_getGenotypeWithDominance) (double, double, double)
private

Pointer to either dominance_h() or dominance_k() function computing the genotypic value with dominance.

Referenced by setParameters().

◆ _getMutationValues

double*(TProtoQuanti::* TProtoQuanti::_getMutationValues) (unsigned int)
private

◆ _getMutationValuesVarPleio

vector< double* (TProtoQuanti::* ) (unsigned int) > TProtoQuanti::_getMutationValuesVarPleio
private

Collection of pointers to mutation functions, which generate allele values in dependence of pleiotropic degree.

Referenced by getMutationEffectsVarPleio(), mutate_inplace_var_pleio(), mutate_var_pleio(), and setMutationModel_var_pleio().

◆ _gsl_mutation_matrix

◆ _h2

vector<double> TProtoQuanti::_h2
private

◆ _h2_isBroad

bool TProtoQuanti::_h2_isBroad
private

◆ _h2_setTime

unsigned int TProtoQuanti::_h2_setTime
private

◆ _inherit_fun_ptr

void(TProtoQuanti::* TProtoQuanti::_inherit_fun_ptr) (sex_t, TTQuanti *, const TTQuanti *)
private

Pointer to inheritance functions: either inherit_free() (r=0.5), or inherit_low() (r<0.5).

Referenced by inherit(), and setGeneticMapParams().

◆ _init_value

TMatrix TProtoQuanti::_init_value
private

◆ _init_variance

TMatrix TProtoQuanti::_init_variance
private

◆ _locus_table

vector< vector<unsigned int> > TProtoQuanti::_locus_table
private

Locus table, num_locus x 2, first column holds the start position of the alleles of each locus in the sequence, second column counts the number of alleles = pleiotropic degree.

Allelic values at a locus are contiguous in the sequence.

Referenced by get_locus_PD(), get_locus_start_pos(), get_sequence_block_size(), mutate_diallelic_var_pleio(), mutate_inplace_var_pleio(), mutate_var_pleio(), setContinuousMutationModel_var_pleio(), setMutationModel_var_pleio(), setParameters(), setTraitAndLocusTables_full_pleio(), and setTraitAndLocusTables_no_pleio().

◆ _locusByteSize

◆ _mutation_correlation

◆ _mutation_func_ptr

void(TProtoQuanti::* TProtoQuanti::_mutation_func_ptr) (TTQuanti *)
private

Pointer to mutation function, which depends on allele on model (HC, noHC, diallelic)

Referenced by mutate(), setMutationModel_full_pleio(), setMutationModel_no_pleio(), and setMutationModel_var_pleio().

◆ _mutation_rate

double TProtoQuanti::_mutation_rate
protected

◆ _mutation_sigma

◆ _mutationEffectIsFixedDiAllele

bool TProtoQuanti::_mutationEffectIsFixedDiAllele
private

◆ _mutationVarianceIsLocusSpecific

◆ _num_epi_coefs

unsigned int TProtoQuanti::_num_epi_coefs
private

◆ _num_locus

◆ _num_traits

◆ _ohtaStats

TTQOhtaStats* TProtoQuanti::_ohtaStats
private

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

◆ _pleio_matx

TMatrix TProtoQuanti::_pleio_matx
private

Pleiotropy matrix provided in input (num locu X num trait).

Gene (row)-trait (column) connectivity matrix.

Referenced by get_pleio_matrix(), setMutationModel_var_pleio(), and TProtoQuanti().

◆ _pleio_type

unsigned int TProtoQuanti::_pleio_type
protected

◆ _reader

TTQuantiFH* TProtoQuanti::_reader
private

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

◆ _seq_length

unsigned int TProtoQuanti::_seq_length
protected

◆ _sequence_diallele_values

double* TProtoQuanti::_sequence_diallele_values[2]
private

◆ _set_genotype_func_ptr

double(TProtoQuanti::* TProtoQuanti::_set_genotype_func_ptr) (const TTQuanti *, const unsigned int)
private

Pointer to functions get_genotype_value_additive() or get_genotype_value_dominance() computing the genotypic value of a trait as function of allele effect.

Referenced by get_genotypic_value(), set_trait_value_noVE(), and setParameters().

◆ _set_trait_value_func_ptr

double(TProtoQuanti::* TProtoQuanti::_set_trait_value_func_ptr) (const TTQuanti *, const unsigned int)
private

Pointer to either set_trait_value_VE() or set_trait_value_noVE() to compute phenotypic values.

Will call function to compute genotype values stored in _set_genotype_func_ptr.

Referenced by get_phenotypic_value(), set_trait_value_func_ptr(), and setParameters().

◆ _sizeofLocusType

◆ _stats

TTQuantiSH* TProtoQuanti::_stats
private

◆ _trait_locus_table

vector< vector<unsigned int> > TProtoQuanti::_trait_locus_table
private

Table storing the locus id of each locus affecting each trait (num trait X (variable length/trait)).

Referenced by get_allele_position(), get_locus_ID(), setMutationModel_var_pleio(), setParameters(), setTraitAndLocusTables_full_pleio(), and setTraitAndLocusTables_no_pleio().

◆ _trait_masks

vector<bitstring> TProtoQuanti::_trait_masks
private

◆ _trait_table

vector< vector<unsigned int> > TProtoQuanti::_trait_table
private

Trait table, (num trait X (variable length/trait)), holds, for each trait, the array position of causative alleles in the sequence.

Referenced by get_allele_position(), get_locus_seq_pos(), get_num_locus(), setDiallelicMutationModel(), setMutationModel_var_pleio(), setMutationSigmaFromQuantiMutationVariance_no_pleio(), setParameters(), setTraitAndLocusTables_full_pleio(), and setTraitAndLocusTables_no_pleio().

◆ _writer

TTQuantiFH* TProtoQuanti::_writer
private

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

◆ _ws


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

Generated for Nemo v2.4.0 by  doxygen 1.9.1 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR