Egglib 2.1.11
C++ library reference manual
Population.hpp
1 /*
2  Copyright 2009-2010 Stéphane De Mita, Mathieu Siol
3 
4  This file is part of the EggLib library.
5 
6  EggLib is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  EggLib is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with EggLib. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef EGGLIB_POPULATION_HPP
21 #define EGGLIB_POPULATION_HPP
22 
23 
24 #include "Edge.hpp"
25 
26 namespace egglib {
27 
28  class Random;
29 
35  class Population {
36 
37  public:
38 
44  Population();
45 
49  Population(const Population& source);
50 
54  Population& operator=(const Population& source);
55 
61  ~Population();
62 
78  Population(unsigned int numberOfSegments,
79  unsigned int numberOfLineages, unsigned firstIndex);
80 
84  unsigned int numberOfLineages() const;
85 
92  unsigned int efficientNumberOfLineages() const;
93 
102  void set(unsigned int index, Edge* edge);
103 
110  Edge* extractRandomly(Random* random);
111 
117  Edge* extractByIndex(unsigned int index);
118 
122  void push(Edge* edge);
123 
127  unsigned int coverage(unsigned int edgeIndex) const;
128 
129 
130  private:
131 
132  void copy(const Population& source);
133  void clear();
134  Edge* pick(unsigned int index);
135  void init();
136  unsigned int _numberOfLineages;
137  unsigned int _efficientNumberOfLineages;
138  Edge** lineages;
139  };
140 
141 }
142 
143 #endif
Pseudo-random number generator.
Definition: Random.hpp:41
~Population()
Destructor.
Definition: Population.cpp:45
unsigned int numberOfLineages() const
Gets the number of lineages.
Definition: Population.cpp:106
Edge * extractRandomly(Random *random)
Removes and returns a random lineage.
Definition: Population.cpp:121
unsigned int efficientNumberOfLineages() const
Gets the efficient number of lineages.
Definition: Population.cpp:110
Handles a single population.
Definition: Population.hpp:35
Population()
Default constructor.
Definition: Population.cpp:29
Population & operator=(const Population &source)
Assignment operator.
Definition: Population.cpp:38
Edge * extractByIndex(unsigned int index)
Removes and returns a given lineage.
Definition: Population.cpp:128
Edge of the ancestral recombination graph.
Definition: Edge.hpp:49
Definition: ABC.cpp:37
unsigned int coverage(unsigned int edgeIndex) const
Gets coverage.
Definition: Population.cpp:166
void set(unsigned int index, Edge *edge)
Sets the Edge of a lineage.
Definition: Population.cpp:114
void push(Edge *edge)
Appends a lineage to the object.
Definition: Population.cpp:155

Hosted by 
Get EggLib at SourceForge.net. Fast, secure and Free Open Source software downloads