Nemo  2.3.46
TProtoNeutralGenes Class Reference

Prototype class for the TTNeutralGenes trait class. More...

#include <ttneutralgenes.h>

+ Inheritance diagram for TProtoNeutralGenes:
+ Collaboration diagram for TProtoNeutralGenes:

Public Member Functions

 TProtoNeutralGenes ()
 
 TProtoNeutralGenes (const TProtoNeutralGenes &T)
 
virtual ~TProtoNeutralGenes ()
 
unsigned int get_ploidy ()
 
unsigned int get_locus_num ()
 
unsigned int get_allele_num ()
 
TTNeutralGenesSHget_stater ()
 
void inherit_low (sex_t SEX, unsigned char *seq, unsigned char **parent)
 
void inherit_free (sex_t SEX, unsigned char *seq, unsigned char **parent)
 
virtual void init ()
 
virtual void reset ()
 
virtual TTNeutralGeneshatch ()
 
virtual TProtoNeutralGenesclone ()
 
virtual trait_t get_type () const
 
virtual bool setParameters ()
 
virtual void loadFileServices (FileServices *loader)
 
virtual void loadStatServices (StatServices *loader)
 
virtual void store_data (BinaryStorageBuffer *saver)
 
virtual bool retrieve_data (BinaryStorageBuffer *reader)
 
- Public Member Functions inherited from TTProtoWithMap
 TTProtoWithMap ()
 
 TTProtoWithMap (const TTProtoWithMap &TP)
 
virtual ~TTProtoWithMap ()
 
void setMapIndex (unsigned int idx)
 
unsigned int getMapIndex ()
 
bool setGeneticMapParameters (string prefix)
 
void addGeneticMapParameters (string prefix)
 
bool setRecombinationMapRandom ()
 
bool setRecombinationMapNonRandom (vector< vector< double > > *lociPositions)
 
bool setRecombinationMapFixed ()
 
bool setNumLociPerChromosome (string param_name)
 
void reset_recombination_pointers ()
 
void registerGeneticMap ()
 
- Public Member Functions inherited from TraitPrototype
virtual void set_index (int idx)
 Sets the traits index. More...
 
virtual int get_index ()
 Index getter. More...
 
- Public Member Functions inherited from StorableComponent
virtual ~StorableComponent ()
 
- Public Member Functions inherited from SimComponent
 SimComponent ()
 
virtual ~SimComponent ()
 
virtual void loadUpdaters (UpdaterServices *loader)
 Loads the parameters and component updater onto the updater manager. More...
 
virtual void set_paramset (ParamSet *paramset)
 Sets the ParamSet member. More...
 
virtual void set_paramset (std::string name, bool required, SimComponent *owner)
 Sets a new ParamSet and name it. More...
 
virtual void set_paramsetFromCopy (const ParamSet &PSet)
 Reset the set of parameters from a another set. More...
 
virtual ParamSetget_paramset ()
 ParamSet accessor. More...
 
virtual void add_parameter (Param *param)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd, ParamUpdaterBase *updater)
 Interface to add a parameter and its updater to the set. More...
 
virtual Paramget_parameter (std::string name)
 Param getter. More...
 
virtual double get_parameter_value (std::string name)
 Param value getter. More...
 
virtual string get_name ()
 Returnd the name of the ParamSet, i.e. More...
 

Private Attributes

unsigned int _allele_num
 
unsigned int _locus_num
 
unsigned int _ploidy
 
double _mut_rate
 
int _mut_model
 
unsigned short _init_model
 
double _recomb_rate
 
void(TTNeutralGenes::* _mutate_func_ptr )(void)
 
void(TProtoNeutralGenes::* _inherit_func_ptr )(sex_t, unsigned char *, unsigned char **)
 
vector< TTNeutralGenesFH * > _writers
 
TTNeutralGenesSH_stats
 
const trait_t _type
 

Additional Inherited Members

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

Detailed Description

Prototype class for the TTNeutralGenes trait class.

Constructor & Destructor Documentation

TProtoNeutralGenes::TProtoNeutralGenes ( )

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

Referenced by clone().

