Nemo  2.3.46
ttneutralgenes.h
Go to the documentation of this file.
1 
29 #ifndef TTNEUTRALGENES_H
30 #define TTNEUTRALGENES_H
31 
32 #include <cmath>
33 #include <vector>
34 #include "ttrait_with_map.h"
35 #include "types.h"
36 #include "filehandler.h"
37 #include "stathandler.h"
38 #include "datatable.h"
39 #include "metapop.h"
40 #include "binarystoragebuffer.h"
41 
42 class TTNeutralGenesFH;
43 class TTNeutralGenesSH;
44 class TTNtrlPhenotyperFH;
45 class TProtoNeutralGenes;
46 // ----------------------------------------------------------------------------------------
47 
48 // N E U T R A L T R A I T
49 
50 // ----------------------------------------------------------------------------------------
52 class TTNeutralGenes : public TTrait
53 {
54 private:
56  //parameters:
57  unsigned int _allele_num;
58  unsigned int _locus_num;
59  unsigned int _ploidy;
60  double _mut_rate;
61  double _recomb_rate;
62  unsigned int _mut_model;
63  unsigned int _2L; //genome size (ploidy*num_locus)
64  unsigned short _init_model;
65  void (TTNeutralGenes::* _mutate_func_ptr) (void);
66  void (TProtoNeutralGenes::* _inherit_func_ptr) (sex_t, unsigned char*, unsigned char**);
67 
68  //_sequence:
69  unsigned char** _sequence; // ordered as [ploidy][locus]
70 
71  const trait_t _type;
72 
73 public:
74 
76  : _myProto(0),_allele_num(0),_locus_num(0),_ploidy(2),_mut_rate(0),_recomb_rate(0),_mut_model(0),
77  _init_model(0), _mutate_func_ptr(0), _inherit_func_ptr(0), _sequence(0), _type(NTRL) { }
78 
80  : _myProto(T._myProto),
81  _allele_num(T._allele_num), _locus_num(T._locus_num), _ploidy(2), _mut_rate(T._mut_rate),
82  _recomb_rate(T._recomb_rate),_mut_model(T._mut_model), _2L(T._2L),
83  _init_model(T._init_model),_mutate_func_ptr(T._mutate_func_ptr), _inherit_func_ptr(T._inherit_func_ptr),
84  _sequence(0), _type(NTRL) { }
85 
86  virtual ~TTNeutralGenes ();
87 
90  unsigned int get_ploidy ( ) {return _ploidy;}
91  unsigned int get_locus_num ( ) {return _locus_num;}
92  unsigned int get_allele_num ( ) {return _allele_num;}
93 
94  void set_proto (TProtoNeutralGenes* proto) {_myProto = proto;}
95  void set_locus_num (int value) {_locus_num = value;}
96  void set_allele_num (int value) {_allele_num = value;}
97  void set_mut_rate (double value) {_mut_rate = value;}
98  void set_2L (unsigned int val) {_2L = val;}
99  void set_recomb_rate (double value) {_recomb_rate = value;}
100  void set_mut_model (int value) {_mut_model = value;}
101  void set_init_model (unsigned short val) {_init_model = val;}
102  void set_mut_func_ptr (void(TTNeutralGenes::* theFunc)(void))
103  {_mutate_func_ptr = theFunc;}
104  void set_inherit_func_ptr (void(TProtoNeutralGenes::* theFunc)(sex_t, unsigned char*, unsigned char**))
105  {_inherit_func_ptr = theFunc;}
106  void set_allele (unsigned int loc, unsigned int al, unsigned char val) {_sequence[al][loc] = val;}
108 
109  // static void set_recomb_template (unsigned int size);
110 
113  void mutate_SSM ( );
114  void mutate_KAM ( );
115  void mutate_2all ( );
116  void mutate_NULL ( ) { }
120  virtual TTNeutralGenes& operator= (const TTrait& T);
121  virtual bool operator== (const TTrait& T);
122  virtual bool operator!= (const TTrait& T);
123  virtual void init ( );
124  virtual void init_sequence ( );
125  virtual void reset ( );
126  virtual void* set_trait (void* value) {return NULL;}
127  inline virtual void** get_sequence ( ) const {return (void**)_sequence;}
128  virtual double get_allele_value (int loc, int all)
129  {return ( !(loc<(int)_locus_num) || !(all<(int)_ploidy) ? 0 : (double)_sequence[all][loc]);}
130  virtual void set_allele_value (unsigned int locus, unsigned int allele, double value)
131  {assert(locus < _locus_num && allele < 2); _sequence[allele][locus] = (unsigned char)value;}
132  virtual void set_sequence (void** seq);
133  inline virtual trait_t get_type ( ) const {return _type;}
134  virtual void set_value ( ) { }
135  virtual void* getValue ( ) const {return 0;}
136  virtual void inherit (TTrait* mother, TTrait* father);
137  virtual void mutate ( ) {(this->*_mutate_func_ptr) ();}
138  virtual void show_up ( );
139  virtual TTNeutralGenes* clone ( ) {return new TTNeutralGenes(*this);}
140 
141  //implements StorableComponent
142  virtual void store_data (BinaryStorageBuffer* saver)
143  {
144  for(unsigned int i = 0; i < _locus_num; ++i)
145  for(unsigned int j = 0; j < _ploidy; ++j)
146  saver->store(&_sequence[j][i], 1);
147  }
148  virtual bool retrieve_data (BinaryStorageBuffer* reader)
149  {
150  for(unsigned int i = 0; i < _locus_num; ++i)
151  for(unsigned int j = 0; j < _ploidy; ++j)
152  reader->read(&_sequence[j][i], 1);
153  return true;
154  }
156 };
157 // ----------------------------------------------------------------------------------------
158 
159 // N E U T R A L T R A I T P R O T O T Y P E
160 
161 // ----------------------------------------------------------------------------------------
164 private:
165  unsigned int _allele_num;
166  unsigned int _locus_num;
167  unsigned int _ploidy;
168  double _mut_rate;
170  unsigned short _init_model;
171  double _recomb_rate;
173  void (TProtoNeutralGenes::* _inherit_func_ptr) (sex_t, unsigned char*, unsigned char**);
174 
175  vector< TTNeutralGenesFH* > _writers;
177  const trait_t _type;
178 
179 public:
180 
181  TProtoNeutralGenes ( );
182 
184 
185  virtual ~TProtoNeutralGenes ( );
186 
187  unsigned int get_ploidy ( ) {return _ploidy;}
188  unsigned int get_locus_num ( ) {return _locus_num;}
189  unsigned int get_allele_num ( ) {return _allele_num;}
190 
192 
193  void inherit_low (sex_t SEX, unsigned char* seq, unsigned char** parent);
194  void inherit_free (sex_t SEX, unsigned char* seq, unsigned char** parent);
195 
196  //implementation of TraitPrototype:
197  virtual void init (){}
198 
199  virtual void reset (){TTProtoWithMap::reset();}
200 
201  virtual TTNeutralGenes* hatch ();
202 
203  virtual TProtoNeutralGenes* clone () {return new TProtoNeutralGenes(*this);}
204 
205  virtual trait_t get_type () const {return _type;}
206  //implementation of SimComponent:
207  virtual bool setParameters();
208 
209  virtual void loadFileServices ( FileServices* loader );
210 
211  virtual void loadStatServices ( StatServices* loader );
212 
213  //implementation of StorableComponent:
214  virtual void store_data ( BinaryStorageBuffer* saver ) {saver->store(&_locus_num,sizeof(int));}
215 
216  virtual bool retrieve_data ( BinaryStorageBuffer* reader );
217 };
218 
219 // ----------------------------------------------------------------------------------------
220 
221 // N E U T R A L T R A I T F I L E H A N D L E R
222 
223 // ----------------------------------------------------------------------------------------
224 
231 class TTNeutralGenesFH: public TraitFileHandler<TProtoNeutralGenes> {
232 
234 
236 
237 public:
238 
240  : TraitFileHandler<TProtoNeutralGenes> (TP, ".txt")
241  { }
242 
243  virtual ~TTNeutralGenesFH ( ) { }
244 
245  virtual void FHwrite (); // { (this->*write_fct)(); }
246 
247  virtual void FHread (string& filename);
248 
249  void write_TAB();
250  void write_GENEPOP();
251  void write_FSTAT();
252  void write_Fst_i();
253  void write_freq();
254  void write_varcompWC();
255 
256  void setOutputOption(string opt);
257  void set_write_fct( void (TTNeutralGenesFH::* fct_ptr) () ) {write_fct = fct_ptr;}
258 
259 };
260 
261 // ----------------------------------------------------------------------------------------
262 
263 // N E U T R A L T R A I T S T A T H A N D L E R
264 
265 // ----------------------------------------------------------------------------------------
266 
268 class TTNeutralGenesSH: public TraitStatHandler<TProtoNeutralGenes, TTNeutralGenesSH> {
269 
275 
279 
281  double _sib_prop[4];
282  double _sib_coa[4];
283 
288  double _fst_WH;
293 
294  double _fst_W1, _fst_W2;
297 
298  //Nei's genetic distance:
300  double _meanD;
301 
302 public:
303 
305  : TraitStatHandler<TProtoNeutralGenes, TTNeutralGenesSH>(TP), _table_set_gen(0), _table_set_age(0),
306  _table_set_repl(0), _coa_matrix(0), _fst_WC_loc(0), _fis_WC_loc(0), _fit_WC_loc(0), _fst_matrix(0),
307  _D(0)
308  { }
309 
310  virtual ~TTNeutralGenesSH ( )
311  {
312  if(_coa_matrix != NULL) delete _coa_matrix;
313  if(_fst_matrix != NULL) delete _fst_matrix;
314  if(_fst_WC_loc) delete[]_fst_WC_loc;
315  if(_fis_WC_loc) delete[]_fis_WC_loc;
316  if(_fit_WC_loc) delete[]_fit_WC_loc;
317  if(_D != NULL) delete _D;
318  }
319 
320  virtual void init ( ) ;
321 
322  virtual bool setStatRecorders (std::string& token);
323 
324  void setFreqRecorders (age_t AGE);
325  void setFreqRecordersPerPatch (age_t AGE);
326  void setFstatRecorders (age_t AGE);
327  void setFstat2Recorders (age_t AGE);
328  void setFstatWCRecorders (age_t AGE);
329  void setCoaMatrixRecorders (age_t AGE, unsigned char dim);
330  void setFstMatrixRecorders (age_t AGE, unsigned char dim);
331  void setNeiGeneticDistanceRecorders (age_t AGE, bool pairwise);
332  void setDxyRecorders (age_t AGE, bool patchwise);
333 
338  void setHeterozygosity (age_t AGE);
341 
342  double getGlobalAlleleFreq (unsigned int loc, unsigned int all) {
343  return _globalAlleleFreq.get(loc, all);
344  }
345 
346  double getHeterozygosity (unsigned int loc) {
347  double het = 0;
348  for(unsigned int i = 0; i < _heteroTable.getNumGroups(); ++i )
349  het += _heteroTable.get(i, loc, 0);
350  return het/_heteroTable.getNumGroups(); //mean per patch heterozygosity
351  }
352 
356  void setAlleleTables (age_t AGE);
357  void setHeteroTable (age_t AGE);
358  void allocateTables (unsigned int loci, unsigned int all);
359 
362 
364 
366 
369 
379  void setFstMatrix (age_t AGE, unsigned char dim);
388  double getWeightedFst () {return _fst_WH;}
390  double getFst_ij (unsigned int i)
391  {
392  unsigned int scale = (unsigned int)pow( 10.0, (int)log10((float)_fst_matrix->getNbCols()) + 1 );
393  return _fst_matrix->get(i/scale, i%scale);
394  }
396  void setFst_li(unsigned int N, unsigned int L, double **array);
397 // /**Computes raw Fst following the original definition (=var(p)/p_bar(1 - p_bar)).*/
398 // double getFstWright(unsigned int i) {if(i == 1) return _fst_W1; else return _fst_W2;}
399 
401  void setFstat (age_t AGE);
404  double setHo (age_idx age_pos);
405  double setHs (age_idx age_pos);
406  double setHt (age_idx age_pos);
407  double getHsnei () {return _hsnei;}
408  double getHtnei () {return _htnei;}
409  double getHo () {return _ho;}
410  double getHs () {return _hs;}
411  double getHt () {return _ht;}
412  double getFst () {return _fst;}
413  double getFis () {return _fis;}
414  double getFit () {return _fit;}
416  void setFstat2 (age_t AGE);
419  deque<double> setHo2 (age_idx age_pos);
420  deque<double> setHs2 (age_idx age_pos);
421  deque<double> setHt2 (age_idx age_pos);
422 
424  void setFstatWeirCockerham (age_t AGE);
425  void setFstatWeirCockerham_MS (age_t AGE);
428  double getFstWC () {return _fst_WC;}
429  double getFisWC () {return _fis_WC;}
430  double getFitWC () {return _fit_WC;}
432  void setLociDivCounter (age_t AGE);
433  double getNbAllLocal () {return _nb_all_local;}
434  double getNbAllGlobal () {return _nb_all_global;}
435  double getFixLocLocal () {return _fix_loc_local;}
436  double getFixLocGlobal () {return _fix_loc_global;}
440 
447  double Coancestry (void** ind1, void** ind2, unsigned int nb_locus);
455  void setCoaMatrix (age_idx age_pos, unsigned char dim);
462  void setAdults_Theta ();
463 
468  double getCoa (unsigned int i)
469  {
470  unsigned int scale = (unsigned int)pow( 10.0, (int)log10((float)_coa_matrix->getNbCols()) + 1 );
471  return _coa_matrix->get(i/scale, i%scale);
472  }
473  double getMeanTheta () {return _mean_theta;}
474  double getMeanAlpha () {return _mean_alpha;}
476  double getTheta_FF () {return Theta_FF;}
478  double getTheta_MM () {return Theta_MM;}
480  double getTheta_FM () {return Theta_FM;}
481  void setSibStats ();
482  void setSibCoa (Individual *I1, Individual *I2);
483  double getSibProportions (unsigned int i) {return _sib_prop[i];}
484  double getSibCoaMeans (unsigned int i) {return _sib_coa[i];}
486 
491  void setNeiGeneticDistance (age_t AGE);
492  double getNeiGeneticDistance (unsigned int i)
493  {
494  unsigned int scale = (unsigned int)pow( 10.0, (int)log10((float)_D->getNbCols()) + 1 );
495  return _D->get(i/scale,i%scale);
496  }
497  double getMeanNeiGeneticDistance ( ) {return _meanD;}
499 
502  double getDxyOffspringPerPatch (unsigned int patch1, unsigned patch2) {return getDxyPerPatch(OFFSx, patch1, patch2);}
503  double getDxyAdultPerPatch (unsigned int patch1, unsigned patch2) {return getDxyPerPatch(ADLTx, patch1, patch2);}
504  double getDxyPerPatch (age_idx age, unsigned int patch1, unsigned patch2);
505  double getDxy (unsigned int age_class);
507 };
508 
509 
510 #endif //TTNEUTRALGENES_H
511 
double _ho
F-statistics.
Definition: ttneutralgenes.h:285
double getHsnei()
Definition: ttneutralgenes.h:407
virtual TTNeutralGenes * hatch()
Definition: ttneutralgenes.cc:273
Template class for the trait's FileHandler.
Definition: filehandler.h:217
void setHeteroTable(age_t AGE)
Definition: stats_fstat.cc:166
virtual ~TTNeutralGenesSH()
Definition: ttneutralgenes.h:310
double _fix_loc_local
Definition: ttneutralgenes.h:285
double _fst_W2
Definition: ttneutralgenes.h:294
void setSibCoa(Individual *I1, Individual *I2)
Definition: stats_coa.cc:350
void set_write_fct(void(TTNeutralGenesFH::*fct_ptr)())
Definition: ttneutralgenes.h:257
virtual TProtoNeutralGenes * clone()
Definition: ttneutralgenes.h:203
virtual void set_value()
Definition: ttneutralgenes.h:134
unsigned int getNumGroups()
Definition: datatable.h:258
The Service class used to manage the StatHandler objects.
Definition: statservices.h:50
double * _fst_WC_loc
Per-locus F-stats (Weir&Cockerham).
Definition: ttneutralgenes.h:292
void setFstatWCRecorders(age_t AGE)
Definition: ttneutralgenes.cc:1934
unsigned int _ploidy
Definition: ttneutralgenes.h:167
void set_mut_rate(double value)
Definition: ttneutralgenes.h:97
double getHeterozygosity(unsigned int loc)
Definition: ttneutralgenes.h:346
virtual trait_t get_type() const
Definition: ttneutralgenes.h:133
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
std::string trait_t
Trait types.
Definition: types.h:63
double _recomb_rate
Definition: ttneutralgenes.h:61
void(TProtoNeutralGenes::* _inherit_func_ptr)(sex_t, unsigned char *, unsigned char **)
Definition: ttneutralgenes.h:173
virtual trait_t get_type() const
Definition: ttneutralgenes.h:205
void allocateTables(unsigned int loci, unsigned int all)
Definition: stats_fstat.cc:43
double getNbAllGlobal()
Definition: ttneutralgenes.h:434
void setOffsprgFstat()
Definition: ttneutralgenes.h:402
void setAdultHeterozygosity()
Definition: ttneutralgenes.h:339
void write_varcompWC()
Definition: ttneutralgenes.cc:1207
double getDxyOffspringPerPatch(unsigned int patch1, unsigned patch2)
Definition: ttneutralgenes.h:502
void setFstatRecorders(age_t AGE)
Definition: ttneutralgenes.cc:1878
void set_allele(unsigned int loc, unsigned int al, unsigned char val)
Definition: ttneutralgenes.h:106
void setFstatWeirCockerham(age_t AGE)
Computes the Weir & Cockerham (1984) Fstat values (Theta, F, and f).
Definition: stats_fstat.cc:771
void set_init_model(unsigned short val)
Definition: ttneutralgenes.h:101
age_idx
Array index of the age classes in the patch sizes and containers arrays.
Definition: types.h:41
double Theta_FF
Definition: ttneutralgenes.h:276
double getNbAllLocal()
Definition: ttneutralgenes.h:433
virtual void store_data(BinaryStorageBuffer *saver)
Definition: ttneutralgenes.h:214
virtual void FHread(string &filename)
Definition: ttneutralgenes.cc:961
unsigned short _init_model
Definition: ttneutralgenes.h:64
double _nb_all_global
Definition: ttneutralgenes.h:285
virtual bool operator==(const TTrait &T)
Definition: ttneutralgenes.cc:407
double getCoa(unsigned int i)
Gets the given coancestry coefficient from the coancestry matrix.
Definition: ttneutralgenes.h:468
unsigned int getNbCols()
Gives the number of columns.
Definition: tmatrix.h:142
void setCoaMatrix(age_idx age_pos, unsigned char dim)
Computes the within and between patches coancestry coefficients.
Definition: stats_coa.cc:59
virtual void init()
Definition: ttneutralgenes.h:197
void setAlleleTables(age_t AGE)
Definition: stats_fstat.cc:74
unsigned int _table_set_age
Definition: ttneutralgenes.h:274
void setFreqRecordersPerPatch(age_t AGE)
deque< double > setHt2(age_idx age_pos)
Definition: stats_fstat.cc:639
void(TTNeutralGenes::* _mutate_func_ptr)(void)
Definition: ttneutralgenes.h:172
virtual void init_sequence()
Definition: ttneutralgenes.cc:459
TMatrix * _fst_matrix
Pairwise Fst matrix.
Definition: ttneutralgenes.h:296
virtual bool setParameters()
Definition: ttneutralgenes.cc:92
virtual void store_data(BinaryStorageBuffer *saver)
Definition: ttneutralgenes.h:142
unsigned int get_allele_num()
Definition: ttneutralgenes.h:92
void write_freq()
Definition: ttneutralgenes.cc:1122
double _mean_theta
Definition: ttneutralgenes.h:277
unsigned int get_locus_num()
Definition: ttneutralgenes.h:91
double getGlobalAlleleFreq(unsigned int loc, unsigned int all)
Definition: ttneutralgenes.h:342
void inherit_low(sex_t SEX, unsigned char *seq, unsigned char **parent)
Definition: ttneutralgenes.cc:300
unsigned int age_t
Age class flags.
Definition: types.h:46
TTProtoWithMap.
Definition: ttrait_with_map.h:165
const trait_t _type
Definition: ttneutralgenes.h:71
double _hsnei
Definition: ttneutralgenes.h:285
double getFst_ij(unsigned int i)
Accessor to the Fst matrix as set by setFstMatrix().
Definition: ttneutralgenes.h:390
void setAdultsFstBetween()
Definition: ttneutralgenes.h:382
double getFit()
Definition: ttneutralgenes.h:414
unsigned int _mut_model
Definition: ttneutralgenes.h:62
virtual void * set_trait(void *value)
Definition: ttneutralgenes.h:126
Microsatellites genome.
Definition: ttneutralgenes.h:52
double getHt()
Definition: ttneutralgenes.h:411
double _fit
Definition: ttneutralgenes.h:285
void setHeterozygosity(age_t AGE)
Definition: stats_fstat.cc:225
virtual void init()
Definition: ttneutralgenes.cc:443
double _fis_WC
Definition: ttneutralgenes.h:290
virtual void loadFileServices(FileServices *loader)
Definition: ttneutralgenes.cc:148
double Theta_MM
Definition: ttneutralgenes.h:276
TProtoNeutralGenes * _myProto
Definition: ttneutralgenes.h:55
unsigned int get_ploidy()
Definition: ttneutralgenes.h:90
void write_TAB()
Definition: ttneutralgenes.cc:604
unsigned int get_ploidy()
Definition: ttneutralgenes.h:187
double setHt(age_idx age_pos)
Definition: stats_fstat.cc:455
void setLociDivCounter(age_t AGE)
Sets the allelic diversity counters.
Definition: stats_fstat.cc:295
virtual void ** get_sequence() const
Definition: ttneutralgenes.h:127
void(TTNeutralGenes::* _mutate_func_ptr)(void)
Definition: ttneutralgenes.h:65
double getHtnei()
Definition: ttneutralgenes.h:408
void setOutputOption(string opt)
Definition: ttneutralgenes.cc:950
double getTheta_MM()
Gives the mean within males coancestry coefficient.
Definition: ttneutralgenes.h:478
void setAdultsFstat()
Definition: ttneutralgenes.h:403
double getFstWC()
Definition: ttneutralgenes.h:428
TMatrix * getGlobalFreqs()
Accessor to the table of allele frequencies in the whole population.
Definition: ttneutralgenes.h:368
double get(unsigned int i, unsigned int j)
Accessor to element at row i and column j.
Definition: tmatrix.h:120
TMatrix _globalAlleleFreq
Definition: ttneutralgenes.h:273
double getMeanAlpha()
Definition: ttneutralgenes.h:474
Interface for all trait types, declares all basic trait operations.
Definition: ttrait.h:46
void write_FSTAT()
Definition: ttneutralgenes.cc:715
void set_mut_model(int value)
Definition: ttneutralgenes.h:100
void(TProtoNeutralGenes::* _inherit_func_ptr)(sex_t, unsigned char *, unsigned char **)
Definition: ttneutralgenes.h:66
int _mut_model
Definition: ttneutralgenes.h:169
double getMeanNeiGeneticDistance()
Definition: ttneutralgenes.h:497
void inherit_free(sex_t SEX, unsigned char *seq, unsigned char **parent)
Definition: ttneutralgenes.cc:292
void setAdultAlleleFreq()
Definition: ttneutralgenes.h:336
void setSibStats()
Definition: stats_coa.cc:279
virtual bool operator!=(const TTrait &T)
Definition: ttneutralgenes.cc:422
TTNeutralGenesFH(TProtoNeutralGenes *TP)
Definition: ttneutralgenes.h:239
double _meanD
Definition: ttneutralgenes.h:300
double getDxyPerPatch(age_idx age, unsigned int patch1, unsigned patch2)
Definition: stats_fstat.cc:1236
double getSibCoaMeans(unsigned int i)
Definition: ttneutralgenes.h:484
double getHo()
Definition: ttneutralgenes.h:409
void setAdultsCoaMatrix()
Definition: ttneutralgenes.h:456
virtual void * getValue() const
Definition: ttneutralgenes.h:135
double _sib_prop[4]
Kinship classes proportions.
Definition: ttneutralgenes.h:281
void store(void *stream, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:130
void set_locus_num(int value)
Definition: ttneutralgenes.h:95
deque< double > setHo2(age_idx age_pos)
Definition: stats_fstat.cc:545
unsigned char ** _sequence
Definition: ttneutralgenes.h:69
virtual void reset()
Definition: ttrait_with_map.cc:505
unsigned int _allele_num
Definition: ttneutralgenes.h:165
virtual void set_sequence(void **seq)
Definition: ttneutralgenes.cc:498
virtual bool retrieve_data(BinaryStorageBuffer *reader)
Definition: ttneutralgenes.h:148
double _fst_WH
Weir & Hill (2002) F-stat estimates.
Definition: ttneutralgenes.h:288
void setOffsprgNeiGeneticDistance()
Definition: ttneutralgenes.h:490
unsigned short _init_model
Definition: ttneutralgenes.h:170
void setAdltNeiGeneticDistance()
Definition: ttneutralgenes.h:489
double _mut_rate
Definition: ttneutralgenes.h:168
T get(unsigned int group, unsigned int Class, unsigned int elmnt)
Returns value stored of the element 'elmnt' of the class 'Class' in the group 'group'.
Definition: datatable.h:228
double setHs(age_idx age_pos)
Definition: stats_fstat.cc:410
virtual void reset()
Definition: ttneutralgenes.h:199
Template class for the trait's StatHandler.
Definition: stathandler.h:168
void setDxyRecorders(age_t AGE, bool patchwise)
Definition: ttneutralgenes.cc:2032
double getWeightedFst()
Returns the weighted Fst using Weir & Hill (2002) method.
Definition: ttneutralgenes.h:388
double _nb_all_local
Definition: ttneutralgenes.h:285
unsigned int _locus_num
Definition: ttneutralgenes.h:58
double getTheta_FM()
Gives the mean between males and females coancestry coefficient.
Definition: ttneutralgenes.h:480
double Theta_FM
Definition: ttneutralgenes.h:276
double getSibProportions(unsigned int i)
Definition: ttneutralgenes.h:483
double getFis()
Definition: ttneutralgenes.h:413
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36
double getDxy(unsigned int age_class)
Definition: stats_fstat.cc:1210
double _hs
Definition: ttneutralgenes.h:285
Definition: types.h:42
double _recomb_rate
Definition: ttneutralgenes.h:171
double getFitWC()
Definition: ttneutralgenes.h:430
#define NTRL
Definition: types.h:70
void setOffsprgCoaWithin()
Definition: ttneutralgenes.h:459
void setOffsprgCoaMatrix()
Definition: ttneutralgenes.h:457
double getTheta_FF()
Gives the mean within females coancestry coefficient.
Definition: ttneutralgenes.h:476
void set_proto(TProtoNeutralGenes *proto)
Definition: ttneutralgenes.h:94
TMatrix * _coa_matrix
Definition: ttneutralgenes.h:278
TMatrix * _D
Definition: ttneutralgenes.h:299
void setFstMatrixRecorders(age_t AGE, unsigned char dim)
Definition: ttneutralgenes.cc:1954
double getFixLocGlobal()
Definition: ttneutralgenes.h:436
virtual ~TProtoNeutralGenes()
Definition: ttneutralgenes.cc:81
virtual double get_allele_value(int loc, int all)
Definition: ttneutralgenes.h:128
string _output_option
Definition: ttneutralgenes.h:233
A class to store any kind of data in a char buffer before unloading it in a binary data file...
Definition: binarystoragebuffer.h:40
double _fst_WC
Weir & Cockerham (1984) F-stat estimates.
Definition: ttneutralgenes.h:290
DataTable< double > _alleleFreqTable
Definition: ttneutralgenes.h:271
void mutate_NULL()
Definition: ttneutralgenes.h:116
void set_inherit_func_ptr(void(TProtoNeutralGenes::*theFunc)(sex_t, unsigned char *, unsigned char **))
Definition: ttneutralgenes.h:104
unsigned int get_allele_num()
Definition: ttneutralgenes.h:189
unsigned int _2L
Definition: ttneutralgenes.h:63
void mutate_KAM()
Definition: ttneutralgenes.cc:557
void setOffsprgFstMatrix()
Definition: ttneutralgenes.h:383
TTNeutralGenes(const TTNeutralGenes &T)
Definition: ttneutralgenes.h:79
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
void setFst_li(unsigned int N, unsigned int L, double **array)
Computes the per-locus per-patch Fst values using Weir&Hill 2002 approach.
Definition: stats_fstat.cc:1057
void setAdultsFstatWeirCockerham()
Definition: ttneutralgenes.h:427
void setAdults_Theta()
Definition: stats_coa.cc:203
unsigned int _table_set_gen
Definition: ttneutralgenes.h:274
double Coancestry(void **ind1, void **ind2, unsigned int nb_locus)
Gives the coancestry (probability of identity by state) of two gene sequences.
Definition: stats_coa.cc:43
virtual void set_allele_value(unsigned int locus, unsigned int allele, double value)
Definition: ttneutralgenes.h:130
double * _fis_WC_loc
Definition: ttneutralgenes.h:292
void setAdultsFstWithin()
Definition: ttneutralgenes.h:381
void read(void *out, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:147
void setFstMatrix(age_t AGE, unsigned char dim)
Computes the weighted within and between patch Fst's as well as the overall Fst (Theta).
Definition: stats_fstat.cc:665
TProtoNeutralGenes()
Definition: ttneutralgenes.cc:46
virtual void show_up()
Definition: ttneutralgenes.cc:507
double _fis
Definition: ttneutralgenes.h:285
virtual ~TTNeutralGenes()
Definition: ttneutralgenes.cc:432
double _ht
Definition: ttneutralgenes.h:285
virtual void init()
Definition: ttneutralgenes.cc:1528
DataTable< unsigned int > * getAlleleCountTable()
Definition: ttneutralgenes.h:363
deque< double > setHs2(age_idx age_pos)
Definition: stats_fstat.cc:589
void setFstat2Recorders(age_t AGE)
Definition: ttneutralgenes.cc:1912
unsigned int _allele_num
Definition: ttneutralgenes.h:57
void setNeiGeneticDistanceRecorders(age_t AGE, bool pairwise)
Definition: ttneutralgenes.cc:2002
void setNeiGeneticDistance(age_t AGE)
Definition: stats_fstat.cc:1129
void setAdultsFstMatrix()
Definition: ttneutralgenes.h:380
const trait_t _type
Definition: ttneutralgenes.h:177
Definition: types.h:42
TTNeutralGenes()
Definition: ttneutralgenes.h:75
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
double getMeanTheta()
Definition: ttneutralgenes.h:473
double * _fit_WC_loc
Definition: ttneutralgenes.h:292
void setOffspringFstatWeirCockerham()
Definition: ttneutralgenes.h:426
virtual TTNeutralGenes & operator=(const TTrait &T)
Definition: ttneutralgenes.cc:380
void write_GENEPOP()
Definition: ttneutralgenes.cc:827
Prototype class for the TTNeutralGenes trait class.
Definition: ttneutralgenes.h:163
double _fit_WC
Definition: ttneutralgenes.h:290
void setOffspringHeterozygosity()
Definition: ttneutralgenes.h:340
virtual ~TTNeutralGenesFH()
Definition: ttneutralgenes.h:243
double _mean_alpha
Definition: ttneutralgenes.h:277
void setOffsprgFstat2()
Definition: ttneutralgenes.h:417
double getHs()
Definition: ttneutralgenes.h:410
void mutate_2all()
Definition: ttneutralgenes.cc:576
DataTable< double > * getAlleleFreqTable()
Accessor to the table of allele frequencies, per patch.
Definition: ttneutralgenes.h:361
double getNeiGeneticDistance(unsigned int i)
Definition: ttneutralgenes.h:492
virtual void FHwrite()
Definition: ttneutralgenes.cc:595
void write_Fst_i()
Definition: ttneutralgenes.cc:1059
void set_recomb_rate(double value)
Definition: ttneutralgenes.h:99
TTNeutralGenesSH(TProtoNeutralGenes *TP)
Definition: ttneutralgenes.h:304
DataTable< double > _heteroTable
Definition: ttneutralgenes.h:272
void(TTNeutralGenesFH::* write_fct)()
Definition: ttneutralgenes.h:235
virtual void mutate()
Definition: ttneutralgenes.h:137
DataTable< unsigned int > _alleleCountTable
Definition: ttneutralgenes.h:270
void setFstatWeirCockerham_MS(age_t AGE)
Definition: stats_fstat.cc:854
DataTable< double > * getHeteroTable()
Definition: ttneutralgenes.h:365
virtual bool setStatRecorders(std::string &token)
Definition: ttneutralgenes.cc:1537
double getFisWC()
Definition: ttneutralgenes.h:429
double getDxyAdultPerPatch(unsigned int patch1, unsigned patch2)
Definition: ttneutralgenes.h:503
unsigned int _ploidy
Definition: ttneutralgenes.h:59
double getFixLocLocal()
Definition: ttneutralgenes.h:435
void setOffspringAlleleFreq()
Definition: ttneutralgenes.h:337
The stat handler for neutral markers.
Definition: ttneutralgenes.h:268
virtual void loadStatServices(StatServices *loader)
Definition: ttneutralgenes.cc:260
A file handler to save the neutral markers genotypes in the FSTAT format (extended).
Definition: ttneutralgenes.h:231
A class to manage the files associated with each components of the simulation.
Definition: fileservices.h:51
void setAdultsCoaWithin()
Definition: ttneutralgenes.h:458
double _sib_coa[4]
Definition: ttneutralgenes.h:282
unsigned int get_locus_num()
Definition: ttneutralgenes.h:188
double _mut_rate
Definition: ttneutralgenes.h:60
void setOffsprgFstWithin()
Definition: ttneutralgenes.h:384
unsigned int _table_set_repl
Definition: ttneutralgenes.h:274
This class contains traits along with other individual information (sex, pedigree, etc. ).
Definition: individual.h:49
virtual bool retrieve_data(BinaryStorageBuffer *reader)
Definition: ttneutralgenes.cc:363
void setOffsprgFstBetween()
Definition: ttneutralgenes.h:385
void set_2L(unsigned int val)
Definition: ttneutralgenes.h:98
virtual void reset()
Definition: ttneutralgenes.cc:484
double setHo(age_idx age_pos)
Definition: stats_fstat.cc:363
double _fst_W1
Definition: ttneutralgenes.h:294
unsigned int _locus_num
Definition: ttneutralgenes.h:166
virtual void inherit(TTrait *mother, TTrait *father)
Definition: ttneutralgenes.cc:522
double _fst
Definition: ttneutralgenes.h:285
TTNeutralGenesSH * get_stater()
Definition: ttneutralgenes.h:191
void mutate_SSM()
Definition: ttneutralgenes.cc:534
double _htnei
Definition: ttneutralgenes.h:285
void setFstat2(age_t AGE)
New version of Nei & Chesser.
Definition: stats_fstat.cc:482
double getFst()
Definition: ttneutralgenes.h:412
void setAdultsCoaBetween()
Definition: ttneutralgenes.h:460
void setFreqRecorders(age_t AGE)
Definition: ttneutralgenes.cc:1846
TTNeutralGenesSH * _stats
Definition: ttneutralgenes.h:176
double _fix_loc_global
Definition: ttneutralgenes.h:285
vector< TTNeutralGenesFH * > _writers
Definition: ttneutralgenes.h:175
void set_mut_func_ptr(void(TTNeutralGenes::*theFunc)(void))
Definition: ttneutralgenes.h:102
void setAdultsFstat2()
Definition: ttneutralgenes.h:418
void setFstat(age_t AGE)
Computes raw Fst following the original definition (=var(p)/p_bar(1 - p_bar)).
Definition: stats_fstat.cc:254
void set_allele_num(int value)
Definition: ttneutralgenes.h:96
void setCoaMatrixRecorders(age_t AGE, unsigned char dim)
Definition: ttneutralgenes.cc:1790
virtual TTNeutralGenes * clone()
Definition: ttneutralgenes.h:139
void setOffsprgCoaBetween()
Definition: ttneutralgenes.h:461

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR