Mercurial > repos > dereeper > sniplay
comparison egglib/egglib-2.1.5/include/egglib-cpp/Population.hpp @ 1:420b57c3c185 draft
Uploaded
author | dereeper |
---|---|
date | Fri, 10 Jul 2015 04:39:30 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:3e19d0dfcf3e | 1:420b57c3c185 |
---|---|
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 | |
30 /** \brief Handles a single population | |
31 * | |
32 * \ingroup coalesce | |
33 * | |
34 */ | |
35 class Population { | |
36 | |
37 public: | |
38 | |
39 /** \brief Default constructor | |
40 * | |
41 * Generates an empty population. | |
42 * | |
43 */ | |
44 Population(); | |
45 | |
46 /** \brief Copy constructor | |
47 * | |
48 */ | |
49 Population(const Population& source); | |
50 | |
51 /** \brief Assignment operator | |
52 * | |
53 */ | |
54 Population& operator=(const Population& source); | |
55 | |
56 /** \brief Destructor | |
57 * | |
58 * The object only cleans Edge objects currently stored in it. | |
59 * | |
60 */ | |
61 ~Population(); | |
62 | |
63 /** \brief Standard constructor | |
64 * | |
65 * The Edge instances will be handled by address and they | |
66 * MUST be passed using the method set(). | |
67 * | |
68 * \param numberOfSegments number of recombining segments. | |
69 * | |
70 * \param numberOfLineages the number of lineages contained | |
71 * in this population. | |
72 * | |
73 * \param firstIndex the absolute index (or ID) of the first | |
74 * lineage (the other will have consecutive incremented | |
75 * ID's). | |
76 * | |
77 */ | |
78 Population(unsigned int numberOfSegments, | |
79 unsigned int numberOfLineages, unsigned firstIndex); | |
80 | |
81 /** \brief Gets the number of lineages | |
82 * | |
83 */ | |
84 unsigned int numberOfLineages() const; | |
85 | |
86 /** \brief Gets the efficient number of lineages | |
87 * | |
88 * The number of lineages is multiplied by the number of | |
89 * covered segments of each lineages. | |
90 * | |
91 */ | |
92 unsigned int efficientNumberOfLineages() const; | |
93 | |
94 /** \brief Sets the Edge of a lineage | |
95 * | |
96 * \param index the index of the lineage within the | |
97 * population. | |
98 * \param edge the address of the Edge instance representing | |
99 * the lineage. | |
100 * | |
101 */ | |
102 void set(unsigned int index, Edge* edge); | |
103 | |
104 /** \brief Removes and returns a random lineage. | |
105 * | |
106 * \param random pointer to simulator's random generator | |
107 * instance. | |
108 * | |
109 */ | |
110 Edge* extractRandomly(Random* random); | |
111 | |
112 /** \brief Removes and returns a given lineage. | |
113 * | |
114 * \param index the relative index of the lineage. | |
115 * | |
116 */ | |
117 Edge* extractByIndex(unsigned int index); | |
118 | |
119 /** \brief Appends a lineage to the object | |
120 * | |
121 */ | |
122 void push(Edge* edge); | |
123 | |
124 /** \brief Gets coverage | |
125 * | |
126 */ | |
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 |