46  :_allele_num(0), _locus_num(0), _ploidy(2), _mut_rate(0),
48 _stats(0), _type(NTRL)
49 {
50  set_paramset("neutralgenes", false, this);
51 
52  add_parameter("ntrl_loci", INT, true, false, 0, 0);
53  add_parameter("ntrl_init_model", INT, false, true, 0, 2);
54  add_parameter("ntrl_all", INT, true, true, 2, 256);
55  add_parameter("ntrl_mutation_rate", DBL, true, true, 0, 1);
56  add_parameter("ntrl_mutation_model", INT, true, true, 0, 2);
57 
58  //genetic map parameters:
60 
61  //output
62  add_parameter("ntrl_save_genotype", STR, false, false, 0, 0);
63  add_parameter("ntrl_save_fsti", BOOL, false, false, 0, 0);
64  add_parameter("ntrl_save_freq", STR, false, false, 0, 0);
65  add_parameter("ntrl_output_dir", STR, false, false, 0, 0);
66  add_parameter("ntrl_output_logtime", INT, false, false, 0, 0);
67 }
unsigned int _ploidy
Definition: ttneutralgenes.h:167
void(TProtoNeutralGenes::* _inherit_func_ptr)(sex_t, unsigned char *, unsigned char **)
Definition: ttneutralgenes.h:173
void(TTNeutralGenes::* _mutate_func_ptr)(void)
Definition: ttneutralgenes.h:172
virtual void set_paramset(ParamSet *paramset)
Sets the ParamSet member.
Definition: simcomponent.h:86
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:112
int _mut_model
Definition: ttneutralgenes.h:169
Definition: types.h:78
unsigned int _allele_num
Definition: ttneutralgenes.h:165
void addGeneticMapParameters(string prefix)
Definition: ttrait_with_map.cc:77
unsigned short _init_model
Definition: ttneutralgenes.h:170
double _mut_rate
Definition: ttneutralgenes.h:168
#define NTRL
Definition: types.h:70
const trait_t _type
Definition: ttneutralgenes.h:177
Definition: types.h:78
Definition: types.h:78
unsigned int _locus_num
Definition: ttneutralgenes.h:166
TTNeutralGenesSH * _stats
Definition: ttneutralgenes.h:176
Definition: types.h:78
TProtoNeutralGenes::TProtoNeutralGenes ( const TProtoNeutralGenes T)

References SimComponent::_paramSet.

75 {
76  _paramSet = new ParamSet( *(T._paramSet) ) ;
77 }
unsigned int _ploidy
Definition: ttneutralgenes.h:167
void(TProtoNeutralGenes::* _inherit_func_ptr)(sex_t, unsigned char *, unsigned char **)
Definition: ttneutralgenes.h:173
void(TTNeutralGenes::* _mutate_func_ptr)(void)
Definition: ttneutralgenes.h:172
int _mut_model
Definition: ttneutralgenes.h:169
unsigned int _allele_num
Definition: ttneutralgenes.h:165
unsigned short _init_model
Definition: ttneutralgenes.h:170
double _mut_rate
Definition: ttneutralgenes.h:168
#define NTRL
Definition: types.h:70
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
const trait_t _type
Definition: ttneutralgenes.h:177
Parameters container, implemented in each SimComponent.
Definition: param.h:203
unsigned int _locus_num
Definition: ttneutralgenes.h:166
TTNeutralGenesSH * _stats
Definition: ttneutralgenes.h:176
TProtoNeutralGenes::~TProtoNeutralGenes ( )
virtual

References _stats, and _writers.

82 {
83  if(_stats != NULL) {delete _stats; _stats = NULL;}
84  for(unsigned int i = 0; i < _writers.size(); i++)
85  delete _writers[i];
86  _writers.clear();
87 
88 }
TTNeutralGenesSH * _stats
Definition: ttneutralgenes.h:176
vector< TTNeutralGenesFH * > _writers
Definition: ttneutralgenes.h:175

Member Function Documentation

virtual TProtoNeutralGenes* TProtoNeutralGenes::clone ( )
inlinevirtual

Implements TraitPrototype.

References TProtoNeutralGenes().

203 {return new TProtoNeutralGenes(*this);}
TProtoNeutralGenes()
Definition: ttneutralgenes.cc:46
unsigned int TProtoNeutralGenes::get_ploidy ( )
inline

References _ploidy.

Referenced by TTNeutralGenesFH::write_FSTAT(), TTNeutralGenesFH::write_GENEPOP(), and TTNeutralGenesFH::write_TAB().

