Nemo  2.4.2
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 ( )
62  :
63  _num_locus(0),
64  _2L(0),
65  _num_traits(0),
66  _seq_length(0),
67  _allele_model(0),
69  _evect(0),
70  _eval(0),
72  _ws(0),
73  _mutation_rate(0),
75  _doInitMutation(0),
78  _h2_setTime(0),
79  _h2_isBroad(0),
80  _pleio_type(0),
82  _all_chooser(0),
83  _locusByteSize(0),
85  _eVariance(0),
86  _epistasis(false),
87  _num_epi_coefs(0),
94  _stats(0),
95  _writer(0),
96  _reader(0),
97  _freqExtractor(0),
98  _ohtaStats(0)
99 {
100  set_paramset("quantitative_trait", false, this);
101 
102  add_parameter("quanti_traits",INT,true,false,0,0); // MANDATORY
103  add_parameter("quanti_loci",INT,true,false,0,0); // MANDATORY
104  add_parameter("quanti_loci_per_trait", MAT, false, false,0,0);
105  add_parameter("quanti_allele_model",STR,true,false,0,0); // MANDATORY
106  add_parameter("quanti_allele_value",DBL,false,false,0,0);
107  add_parameter("quanti_diallele_datatype", STR, false, false, 0, 0);
108  add_parameter("quanti_init_value",MAT,false,false,0,0);
109  add_parameter("quanti_init_variance",DBL,false,false,0,0,0);
110  add_parameter("quanti_init_model",INT,false,true,0,3);
111 
112  // heritability
113  add_parameter("quanti_environmental_variance",DBL,false,false,0,0);
114  add_parameter("quanti_heritability", DBL, false, false, 0, 0);
115  add_parameter("quanti_heritability_setTime",INT, false, false, 0,0);
116  add_parameter("quanti_heritability_isBroad",BOOL, false, false, 0,0);
117 
118  // mutations
119  add_parameter("quanti_mutation_rate",DBL,true,true,0,1, 0); // MANDATORY
120  add_parameter("quanti_mutation_variance",DBL,false,false,0,0, 0); // accept locus-specific values
121 
122  // pleiotropy
123  add_parameter("quanti_pleiotropy", STR, false, false, 0,0, 0); // optional
124  add_parameter("quanti_mutation_correlation",DBL,false,false,0,0, 0); // accept locus-specific values
125  add_parameter("quanti_mutation_matrix",MAT,false,false,0,0, 0);
126  add_parameter("quanti_pleio_matrix",INT,false,true,0,1); // allows user to set pleiotropic degree of loci
127 
128  //dominance
129 // add_parameter("quanti_dominance_model", INT, false, true, 0, 1, 0);
130  add_parameter("quanti_dominance_mean", DBL, false, false, 0, 0, 0);
131  add_parameter("quanti_dominance_sd", DBL, false, false, 0, 0, 0);
132  add_parameter("quanti_dominance_effects", DBL, false, false, 0, 0, 0);
133 
134  //epsistasis
135  add_parameter("quanti_epistatic_effects", MAT, false, false, 0, 0, 0);
136  add_parameter("quanti_epistatic_network", MAT, false, false, 0, 0, 0);
137 
138  //genetic map parameters:
140 
141  // output
142  add_parameter("quanti_output",STR,false,false,0,0);
143  add_parameter("quanti_logtime",INT,false,false,0,0);
144  add_parameter("quanti_dir",STR,false,false,0,0);
145 
146  add_parameter("quanti_freq_output",BOOL,false,false,0,0);
147  add_parameter("quanti_freq_logtime",INT,false,false,0,0);
148 
149  add_parameter("quanti_ohta_output",BOOL,false,false,0,0);
150  add_parameter("quanti_ohta_logtime",INT,false,false,0,0);
151 
152 
153 // some pointer initialization:
154  _sequence_diallele_values[0] = NULL;
155  _sequence_diallele_values[1] = NULL;
156  _equal_effects = false;
157  _equal_val_0 = 0.0;
158  _equal_val_1 = 0.0;
159  _equal_val_diff = 0.0;
160 
161 }
virtual void set_paramset(ParamSet *paramset)
Sets the ParamSet member.
Definition: simcomponent.h:84
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:110
bool _equal_effects
Definition: ttquanti.h:622
vector< double > _eVariance
Definition: ttquanti.h:655
unsigned int _allele_model
Definition: ttquanti.h:608
bool _epistasis
Definition: ttquanti.h:678
size_t _sizeofLocusType
Definition: ttquanti.h:652
unsigned int _doInitMutation
Definition: ttquanti.h:640
unsigned int _dominance_model
Definition: ttquanti.h:645
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:687
bool _h2_isBroad
Definition: ttquanti.h:658
TTQuantiFH * _reader
Definition: ttquanti.h:722
unsigned int _h2_setTime
Definition: ttquanti.h:657
unsigned int _seq_length
Total number of allelic values stored in individual sequences, no trait x no locus.
Definition: ttquanti.h:607
double _mutation_rate
Definition: ttquanti.h:612
gsl_matrix ** _evect
Definition: ttquanti.h:635
gsl_vector ** _ws
Definition: ttquanti.h:638
bool _mutationVarianceIsLocusSpecific
Definition: ttquanti.h:641
unsigned int _num_epi_coefs
Definition: ttquanti.h:679
unsigned int _num_traits
Number of traits.
Definition: ttquanti.h:605
double * _sequence_diallele_values[2]
Definition: ttquanti.h:621
TTQuantiSH * _stats
Definition: ttquanti.h:720
void(TProtoQuanti::* _mutation_func_ptr)(TTQuanti *)
Pointer to mutation function, which depends on allele on model (HC, noHC, diallelic)
Definition: ttquanti.h:690
gsl_vector ** _effects_multivar
Definition: ttquanti.h:637
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:711
double _genomic_mutation_rate
Definition: ttquanti.h:613
gsl_matrix ** _gsl_mutation_matrix
Definition: ttquanti.h:634
bool * _all_chooser
Definition: ttquanti.h:650
double(TProtoQuanti::* _getGenotypeWithDominance)(double, double, double)
Pointer to either dominance_h() or dominance_k() function computing the genotypic value with dominanc...
Definition: ttquanti.h:699
double _equal_val_diff
Definition: ttquanti.h:625
double _equal_val_0
Definition: ttquanti.h:623
size_t _locusByteSize
Definition: ttquanti.h:651
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:705
double *(TProtoQuanti::* _getMutationValues)(unsigned int)
Pointer to mutation allele value function, which depends on allele model and number of traits affecte...
Definition: ttquanti.h:693
gsl_vector ** _eval
Definition: ttquanti.h:636
TTQuantiFH * _writer
Definition: ttquanti.h:721
bool _mutationEffectIsFixedDiAllele
Definition: ttquanti.h:642
TTQOhtaStats * _ohtaStats
Definition: ttquanti.h:724
unsigned int _2L
Diploid locus size, to save on useless operations during mutation.
Definition: ttquanti.h:603
unsigned int _num_locus
Total number of loci, for all traits.
Definition: ttquanti.h:601
double _equal_val_1
Definition: ttquanti.h:624
unsigned int _pleio_type
Definition: ttquanti.h:616
TTQFreqExtractor * _freqExtractor
Definition: ttquanti.h:723
void addGeneticMapParameters(string prefix)
Definition: ttrait_with_map.cc:76
@ DBL
Definition: types.h:76
@ MAT
Definition: types.h:76
@ BOOL
Definition: types.h:76
@ STR
Definition: types.h:76
@ INT
Definition: types.h:76

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)
165  :
167  _2L(_2L),
172  _evect(0),
173  _eval(0),
175  _ws(0),
178  _h2_setTime(0),
179  _h2_isBroad(0),
180  _pleio_type(0),
181  _doInitMutation(0),
184  _dominance_model(0),
185  _all_chooser(0),
186  _locusByteSize(0),
188  _eVariance(0),
191  _inherit_fun_ptr(0),
197  _stats(0),
198  _writer(0),
199  _reader(0),
200  _freqExtractor(0),
201  _ohtaStats(0)
202 {
203  _locusByteSize = T._num_traits * sizeof(double);
204  _paramSet = new ParamSet( *(T._paramSet) ) ;
205 
207 
208  _sequence_diallele_values[0] = NULL;
209  _sequence_diallele_values[1] = NULL;
214 
217 
218 }
Parameters container, implemented in each SimComponent.
Definition: param.h:214
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:46
void copy(const TMatrix &mat)
Copy a matrix.
Definition: tmatrix.h:76
TMatrix _pleio_matx
Pleiotropy matrix provided in input (num locu X num trait).
Definition: ttquanti.h:663
TMatrix _epistatic_coefs_matrix
Definition: ttquanti.h:680
TMatrix _epistatic_coefs_indices
Definition: ttquanti.h:681

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
223 {
225 
226  if(_stats){delete _stats; _stats = NULL;}
227  if(_writer){delete _writer; _writer = NULL;}
228  if(_reader) delete _reader;
229  if(_freqExtractor){delete _freqExtractor; _freqExtractor = NULL;}
230  if(_ohtaStats) {delete _ohtaStats; _ohtaStats = NULL;}
231  if(_all_chooser) {delete [] _all_chooser; _all_chooser = NULL;}
232 
234  delete [] _sequence_diallele_values[0];
235  _sequence_diallele_values[0] = NULL;
236  }
237 
239  delete [] _sequence_diallele_values[1];
240  _sequence_diallele_values[1] = NULL;
241  }
242 
243 }
void deallocate_gsl_mutation_matrix_space()
Definition: ttquanti.cc:2135

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)
2116 {
2117  _eval = new gsl_vector* [num_loc];
2118  _evect = new gsl_matrix* [num_loc];
2119  _effects_multivar = new gsl_vector* [num_loc];;
2120  _ws = new gsl_vector* [num_loc];
2121  _gsl_mutation_matrix = new gsl_matrix* [num_loc];
2122 
2123  // initializing pointers
2124  for(unsigned int i = 0; i < num_loc; ++i) {
2125  _eval[i] = NULL;
2126  _evect[i] = NULL;
2127  _effects_multivar[i] = NULL;
2128  _ws[i] = NULL;
2129  _gsl_mutation_matrix[i] = NULL;
2130  }
2131 }

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.

