Nemo  2.4.2
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
ttrait.h
Go to the documentation of this file.
1 
28 #ifndef TTRAIT_H
29 #define TTRAIT_H
30 
31 #include "types.h"
32 #include "simcomponent.h"
33 
44 class TTrait: public StorableComponent {
45 
46 public:
48  virtual void init () = 0;
49 
51  virtual void init_sequence () = 0;
52 
54  virtual void reset () = 0;
59  virtual void inherit (const TTrait* mother, const TTrait* father) = 0;
61  virtual void mutate () = 0;
66  virtual void* set_trait (void* value) = 0;
70  virtual void set_sequence (void** seq) = 0;
76  virtual unsigned int get_allele (int loc, int all) const = 0;
82  virtual double get_allele_value (int loc, int all) const = 0;
88  virtual void set_allele_value (unsigned int locus, unsigned int allele, double value) = 0;
89 
91  virtual void set_value () = 0;
95  virtual void* getValue () const = 0;
99  virtual trait_t get_type () const = 0;
103  virtual void** get_sequence () const = 0;
105  virtual void show_up () = 0;
110  virtual TTrait* clone () = 0;
113 
115  virtual TTrait& operator= (const TTrait&) = 0;
117  virtual bool operator== (const TTrait&) = 0;
118  virtual bool operator!= (const TTrait&) = 0;
120  virtual ~TTrait ( ) { }
121 };
122 
130 
131 protected:
133  int _index;
134 
135 public:
138  virtual void reset () = 0;
140  virtual TTrait* hatch () = 0;
142  virtual TraitPrototype* clone () = 0;
146  virtual trait_t get_type () const = 0;
148  virtual void set_index(int idx) {_index = idx;}
150  virtual int get_index() {return _index;}
152  virtual int get_phenotype_dimension () = 0;
154  virtual int get_allele_number () = 0;
156  virtual int get_locus_number () = 0;
158  virtual bool is_mappable () = 0;
160  virtual bool is_mapped () = 0;
162  virtual vector< unsigned int > get_locus_map_positions () = 0;
163 
164 };
165 #endif //TTRAIT_H
166 
Interface to all basic components of a simulation (traits, life cycle events, pop,...
Definition: simcomponent.h:43
Provides an interface to binary data saving and uploading.
Definition: simcomponent.h:160
Interface for all trait types, declares all basic trait operations.
Definition: ttrait.h:44
virtual void * getValue() const =0
Genotype to phenotype mapper.
virtual bool operator==(const TTrait &)=0
Checks for parameters equivalence, not genetic equivalence.
virtual unsigned int get_allele(int loc, int all) const =0
Called to read the allele identity at a locus.
virtual trait_t get_type() const =0
type accessor.
virtual void mutate()=0
Mutation procedure, perform mutations on the genes sequence.
virtual void set_value()=0
Tells the trait to set its phenotype from genotype, should be used instead of getValue().
virtual void inherit(const TTrait *mother, const TTrait *father)=0
Inheritance procedure, creates a new trait from mother's and father's traits.
virtual void * set_trait(void *value)=0
Called to set the phenotypic to a particular value or to give context-dependant value(s) to the trait...
virtual void show_up()=0
Writes some info to stdout.
virtual void set_allele_value(unsigned int locus, unsigned int allele, double value)=0
Called to change the allelic value at a particular locus.
virtual double get_allele_value(int loc, int all) const =0
Called to read the value of the allele at a particular locus.
virtual void init()=0
Called to allocate the trait's genotypic sequences.
virtual void ** get_sequence() const =0
sequence accessor.
virtual TTrait & operator=(const TTrait &)=0
Copies the complete state of the trait from right to left side of the operator, sequence data include...
virtual void set_sequence(void **seq)=0
Called to set the sequence pointer to an existing trait.
virtual ~TTrait()
Definition: ttrait.h:120
virtual bool operator!=(const TTrait &)=0
virtual void init_sequence()=0
Called at the start of each replicate, sets the initial genotypes.
virtual TTrait * clone()=0
Returns a copy of itself.
virtual void reset()=0
Called at the end of each simulation/replicate, deallocates sequence memory.
TTrait setter.
Definition: ttrait.h:129
virtual int get_allele_number()=0
Returns the number of allele per locus.
virtual int get_locus_number()=0
Returns the number of locus.
virtual TraitPrototype * clone()=0
Returns a copy of itself.
virtual TTrait * hatch()=0
Creates the trait of which it is the prototype, called by IndFactory::makePrototype().
virtual trait_t get_type() const =0
Type accessor.
virtual vector< unsigned int > get_locus_map_positions()=0
Returns the map positions of the loci in vector.
virtual void reset()=0
Called at the end of a simulation to reset the Traits' prototypes (e.g.
virtual bool is_mapped()=0
Checks if the trait's loci are placed on a genetic map.
virtual int get_phenotype_dimension()=0
Returns the dimension of the phenotype of the trait (size of the array accessed with TTrait::getValue...
virtual int get_index()
Index getter.
Definition: ttrait.h:150
int _index
The trait index in the Individual traits table.
Definition: ttrait.h:133
virtual bool is_mappable()=0
Checks if the trait is mappable, i.e., if the loci can be placed on a genetic map.
virtual void set_index(int idx)
Sets the traits index.
Definition: ttrait.h:148
Nemo2.
std::string trait_t
Trait types.
Definition: types.h:61

Generated for Nemo v2.4.2 by  doxygen 1.9.1

Catalogued on GSR