187 {return _ploidy;}
unsigned int _ploidy
Definition: ttneutralgenes.h:167
TTNeutralGenesSH* TProtoNeutralGenes::get_stater ( )
inline

References _stats.

Referenced by TTNeutralGenesFH::write_freq(), TTNeutralGenesFH::write_Fst_i(), and TTNeutralGenesFH::write_varcompWC().

191 {return _stats;}
TTNeutralGenesSH * _stats
Definition: ttneutralgenes.h:176
virtual trait_t TProtoNeutralGenes::get_type ( ) const
inlinevirtual

Implements TraitPrototype.

References _type.

205 {return _type;}
const trait_t _type
Definition: ttneutralgenes.h:177
TTNeutralGenes * TProtoNeutralGenes::hatch ( )
virtual

Implements TraitPrototype.

References _allele_num, _inherit_func_ptr, _init_model, _locus_num, _mut_model, _mut_rate, _mutate_func_ptr, _ploidy, TTNeutralGenes::set_2L(), TTNeutralGenes::set_allele_num(), TTNeutralGenes::set_inherit_func_ptr(), TTNeutralGenes::set_init_model(), TTNeutralGenes::set_locus_num(), TTNeutralGenes::set_mut_func_ptr(), TTNeutralGenes::set_mut_model(), TTNeutralGenes::set_mut_rate(), and TTNeutralGenes::set_proto().

274 {
275  TTNeutralGenes* kid = new TTNeutralGenes();
276 
277  kid->set_proto(this);
282  kid->set_mut_rate(_mut_rate);
284  kid->set_2L(_ploidy*_locus_num);
286 
287  return kid;
288 }
unsigned int _ploidy
Definition: ttneutralgenes.h:167
void set_mut_rate(double value)
Definition: ttneutralgenes.h:97
void(TProtoNeutralGenes::* _inherit_func_ptr)(sex_t, unsigned char *, unsigned char **)
Definition: ttneutralgenes.h:173
void set_init_model(unsigned short val)
Definition: ttneutralgenes.h:101
void(TTNeutralGenes::* _mutate_func_ptr)(void)
Definition: ttneutralgenes.h:172
Microsatellites genome.
Definition: ttneutralgenes.h:52
void set_mut_model(int value)
Definition: ttneutralgenes.h:100
int _mut_model
Definition: ttneutralgenes.h:169
void set_locus_num(int value)
Definition: ttneutralgenes.h:95
unsigned int _allele_num
Definition: ttneutralgenes.h:165
unsigned short _init_model
Definition: ttneutralgenes.h:170
double _mut_rate
Definition: ttneutralgenes.h:168
void set_proto(TProtoNeutralGenes *proto)
Definition: ttneutralgenes.h:94
void set_inherit_func_ptr(void(TProtoNeutralGenes::*theFunc)(sex_t, unsigned char *, unsigned char **))
Definition: ttneutralgenes.h:104
void set_2L(unsigned int val)
Definition: ttneutralgenes.h:98
unsigned int _locus_num
Definition: ttneutralgenes.h:166
void set_mut_func_ptr(void(TTNeutralGenes::*theFunc)(void))
Definition: ttneutralgenes.h:102
void set_allele_num(int value)
Definition: ttneutralgenes.h:96
void TProtoNeutralGenes::inherit_free ( sex_t  SEX,
unsigned char *  seq,
unsigned char **  parent 
)
inline

References _locus_num, and RAND::RandBool().

Referenced by setParameters().

293 {
294  for(unsigned int i = 0; i < _locus_num; ++i)
295  seq[i] = parent[RAND::RandBool()][i];
296 }
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:139
unsigned int _locus_num
Definition: ttneutralgenes.h:166
void TProtoNeutralGenes::inherit_low ( sex_t  SEX,
unsigned char *  seq,
unsigned char **  parent 
)
inline

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

Referenced by setParameters().