573 {return new TProtoQuanti(*this);}
TProtoQuanti()
Definition: ttquanti.cc:62

References TProtoQuanti().

◆ deallocate_gsl_mutation_matrix_space()

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

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
565 {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.

578 {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 
)
2467 {
2468  // not assured that the locus is affecting that trait, first check
2469  if(std::any_of(_trait_locus_table[trait].cbegin(), _trait_locus_table[trait].cend(),
2470  [locus](unsigned int i){return (i == locus);})) {
2471 
2472  // we have to find where the locus sits in the table
2473  vector<unsigned int>::const_iterator I = find(_trait_locus_table[trait].cbegin(), _trait_locus_table[trait].cend(),
2474  locus);
2475  // find index of pointer
2476  unsigned int pos = I - _trait_locus_table[trait].cbegin();
2477 
2478  return _trait_table[trait][pos];
2479  }
2480  return -1;
2481 }
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:669
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:666

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 
)
2486 {
2487  assert(allele < 2); // can be 0 or 1 only
2488 
2489  int pos = get_allele_position(locus, trait);
2490 
2491  if(pos > -1)
2492  return ind->get_allele_value(pos, allele);
2493  else
2494  return error("TProtoQuanti::get_allele_value::wrong allele position at locus %i for trait %i\n", locus, trait);
2495 }
int get_allele_position(const unsigned int locus, const unsigned int trait)
Definition: ttquanti.cc:2466
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:77

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
435  {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:191
TMatrix _allele_value
Definition: ttquanti.h:620

References _allele_value, and TMatrix::get().

◆ get_diallele_values()

const TMatrix& TProtoQuanti::get_diallele_values ( )
inline
433 {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
479 {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
428 {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
2556 {
2557  if(a1<a2) return 2*((1-h)*a1 + h*a2);
2558  return 2*((1-h)*a2 + h*a1);
2559 }

◆ get_genotype_dominance_k()

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

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 
)
2539 {
2540  // let's use the "k" model by default, it's the fastest:
2541  return get_genotype_dominance_k( a1 , a2, get_dominance(locus, trait));
2542 // return (this->*_getGenotypeWithDominance)( a1 , a2, get_dominance(locus, trait));
2543 }
double get_dominance(unsigned int locus, unsigned int trait)
Definition: ttquanti.h:477
double get_genotype_dominance_k(double a1, double a2, double k)
Definition: ttquanti.cc:2571

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
483  {
484  return (this->*_set_genotype_func_ptr)(ind, trait);
485  }

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
431 {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
430 {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
429 {return _h2;}
vector< double > _h2
Definition: ttquanti.h:656

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.

580 {return _num_locus;}

References _num_locus.

◆ get_locus_PD()

unsigned int TProtoQuanti::get_locus_PD ( unsigned int  locus)
inline
455 {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:674

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
452  {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
564 {return _num_epi_coefs;}

References _num_epi_coefs.

◆ get_num_locus() [1/2]

unsigned int TProtoQuanti::get_num_locus ( )
inline
422 {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
423 {return _trait_table[trait].size();}

References _trait_table.

◆ get_num_mutations()

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

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
421 {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.

576 {return _num_traits;}

References _num_traits.

◆ get_phenotypic_value()

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

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
450 {return _pleio_matx;}

References _pleio_matx.

◆ get_pleiotropy_type()

unsigned int TProtoQuanti::get_pleiotropy_type ( )
inline
424 {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
437  {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
425 {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
448 {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)
2579 {
2580  double Vm;
2581 
2582  if(_mutation_sigma.nrows() == 1) // same value for all loci
2583  Vm = 2 * _genomic_mutation_rate * _mutation_sigma.get(0, trait);
2584  else
2585  Vm = _mutation_sigma.colSum(trait) * _mutation_rate * 2;
2586 
2587  return Vm;
2588 }
double colSum(unsigned int col)
Sum all elements in a column.
Definition: tmatrix.h:342
unsigned int nrows() const
Definition: tmatrix.h:211
TMatrix _mutation_sigma
Definition: ttquanti.h:633

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.

574 {return QUANT;}
#define QUANT
Definition: types.h:70

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)
2456 {
2457  bool pos = RAND::RandBool();
2458  _effects_bivar[0] = _allele_value.get(loc, pos);
2460  pos : RAND::RandBool()) );
2461  return &_effects_bivar[0];
2462 }
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:125
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:170
TMatrix _mutation_correlation
Definition: ttquanti.h:632
double _effects_bivar[2]
Definition: ttquanti.h:639

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)
2413 {
2414  //no need to assert() as we are using a different set of containers and read from mutation_sigma directly
2416  &_effects_bivar[0], &_effects_bivar[1]);
2417  return &_effects_bivar[0];
2418 }
static void BivariateGaussian(double sigma1, double sigma2, double rho, double *out1, double *out2)
Definition: Uniform.h:340

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)
2423 {
2425  &_effects_bivar[0], &_effects_bivar[1]);
2426  return &_effects_bivar[0];
2427 }

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)
2389 {
2390  // assert we are using the correct mutation environment
2391  assert(get_locus_PD(loc) == _effects_multivar[0]->size);
2392 
2393  RAND::MultivariateGaussian(_eval[0], _evect[0], _ws[0], _effects_multivar[0]);
2394 
2395  return _effects_multivar[0]->data;
2396 }
unsigned int get_locus_PD(unsigned int locus)
Definition: ttquanti.h:455

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)
2401 {
2402  // assert we are using the correct mutation environment
2403  assert(get_locus_PD(loc) == _effects_multivar[loc]->size);
2404 
2405  RAND::MultivariateGaussian(_eval[loc], _evect[loc], _ws[loc], _effects_multivar[loc]);
2406 
2407  return _effects_multivar[loc]->data;
2408 }

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
534  {
535  return (this->* _getMutationValuesVarPleio[loc]) (loc);
536  }
vector< double *(TProtoQuanti::*)(unsigned int) > _getMutationValuesVarPleio
Collection of pointers to mutation functions, which generate allele values in dependence of pleiotrop...
Definition: ttquanti.h:696

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)
2432 {
2434  return &_effects_bivar[0];
2435 }
static double Gaussian(double sigma)
Definition: Uniform.h:271

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)
2440 {
2442  return &_effects_bivar[0];
2443 }

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.

2895 {
2896  TTQuanti* kid;
2897 
2898  if(_epistasis && _pleio_type == 2)
2899  fatal("quantitative trait loci with variable pleiotropy are not implemented for the epistatic case.\n");
2900 
2901  if(_pleio_type == 0) { //non-pleiotropic cases
2902 
2903  if(_allele_model <= 2) { // diallelic
2904 
2905  if(_epistasis) {
2906  if(_diallele_datatype == "byte")
2908  else
2910  }
2911  else if(_diallele_datatype == "byte") {
2912  kid = new TTQuanti_diallelic_no_pleio();
2913  } else {
2915  }
2916 
2917  } else { // continuous
2918 
2919  if(_epistasis)
2921  else
2922  kid = new TTQuanti_continuous_no_pleio();
2923  }
2924 
2925  } else if (_pleio_type == 1) { //full-pleiotropic cases
2926 
2927  if(_allele_model <= 2) {
2928 
2929  if(_epistasis) {
2930  if(_diallele_datatype == "byte")
2932  else
2934  }
2935  else if(_diallele_datatype == "byte") {
2936  kid = new TTQuanti_diallelic_full_pleio();
2937  } else {
2939  }
2940 
2941  } else {
2942 
2943  if(_epistasis)
2945  else
2946  kid = new TTQuanti_continuous_full_pleio();
2947  }
2948 
2949  } else { // variable pleiotropy cases
2950 
2951  if(_allele_model <= 2) {
2952 
2953  if(_diallele_datatype == "byte")
2954  kid = new TTQuanti_diallelic_var_pleio();
2955  else
2957 
2958  } else {
2959  kid = new TTQuanti_continuous_var_pleio();
2960  }
2961  }
2962 
2963  kid->set_proto(this);
2964 
2965  // set specific optimisations:
2966 
2967 
2968  return kid;
2969 }
friend class TTQuanti_continuous_var_pleio
Definition: ttquanti.h:716
string _diallele_datatype
Definition: ttquanti.h:609
friend class TTQuanti_continuous_no_pleio
Definition: ttquanti.h:717
friend class TTQuanti_continuous_full_pleio
Definition: ttquanti.h:715
TTQuanti_continuous_full_pleio : universal pleiotropy.
Definition: ttquanti_epistasis.h:38
TTQuanti_continuous_no_pleio : multiple non-pleiotropic traits with epistasis.
Definition: ttquanti_epistasis.h:98
TTQuanti_diallelic_bitstring_full_pleio_epistasis : pleiotropic di-allelic bitstring with epistasis.
Definition: ttquanti_epistasis.h:186
TTQuanti_diallelic_bitstring_full_pleio : pleiotropic di-allelic loci, max PD = 2.
Definition: ttquanti_bitstring.h:128
TTQuanti_diallelic_bitstring_no_pleio_epistasis : non-pleiotropic di-allelic bitstring with epistasis...
Definition: ttquanti_epistasis.h:157
TTQuanti_diallelic_bitstring_no_pleio : single or multiple non-pleiotropic traits,...
Definition: ttquanti_bitstring.h:95
TTQuanti_diallelic_bitstring_var_pleio : variable pleiotropic di-allelic loci, max PD = 2.
Definition: ttquanti_bitstring.h:155
TTQuanti_diallelic_full_pleio : pleiotropic di-allelic loci, max PD = 2.
Definition: ttquanti_epistasis.h:68
TTQuanti_diallelic_full_pleio : pleiotropic di-allelic loci, max PD = 2.
Definition: ttquanti.h:354
TTQuanti_diallelic_no_pleio_epistasis : single or multiple non-pleiotropic traits,...
Definition: ttquanti_epistasis.h:127
TTQuanti_diallelic_no_pleio : single or multiple non-pleiotropic traits, di-allelic.
Definition: ttquanti.h:327
TTQuanti_diallelic_var_pleio : variable pleiotropic di-allelic loci, max PD = 2.
Definition: ttquanti.h:381
TTQuanti.
Definition: ttquanti.h:59
void set_proto(TProtoQuanti *proto)
Definition: ttquanti.h:95
void fatal(const char *str,...)
Definition: output.cc:98

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
2593 {
2594  (this->*_inherit_fun_ptr)(SEX, ind, parent);
2595 }

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
2636 {
2637 // assert(_all_chooser);
2638 
2639 // for(unsigned int i = 0; i < _num_locus; ++i)
2640 // _all_chooser[i] = RAND::RandBool();
2641 
2642  // copy the information for one locus at a time
2643  for(unsigned int i = 0; i < _num_locus; ++i)
2644 // ind->copy_sequence_block(SEX, _all_chooser[i], i, i+1, parent);
2645  ind->copy_sequence_1locus(SEX, RAND::RandBool(), i, parent);
2646 
2647  // note that more than one value may be copied at a time because of pleiotropy
2648 }
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
2600 {
2601  unsigned int prevLoc = 0;
2602 
2603  //the table containing the loci at which x-overs happen
2604  vector< pair<unsigned int, unsigned int> > recTable = _map.reduceJunctions(SEX, _mapIndex);
2605 
2606 
2607 #ifdef _REC_DEBUG_
2608  //number of x-overs
2609  unsigned int nbRec = recTable.size();
2610  cout << "TProtoQuanti::inherit_low; nb Rec = "<<nbRec - 1<<endl;
2611  cout << " --sex = "<<SEX<<"\n";
2612 #endif
2613 
2614 // unsigned int num_copied = 0;
2615 
2616  vector< pair<unsigned int, unsigned int> >::const_iterator xover = recTable.begin();
2617 
2618  while(xover != recTable.end()) {
2619 
2620 #ifdef _REC_DEBUG_
2621  cout<< " copy seq from "<<prevLoc<<" to "<<xover->first
2622  <<" ("<<(xover->first - prevLoc)<<" loc) on side "<<xover->second<<std::endl;
2623 #endif
2624 
2625  ind->copy_sequence_block(SEX, xover->second, prevLoc, xover->first, parent);
2626 
2627  prevLoc = xover->first;
2628 
2629  xover++;
2630  }
2631 }
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:1312
static GeneticMap _map
Definition: ttrait_with_map.h:227
unsigned int _mapIndex
Definition: ttrait_with_map.h:211
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, 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.

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

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.

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

References _stats, and StatServices::attach().

◆ mutate()

void TProtoQuanti::mutate ( TTQuanti ind)
inline
2653 {
2654  (this->*_mutation_func_ptr)(ind);
2655 }

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
2875 {
2876  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2877  unsigned int mut_locus, mut_all;
2878 
2879  while(NbMut != 0) {
2880 
2881  mut_locus = RAND::Uniform(_num_locus);
2882  mut_all = RAND::RandBool();
2883 
2884  // here just flips the bit at the mutating allele, value argument is ignored
2885  ind->mutate_inplace( mut_locus, mut_all, 1);
2886 
2887  NbMut--;
2888  }
2889 
2890 }
unsigned int get_num_mutations()
Definition: ttquanti.h:541
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
2809 {
2810  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2811  unsigned int mut_locus, mut_all, pos;
2812  bool allele;
2813 
2814  while(NbMut != 0) {
2815 
2816  mut_locus = RAND::Uniform(_num_locus);
2817  mut_all = RAND::RandBool(); // which of the two copies is mutated
2818 
2819  pos = mut_locus*_num_traits; //where it stands in the sequence (full pleio)
2820 
2821  allele = !(ind->get_allele_bit(pos, mut_all));
2822 
2823  // flip the bit, mutate to the alt. allele
2824  ind->mutate_inplace( pos, mut_all, allele);
2825 
2826  // There cannot be more than two traits in this case, as set during startup
2827  // set second value:
2828  pos++;
2829  // The allele affecting the second trait may receive the same mutation depending on the
2830  // mutational correlation
2832  ind->set_allele_bit(pos, mut_all, allele); // calling ind->mutate_add(pos,...) would be equivalent
2833  else
2834  ind->set_allele_bit(pos, mut_all, RAND::RandBool()); // may or may not flip the bit, avoids spurious correlation
2835 
2836  NbMut--;
2837  }
2838 
2839 }
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
2844 {
2845  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2846  unsigned int mut_locus, mut_all, pos;
2847 
2848  while(NbMut != 0) {
2849 
2850  mut_locus = RAND::Uniform(_num_locus);
2851  mut_all = RAND::RandBool();
2852 
2853  pos = _locus_table[mut_locus][0];
2854 
2855  ind->mutate_inplace(pos, mut_all, 1); // value argument is ignored, flips the bit
2856 
2857  if(_locus_table[mut_locus][1] == 2) { // only degree of pleiotropy allowed
2858 
2859  pos++;
2860 
2862  ind->set_allele_bit(pos, mut_all, ind->get_allele_bit(pos-1, mut_all));
2863  else
2864  ind->set_allele_bit(pos, mut_all, RAND::RandBool()); //avoids spurious correlations
2865  }
2866 
2867  NbMut--;
2868  }
2869 
2870 }

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
2688 {
2689  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2690  unsigned int mut_locus, mut_all, pos;
2691  double *effects;
2692 
2693  while(NbMut != 0) {
2694  mut_locus = RAND::Uniform(_num_locus);
2695  mut_all = RAND::RandBool();
2696 
2697  effects = (this->*_getMutationValues)(mut_locus);
2698 
2699  pos = mut_locus*_num_traits;
2700 
2701  //cycle through all alleles at the mutated locus, depending on the PD of the locus
2702  for(unsigned int i = 0; i < _num_traits; ++i, ++pos) {
2703  ind->mutate_add( pos, mut_all, effects[i]);
2704  }
2705 
2706  NbMut--;
2707  }
2708 
2709 }
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
2760 {
2761  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2762  unsigned int mut_locus, mut_all, pos;
2763  double *effects;
2764 
2765  while(NbMut != 0) {
2766  mut_locus = RAND::Uniform(_num_locus);
2767  mut_all = RAND::RandBool();
2768 
2769  effects = (this->*_getMutationValues)(mut_locus);
2770 
2771  pos = mut_locus*_num_traits; //start location of the locus in the sequence
2772 
2773  //cycle through all alleles at the mutated locus, depending on the PD of the locus
2774  for(unsigned int i = 0; i < _num_traits; ++i, ++pos) {
2775  ind->mutate_inplace( pos, mut_all, effects[i]);
2776  }
2777 
2778  NbMut--;
2779  }
2780 }

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
2740 {
2741  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2742  unsigned int mut_locus, mut_all;
2743  double *effects;
2744 
2745  while(NbMut != 0) {
2746  mut_locus = RAND::Uniform(_num_locus);
2747  mut_all = RAND::RandBool();
2748 
2749  effects = (this->*_getMutationValues)(mut_locus);
2750 
2751  ind->mutate_inplace( mut_locus, mut_all, effects[0]);
2752 
2753  NbMut--;
2754  }
2755 }

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
2785 {
2786  unsigned int NbMut = get_num_mutations(); //RAND::Poisson(_genomic_mutation_rate);
2787  unsigned int mut_locus, mut_all, pos;
2788  double *effects;
2789 
2790  while(NbMut != 0) {
2791  mut_locus = RAND::Uniform(_num_locus);
2792  mut_all = RAND::RandBool();
2793 
2794  effects = (this->*_getMutationValuesVarPleio[mut_locus])(mut_locus);
2795 
2796  pos = _locus_table[mut_locus][0];
2797 
2798  for(unsigned int i = 0; i < _locus_table[mut_locus][1]; ++i, ++pos){
2799  ind->mutate_inplace( pos, mut_all, effects[i]);
2800  }
2801 
2802  NbMut--;
2803  }
2804 }

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
2660 {
2661  //nill
2662 }

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
2667 {
2668  unsigned int NbMut = get_num_mutations(); //(unsigned int)RAND::Poisson(_genomic_mutation_rate);
2669  unsigned int mut_locus, mut_all;
2670  double *effects;
2671 
2672  while(NbMut != 0) {
2673  mut_locus = RAND::Uniform(_num_locus);
2674  mut_all = RAND::RandBool();
2675 
2676  effects = (this->*_getMutationValues)(mut_locus);
2677 
2678  ind->mutate_add( mut_locus, mut_all, effects[0]);
2679 
2680  NbMut--;
2681  }
2682 
2683 }

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

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

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

References TTProtoWithMap::reset().

◆ resetParameterFromSource()

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

Implements SimComponent.

595 {return false;}

◆ retrieve_data()

virtual bool TProtoQuanti::retrieve_data ( BinaryStorageBuffer reader)
inlinevirtual

Implements StorableComponent.

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

References _seq_length, and BinaryStorageBuffer::read().

◆ set_eVarianceSD()

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

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

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

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 
)
2500 {
2501  assert(nval == _num_traits);
2502 
2503  _init_value.reset(1, _num_traits, values);
2504 
2505 }
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:159

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

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)
678 {
679  if(withVe)
681  else
683 }
double set_trait_value_VE(const TTQuanti *ind, const unsigned int trait)
Definition: ttquanti.cc:2509
double set_trait_value_noVE(const TTQuanti *ind, const unsigned int trait)
Definition: ttquanti.cc:2516

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
2517 {
2518  return (this->*_set_genotype_func_ptr)(ind, trait);
2519 }

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
2510 {
2511  return set_trait_value_noVE(ind, trait) + RAND::Gaussian( _eVariance[trait] );
2512 }

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

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

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

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

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

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

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

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 ( )
647  {
648 
649  //bypass the genetic map for free recombination to save significant time:
650  //this is done whenever the recombination rate is set to 0.5
651 
652  if( TTProtoWithMap::isRecombinationFree("quanti")) { //test all possible options to set recomb rate = 0.5
653 
655 
657 
658  //necessary for the inherit_free function:
659  if(_all_chooser) delete [] _all_chooser;
660  _all_chooser = new bool[_num_locus];
661 
662  } else {
663  // loci are not independent, ie recomb rate < 0.5
664 
665  // the loci positions will be registered in the genetic map
666  if( !setGeneticMapParameters("quanti", _num_locus) ) return false;
667 
669 
670  }
671 
672  return true;
673 }
void inherit_low(sex_t SEX, TTQuanti *ind, const TTQuanti *parent)
Definition: ttquanti.cc:2599
void inherit_free(sex_t SEX, TTQuanti *ind, const TTQuanti *parent)
Definition: ttquanti.cc:2635
double _recombRate
Definition: ttrait_with_map.h:213
bool setGeneticMapParameters(string prefix, unsigned int numLoci=0)
Definition: ttrait_with_map.cc:124
bool isRecombinationFree(string prefix)
Definition: ttrait_with_map.cc:97

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

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

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

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 ( )
868 {
869 
870  //store a few important numbers
872 
873  // memory size of a single allele value
874 // _sizeofLocusType = sizeof(double); --> this is set in setParameters() depending on the allele type
875 
876  // size of data used to store pleiotropic allelic values at a locus
878 
879  // mutation correlation set from "quanti_mutation_correlation"
880  if(!setMutationCorrelation()) return false;
881 
882  // set the set trait/locus_table, will be used by stat and file handlers to access data
884 
885  if( _allele_model == 1 || _allele_model ==2 ) {
886  //---------------------------------------------------------------------------------------
887  // DIALLELIC LOCI
888 
889  if (_num_traits > 2) { // multivariate models, only for non-diallelic loci
890 
891  return error("quant::the di-allelic model with pleiotropy is only allowed for max. 2 quantitative traits.\n");
892 
893  } else { // there are 2 traits, otherwise the "no_pleio" version of the function is called
894 
895  if(!setDiallelicMutationModel()) return false;
896 
898 
899  }
900 
901  } else {
902  //---------------------------------------------------------------------------------------
903  // CONTIUUM OF ALLELE MODEL
904 
905  if(!setContinuousMutationModel_full_pleio()) return false;
906 
907  if (_num_traits == 2) { // bivariate models, only for non-diallelic loci
908 
911  else
913 
914 
915  } else if (_num_traits > 2) { // multivariate models, only for non-diallelic loci
916 
919  else
921 
922  }
923  }
924 
925  // SET POINTER TO MUTATE FUNCTION
926 
927  if(_genomic_mutation_rate == 0) {
928 
930 
931  } else if(_allele_model <= 2) { // diallelic models
932 
934 
935  } else if(_allele_model == 3) { // continuous
937  } else // continuous in-place
939 
940 
941  return true;
942 }
double * getMutationEffectMultivariateGaussian(unsigned int loc)
Definition: ttquanti.cc:2388
void setTraitAndLocusTables_full_pleio()
Definition: ttquanti.cc:1271
void mutate_nill(TTQuanti *ind)
Definition: ttquanti.cc:2659
double * getMutationEffectBivariateGaussian(unsigned int loc)
Definition: ttquanti.cc:2412
void mutate_inplace_full_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2759
double * getMutationEffectBivariateDiallelic(unsigned int loc)
Definition: ttquanti.cc:2455
void mutate_diallelic_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2808
double * getMutationEffectBivariateGaussianLocSpec(unsigned int loc)
Definition: ttquanti.cc:2422
double * getMutationEffectMultivariateGaussianLocSpec(unsigned int loc)
Definition: ttquanti.cc:2400
bool setDiallelicMutationModel()
Definition: ttquanti.cc:1346
bool setMutationCorrelation()
Definition: ttquanti.cc:1862
void mutate_full_pleio(TTQuanti *ind)
Definition: ttquanti.cc:2687
bool setContinuousMutationModel_full_pleio()
Definition: ttquanti.cc:1500

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

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

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

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

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.

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

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

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.

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

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.2 by  doxygen 1.9.1

Catalogued on GSR