Nemo  2.4.0
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
ttneutralgenes_bitstring.h
Go to the documentation of this file.
1 /*
2  * @file ttneutralgenes_bitstring.h
3  * Nemo2
4  *
5  * Copyright (C) 2026 The Authors
6  *
7  * This file is part of Nemo
8  *
9  * Nemo is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Nemo is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  *
23  * created on @date 03.03.2026
24  *
25  * @author fred
26  */
27 
28 #ifndef TTNEUTRALGENES_BITSTRING_H_
29 #define TTNEUTRALGENES_BITSTRING_H_
30 
31 #include "ttneutralgenes.h"
32 #include "bitstring.h"
33 
34 // ------------------------------------------------------------------------------
38 // ------------------------------------------------------------------------------
40 
41 public:
42 
45 
48 
49  virtual ~TTNeutralGenes_bitstring () { reset(); }
50 
51  const bitstring& get_bit_sequence (bool chromosome) const
52  { return _sequence[chromosome]; }
53 
56  virtual TTNeutralGenes& operator= (const TTrait& T);
57  virtual void init ( );
58  virtual void init_sequence ( );
59  virtual void reset ( );
60  virtual void** get_sequence ( ) const {
61  error("calling TTNeutralGenes_bitstring::get_sequence()\n");
62  return (void**)NULL;
63  }
64  virtual unsigned int get_allele (int loc, int all) const;
65  virtual double get_allele_value (int loc, int all) const;
66  virtual void set_allele_value (unsigned int locus, unsigned int allele, double value);
67  virtual void set_sequence (void** seq);
68  virtual void inherit (const TTrait* mother, const TTrait* father);
69  virtual void mutate ( );
70  virtual void show_up ( );
71  virtual TTNeutralGenes* clone ( ) { return new TTNeutralGenes_bitstring(*this); }
72 
73  //implements StorableComponent
74  virtual void store_data (BinaryStorageBuffer* saver);
75  virtual bool retrieve_data (BinaryStorageBuffer* reader);
77 
78 private:
79 
80  void inherit_low (sex_t SEX, const TTNeutralGenes_bitstring* parent);
81 
82 protected:
83 
84  bitstring *_sequence; // array of 2 bitstrings [ploidy]
86 
87 };
88 
89 #endif /* TTNEUTRALGENES_BITSTRING_H_ */
A class to store any kind of data in a char buffer before unloading it in a binary data file.
Definition: binarystoragebuffer.h:43
TTNeutralGenes_bitstring : diallelic neutral loci encoded as bitstrings.
Definition: ttneutralgenes_bitstring.h:39
virtual TTNeutralGenes * clone()
Definition: ttneutralgenes_bitstring.h:71
virtual void reset()
Definition: ttneutralgenes_bitstring.cc:85
bitstring * _sequence
Definition: ttneutralgenes_bitstring.h:84
virtual void inherit(const TTrait *mother, const TTrait *father)
Definition: ttneutralgenes_bitstring.cc:153
const bitstring & get_bit_sequence(bool chromosome) const
Definition: ttneutralgenes_bitstring.h:51
virtual bool retrieve_data(BinaryStorageBuffer *reader)
Definition: ttneutralgenes_bitstring.cc:256
virtual unsigned int get_allele(int loc, int all) const
Definition: ttneutralgenes_bitstring.cc:114
bool _free_recombination
Definition: ttneutralgenes_bitstring.h:85
virtual void ** get_sequence() const
Definition: ttneutralgenes_bitstring.h:60
void inherit_low(sex_t SEX, const TTNeutralGenes_bitstring *parent)
Definition: ttneutralgenes_bitstring.cc:201
TTNeutralGenes_bitstring()
Definition: ttneutralgenes_bitstring.h:43
virtual void init()
Definition: ttneutralgenes_bitstring.cc:38
virtual void show_up()
Definition: ttneutralgenes_bitstring.cc:224
virtual TTNeutralGenes & operator=(const TTrait &T)
Definition: ttneutralgenes_bitstring.cc:95
virtual void set_allele_value(unsigned int locus, unsigned int allele, double value)
Definition: ttneutralgenes_bitstring.cc:128
virtual void init_sequence()
Definition: ttneutralgenes_bitstring.cc:52
virtual void set_sequence(void **seq)
Definition: ttneutralgenes_bitstring.cc:135
virtual void store_data(BinaryStorageBuffer *saver)
Definition: ttneutralgenes_bitstring.cc:242
virtual ~TTNeutralGenes_bitstring()
Definition: ttneutralgenes_bitstring.h:49
virtual void mutate()
Definition: ttneutralgenes_bitstring.cc:142
virtual double get_allele_value(int loc, int all) const
Definition: ttneutralgenes_bitstring.cc:121
TTNeutralGenes_bitstring(const TTNeutralGenes_bitstring &T)
Definition: ttneutralgenes_bitstring.h:46
Abstract base class for neutral gene traits.
Definition: ttneutralgenes.h:56
Interface for all trait types, declares all basic trait operations.
Definition: ttrait.h:45
Non-template and faster implementation of std::bitset.
Definition: bitstring.h:56
int error(const char *str,...)
Definition: output.cc:78
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:35

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

Locations of visitors to this page
Catalogued on GSR