301 {
302  register unsigned int prevLoc = 0, chrm_bloc;
303  register bool flipper;
304 
305  vector< unsigned int >& recTable = _map.getRecLoci(SEX, _mapIndex);
306  vector< bool > & firstRecPos = _map.getFirstRecPosition(SEX);
307 
308  unsigned int nbRec = recTable.size();
309 
310  // cout << "TProtoNeutralGenes::inherit_low; sex="<<SEX<<" nb Rec = "<<nbRec-1<<" (recLoc[0]="<<recTable[0]<<")"<<endl;
311 
312  // if (!nbRec) {
313  // memcpy(&seq[0], &parent[flipper][prevLoc], (recTable[rec] - prevLoc));
314  // return;
315  // }
316  for(unsigned int c = 0, stride = 0, rec = 0; c < _numChromosome; ++c) {
317 
318  flipper = firstRecPos[c];
319 
320  chrm_bloc = stride + _numLociPerChrmsm[c]; //number of loci considered so far
321 
322  prevLoc = stride; //stride is the first locus of a chromosome
323 
324  //do recombination chromosome-wise
325  // cout<<"chrm "<<c<<" side="<<firstRecPos[c]<<endl;
326 
327  for(; rec < nbRec && recTable[rec] < chrm_bloc; rec++) {
328 
329  // cout << " --copy from "<<prevLoc<<" to "<<recTable[rec]<<" (side="<<flipper<<")"<<endl;
330  // <<"("<<(recTable[rec] - prevLoc)<<" loc) on side "<<flipper<<endl;
331 
332  memcpy(&seq[prevLoc], &parent[flipper][prevLoc], (recTable[rec] - prevLoc));
333 
334  prevLoc = recTable[rec];
335 
336  flipper = !flipper;
337  }
338  // cout << "copy end of chrmsm from "<<prevLoc<<" to "<<chrm_bloc
339  // <<" ("<<(chrm_bloc - prevLoc)<<" loc) on side "<<flipper<<endl;
340  // cout << " --copy from "<<prevLoc<<" to "<<chrm_bloc<<" (side="<<flipper<<")"<<endl;
341  //copy what's left between the last x-over point and the end of the chrmsme
342  memcpy(&seq[prevLoc], &parent[flipper][prevLoc], (chrm_bloc - prevLoc));
343 
344  stride += _numLociPerChrmsm[c];
345 
346  }
347  // cout<<" done"<<endl;
348  // cout << "parent chromosomes:\n --0:";
349  // for(unsigned int i = 0; i < _locus_num; ++i)
350  // cout << (int)parent[0][i];
351  // cout << "\n --1:";
352  // for(unsigned int i = 0; i < _locus_num; ++i)
353  // cout << (int)parent[1][i];
354  // cout << "\ngamete:\n --0:";
355  // for(unsigned int i = 0; i < _locus_num; ++i)
356  // cout << (int)seq[i];
357  // cout << "\n";
358 
359 }
static GeneticMap _map
Definition: ttrait_with_map.h:190
vector< bool > & getFirstRecPosition(sex_t SEX)
Returns the vector of the first chromosome position for recombination, used for all traits...
Definition: ttrait_with_map.h:155
unsigned int * _numLociPerChrmsm
Definition: ttrait_with_map.h:181
unsigned int _numChromosome
Definition: ttrait_with_map.h:178
vector< unsigned int > & getRecLoci(sex_t SEX, unsigned int trait)
Returns a vector of the loci where crossing-overs take place.
Definition: ttrait_with_map.h:149
unsigned int _mapIndex
Definition: ttrait_with_map.h:174
virtual void TProtoNeutralGenes::init ( )
inlinevirtual
197 {}
void TProtoNeutralGenes::loadFileServices ( FileServices loader)
virtual

Implements SimComponent.

References _writers, FileServices::attach(), FileServices::attach_reader(), fatal(), SimComponent::get_parameter(), Param::getArg(), Param::getMatrix(), Param::getValue(), Param::isMatrix(), Param::isSet(), TraitFileHandler< TP >::set(), FileHandler::set_extension(), FileHandler::set_isInputHandler(), FileHandler::set_multi(), TTNeutralGenesFH::set_write_fct(), TTNeutralGenesFH::setOutputOption(), warning(), TTNeutralGenesFH::write_Fst_i(), TTNeutralGenesFH::write_FSTAT(), TTNeutralGenesFH::write_GENEPOP(), TTNeutralGenesFH::write_TAB(), and TTNeutralGenesFH::write_varcompWC().

