annotate egglib/egglib-2.1.5/include/egglib-cpp/Population.hpp @ 11:15b23cdde685 draft

planemo upload commit 305985afd3b7c3d47f531149c2f1a279af2d12aa-dirty
author dereeper
date Fri, 20 Apr 2018 09:04:25 -0400
parents 420b57c3c185
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
1 /*
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
2 Copyright 2009-2010 Stéphane De Mita, Mathieu Siol
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
3
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
4 This file is part of the EggLib library.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
5
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
6 EggLib is free software: you can redistribute it and/or modify
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
8 the Free Software Foundation, either version 3 of the License, or
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
9 (at your option) any later version.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
10
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
11 EggLib is distributed in the hope that it will be useful,
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
14 GNU General Public License for more details.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
15
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
17 along with EggLib. If not, see <http://www.gnu.org/licenses/>.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
18 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
19
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
20 #ifndef EGGLIB_POPULATION_HPP
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
21 #define EGGLIB_POPULATION_HPP
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
22
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
23
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
24 #include "Edge.hpp"
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
25
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
26 namespace egglib {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
27
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
28 class Random;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
29
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
30 /** \brief Handles a single population
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
31 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
32 * \ingroup coalesce
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
33 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
34 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
35 class Population {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
36
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
37 public:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
38
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
39 /** \brief Default constructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
40 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
41 * Generates an empty population.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
42 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
43 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
44 Population();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
45
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
46 /** \brief Copy constructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
47 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
48 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
49 Population(const Population& source);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
50
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
51 /** \brief Assignment operator
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
52 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
53 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
54 Population& operator=(const Population& source);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
55
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
56 /** \brief Destructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
57 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
58 * The object only cleans Edge objects currently stored in it.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
59 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
60 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
61 ~Population();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
62
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
63 /** \brief Standard constructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
64 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
65 * The Edge instances will be handled by address and they
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
66 * MUST be passed using the method set().
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
67 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
68 * \param numberOfSegments number of recombining segments.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
69 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
70 * \param numberOfLineages the number of lineages contained
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
71 * in this population.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
72 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
73 * \param firstIndex the absolute index (or ID) of the first
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
74 * lineage (the other will have consecutive incremented
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
75 * ID's).
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
76 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
77 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
78 Population(unsigned int numberOfSegments,
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
79 unsigned int numberOfLineages, unsigned firstIndex);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
80
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
81 /** \brief Gets the number of lineages
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
82 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
83 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
84 unsigned int numberOfLineages() const;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
85
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
86 /** \brief Gets the efficient number of lineages
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
87 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
88 * The number of lineages is multiplied by the number of
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
89 * covered segments of each lineages.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
90 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
91 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
92 unsigned int efficientNumberOfLineages() const;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
93
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
94 /** \brief Sets the Edge of a lineage
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
95 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
96 * \param index the index of the lineage within the
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
97 * population.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
98 * \param edge the address of the Edge instance representing
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
99 * the lineage.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
100 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
101 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
102 void set(unsigned int index, Edge* edge);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
103
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
104 /** \brief Removes and returns a random lineage.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
105 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
106 * \param random pointer to simulator's random generator
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
107 * instance.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
108 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
109 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
110 Edge* extractRandomly(Random* random);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
111
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
112 /** \brief Removes and returns a given lineage.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
113 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
114 * \param index the relative index of the lineage.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
115 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
116 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
117 Edge* extractByIndex(unsigned int index);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
118
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
119 /** \brief Appends a lineage to the object
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
120 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
121 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
122 void push(Edge* edge);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
123
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
124 /** \brief Gets coverage
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
125 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
126 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
127 unsigned int coverage(unsigned int edgeIndex) const;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
128
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
129
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
130 private:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
131
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
132 void copy(const Population& source);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
133 void clear();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
134 Edge* pick(unsigned int index);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
135 void init();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
136 unsigned int _numberOfLineages;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
137 unsigned int _efficientNumberOfLineages;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
138 Edge** lineages;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
139 };
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
140
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
141 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
142
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
143 #endif