149 {
150  TTNeutralGenesFH* writer;
151 
152  if(_writers.size() != 0) {
153  for(unsigned int i = 0; i < _writers.size(); i++)
154  delete _writers[i];
155  _writers.clear();
156  }
157  // --- THE READER ---
158  // note that this reader only reads in FSTAT format
159  //always add the reader:
160  writer = new TTNeutralGenesFH(this);
161  //set to read mode:
162  writer->set_isInputHandler(true);
163  //attach to file manager:
164  loader->attach_reader(writer);
165  //add to list of FileHandlers, will be deleted upon destruction
166  _writers.push_back( writer );
167 
168  // --- WRITERS ---
169  Param* param = get_parameter("ntrl_output_logtime");
170  TMatrix temp;
171  bool isMatrix = 0;
172 
173  if(param->isMatrix()) {param->getMatrix(&temp); isMatrix = 1;}
174 
175  if( get_parameter("ntrl_save_genotype")->isSet() ) {
176 
177  writer = new TTNeutralGenesFH(this);
178 
179  if(isMatrix) writer->set_multi(true, true, 1, &temp, get_parameter("ntrl_output_dir")->getArg());
180  // rpl_per, gen_per, rpl_occ, gen_occ, rank, path, self-ref
181  else writer->set(true, param->isSet(), 1, (param->isSet() ? (int)param->getValue() : 0), 0, get_parameter("ntrl_output_dir")->getArg(), this);
182 
183  if(get_parameter("ntrl_save_genotype")->getArg().length() == 0 || //default mode is tabular
184  get_parameter("ntrl_save_genotype")->getArg() == "TAB" ||
185  get_parameter("ntrl_save_genotype")->getArg() == "tab")
187  else if(get_parameter("ntrl_save_genotype")->getArg() == "FSTAT" || get_parameter("ntrl_save_genotype")->getArg() == "fstat") {
188  writer->set_write_fct( &TTNeutralGenesFH::write_FSTAT ); writer->set_extension(".dat");
189  } else if(get_parameter("ntrl_save_genotype")->getArg() == "GENEPOP" || get_parameter("ntrl_save_genotype")->getArg() == "genepop") {
191  } else
192  fatal("parameter \"ntrl_save_genotype\" options are \"TAB\", \"FSTAT\" or \"GENEPOP\".\n");
193 
194  loader->attach(writer);
195 
196  _writers.push_back( writer );
197  }
198 
199  if( get_parameter("ntrl_save_fsti")->isSet() ) {
200 
201  writer = new TTNeutralGenesFH(this);
202 
203  if(isMatrix) writer->set_multi(true, true, 1, &temp, get_parameter("ntrl_output_dir")->getArg());
204  // rpl_per, gen_per, rpl_occ, gen_occ, rank, path, self-ref
205  else writer->set(true, param->isSet(), 1, (param->isSet() ? (int)param->getValue() : 0), 0, get_parameter("ntrl_output_dir")->getArg(), this);
206 
208 
209  writer->set_extension(".fsti");
210 
211  loader->attach(writer);
212 
213  _writers.push_back( writer );
214  }
215 
216  if( get_parameter("ntrl_save_freq")->isSet() ) {
217 
218  writer = new TTNeutralGenesFH(this);
219 
220  writer->set_extension(".freq");
221 
222  if (isMatrix) writer->set_multi(true, true, 1, &temp, get_parameter("ntrl_output_dir")->getArg());
223  // rpl_per, gen_per, rpl_occ, gen_occ, rank, path, self-ref
224  else writer->set(true, param->isSet(), 1, (param->isSet() ? (int)param->getValue() : 0), 0, get_parameter("ntrl_output_dir")->getArg(), this);
225 
226  //check validity of output option:
227 
228  if(get_parameter("ntrl_save_freq")->getArg() == "allfreq") {
229 
230  warning("option \"allfreq\" to \"ntrl_save_freq\" is deprecated, using \"locus\" instead\n");
231 
232  writer->setOutputOption("locus");
233 
234  } else if(get_parameter("ntrl_save_freq")->getArg() == "vcomp") {
235 
236  warning("option \"vcomp\" to \"ntrl_save_freq\" is deprecated, using \"allele\" instead\n");
237 
238  writer->setOutputOption("allele");
239 
240  } else if( get_parameter("ntrl_save_freq")->getArg() != "1" &&
241  get_parameter("ntrl_save_freq")->getArg() != "locus" &&
242  get_parameter("ntrl_save_freq")->getArg() != "allele") {
243 
244  fatal("parameter \"ntrl_save_freq\" options are \"locus\" or \"allele\".\n");
245 
246  } else
247  writer->setOutputOption(get_parameter("ntrl_save_freq")->getArg());
248 
250 
251  loader->attach(writer);
252 
253  _writers.push_back( writer );
254  }
255 
256 }
void set_write_fct(void(TTNeutralGenesFH::*fct_ptr)())
Definition: ttneutralgenes.h:257
virtual void attach(Handler *FH)
Attaches the FileHandler to the current list (_writers) of the FileServices.
Definition: fileservices.cc:57
void write_varcompWC()
Definition: ttneutralgenes.cc:1207
double getValue()
Returns the argument value according to its type.
Definition: param.cc:319
void set_extension(const char *ext)
Definition: filehandler.h:145
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:329
void write_TAB()
Definition: ttneutralgenes.cc:604
void setOutputOption(string opt)
Definition: ttneutralgenes.cc:950
void write_FSTAT()
Definition: ttneutralgenes.cc:715
void fatal(const char *str,...)
Definition: output.cc:90
bool isMatrix()
Checks if the argument is of matrix type.
Definition: param.h:170
virtual void set(bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path, TP *trait_proto)
Definition: filehandler.h:236
virtual void attach_reader(FileHandler *FH)
Attaches the FileHandler to the current list (_readers) of the FileServices.
Definition: fileservices.cc:70
void warning(const char *str,...)
Definition: output.cc:56
This structure stores one parameter, its definition and its string argument.
Definition: param.h:53
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
virtual void set_multi(bool rpl_per, bool gen_per, int rpl_occ, TMatrix *Occ, string path)
Definition: filehandler.h:197
string getArg()
Definition: param.h:136
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
void write_GENEPOP()
Definition: ttneutralgenes.cc:827
void write_Fst_i()
Definition: ttneutralgenes.cc:1059
A file handler to save the neutral markers genotypes in the FSTAT format (extended).
Definition: ttneutralgenes.h:231
void set_isInputHandler(bool val)
Definition: filehandler.h:151
vector< TTNeutralGenesFH * > _writers
Definition: ttneutralgenes.h:175
bool isSet()
Definition: param.h:138
void TProtoNeutralGenes::loadStatServices ( StatServices loader)
virtual

Implements SimComponent.

References _stats, and StatServices::attach().

261 {
262  //allocate the stat handler
263  if(_stats == NULL)
264  _stats = new TTNeutralGenesSH(this);
265 
266  if(_stats != NULL) {
267  loader->attach(_stats);
268  }
269 }
The stat handler for neutral markers.
Definition: ttneutralgenes.h:268
virtual void attach(Handler *H)
attach the StatHandler to the current list (_statHandlers) of the StatServices
Definition: statservices.cc:177
TTNeutralGenesSH * _stats
Definition: ttneutralgenes.h:176
virtual void TProtoNeutralGenes::reset ( )
inlinevirtual

Reimplemented from TTProtoWithMap.

References TTProtoWithMap::reset().

virtual void reset()
Definition: ttrait_with_map.cc:505
bool TProtoNeutralGenes::retrieve_data ( BinaryStorageBuffer reader)
virtual

Implements StorableComponent.

References _locus_num, error(), and BinaryStorageBuffer::read().

364 {
365  unsigned int dummy;
366  reader->read(&dummy, sizeof(int));
367  if(dummy != _locus_num ){
368  error("TProtoDeletMutations::retrieve_data:nb locus in file differ from parameter value!\n");
369  _locus_num = dummy;
370  }
371  return true;
372 }
int error(const char *str,...)
Definition: output.cc:73
void read(void *out, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:147
unsigned int _locus_num
Definition: ttneutralgenes.h:166
bool TProtoNeutralGenes::setParameters ( )
virtual

Implements SimComponent.

References _allele_num, _inherit_func_ptr, _init_model, _locus_num, _mut_model, _mut_rate, _mutate_func_ptr, _ploidy, TTProtoWithMap::_recombRate, error(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), inherit_free(), inherit_low(), Param::isSet(), TTNeutralGenes::mutate_2all(), TTNeutralGenes::mutate_KAM(), TTNeutralGenes::mutate_NULL(), TTNeutralGenes::mutate_SSM(), and TTProtoWithMap::setGeneticMapParameters().

93 {
94  _locus_num = (unsigned int)get_parameter_value("ntrl_loci");
95  _allele_num = (unsigned int)get_parameter_value("ntrl_all");
96  _ploidy = 2;
97  _mut_rate = get_parameter_value("ntrl_mutation_rate");
98  _mut_model = (unsigned int)get_parameter_value("ntrl_mutation_model");
99 
100  if(get_parameter("ntrl_init_model")->isSet())
101  _init_model = (unsigned short)get_parameter_value("ntrl_init_model");
102  else
103  _init_model = 1; //maximum variance
104 
105  switch(_mut_model) {
106  case 0:
107  {
109  break;
110  }
111  case 1:
112  {
114  break;
115  }
116  case 2:
117  {
119  break;
120  }
121  default:
122  {
123  error("wrong parameter value for parameter \"ntrl_mutation_model\", max is 2\n");
124  break; //should return false
125  }
126  }
127  //special case:
129 
130  // recombination parameters, calling the genetic map
131  _recombRate = get_parameter_value("ntrl_recombination_rate"); //member of TTProtoWithMap
132 
133  // we want to bypass the genetic map if loci are not linked
134  if( _recombRate == 0.5 ) {
135 
137 
138  } else {
141  }
142 
143  return true;
144 }
unsigned int _ploidy
Definition: ttneutralgenes.h:167
void(TProtoNeutralGenes::* _inherit_func_ptr)(sex_t, unsigned char *, unsigned char **)
Definition: ttneutralgenes.h:173
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
double _recombRate
Definition: ttrait_with_map.h:176
void(TTNeutralGenes::* _mutate_func_ptr)(void)
Definition: ttneutralgenes.h:172
void inherit_low(sex_t SEX, unsigned char *seq, unsigned char **parent)
Definition: ttneutralgenes.cc:300
int _mut_model
Definition: ttneutralgenes.h:169
void inherit_free(sex_t SEX, unsigned char *seq, unsigned char **parent)
Definition: ttneutralgenes.cc:292
int error(const char *str,...)
Definition: output.cc:73
unsigned int _allele_num
Definition: ttneutralgenes.h:165
unsigned short _init_model
Definition: ttneutralgenes.h:170
double _mut_rate
Definition: ttneutralgenes.h:168
void mutate_NULL()
Definition: ttneutralgenes.h:116
void mutate_KAM()
Definition: ttneutralgenes.cc:557
bool setGeneticMapParameters(string prefix)
Definition: ttrait_with_map.cc:88
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
void mutate_2all()
Definition: ttneutralgenes.cc:576
unsigned int _locus_num
Definition: ttneutralgenes.h:166
void mutate_SSM()
Definition: ttneutralgenes.cc:534
bool isSet()
Definition: param.h:138
virtual void TProtoNeutralGenes::store_data ( BinaryStorageBuffer saver)
inlinevirtual

Implements StorableComponent.

References BinaryStorageBuffer::store().

214 {saver->store(&_locus_num,sizeof(int));}
void store(void *stream, unsigned int nb_bytes)
Definition: binarystoragebuffer.h:130
unsigned int _locus_num
Definition: ttneutralgenes.h:166

Member Data Documentation

unsigned int TProtoNeutralGenes::_allele_num
private
void(TProtoNeutralGenes::* TProtoNeutralGenes::_inherit_func_ptr)(sex_t, unsigned char *, unsigned char **)
private

Referenced by hatch(), and setParameters().

unsigned short TProtoNeutralGenes::_init_model
private

Referenced by hatch(), and setParameters().

unsigned int TProtoNeutralGenes::_locus_num
private
int TProtoNeutralGenes::_mut_model
private

Referenced by hatch(), and setParameters().

double TProtoNeutralGenes::_mut_rate
private

Referenced by hatch(), and setParameters().

void(TTNeutralGenes::* TProtoNeutralGenes::_mutate_func_ptr)(void)
private

Referenced by hatch(), and setParameters().

unsigned int TProtoNeutralGenes::_ploidy
private

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

double TProtoNeutralGenes::_recomb_rate
private
TTNeutralGenesSH* TProtoNeutralGenes::_stats
private
const trait_t TProtoNeutralGenes::_type
private

Referenced by get_type().

vector< TTNeutralGenesFH* > TProtoNeutralGenes::_writers
private

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

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