annotate egglib/egglib-2.1.5/include/egglib-cpp/Arg.hpp @ 15:31c23d943c29 draft default tip

Uploaded
author dereeper
date Tue, 08 Jan 2019 08:47:56 -0500
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
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
21 #ifndef EGGLIB_ARG_HPP
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
22 #define EGGLIB_ARG_HPP
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
23
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
24
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
25 #include "Current.hpp"
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
26 #include "Edge.hpp"
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
27 #include <string>
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
28
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
29
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
30 /** \defgroup coalesce coalesce
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
31 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
32 * \brief Coalescent simulator
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
33 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
34 * The set of classes implements a three-scale coalescent simulator with
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
35 * recombination, and a flexible mutation model. The main classes are
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
36 * Controller (the starting point for generating genealogies), ParamSet
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
37 * (that centralizes parameter specification), the Change hierarchy
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
38 * (that implements demographic change specifications), Arg (ancestral
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
39 * recombination graph; the result of generation a genealogy) and
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
40 * Mutator (that generates genotype data from an ARG).
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
41 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
42 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
43
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
44
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
45 namespace egglib {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
46
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
47 class Random;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
48
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
49 /** \brief Ancestral recombination graph
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
50 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
51 * \ingroup coalesce
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
52 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
53 * This class stores the ARG (genealogical information). It is
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
54 * progressively built by appropriate (especially regarding to the
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
55 * timing) calls to coal() and recomb() methods. Then it can be
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
56 * used by a mutator class to generates data, or it can also
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
57 * generate newick trees (one tree by non-recombining segment).
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
58 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
59 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
60 class Arg {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
61
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
62 public:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
63
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
64 /** \brief Default constructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
65 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
66 * Creates a null, useless, object.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
67 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
68 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
69 Arg();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
70
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
71
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
72 /** \brief Object initialization
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
73 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
74 * \param current address of the Current instance used by
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
75 * the simulator.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
76 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
77 * \param numberOfSegments number of recombining segments.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
78 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
79 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
80 void set(Current* current, unsigned int numberOfSegments);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
81
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
82
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
83 /** \brief Object reset method
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
84 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
85 * This method doesn't reset all parameters (the number of
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
86 * segments and associated tables are retained, as well as
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
87 * the Edge object pool).
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
88 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
89 * \param current address of the Current instance used by
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
90 * the simulator.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
91 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
92 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
93 void reset(Current* current);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
94
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
95
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
96 /** \brief Standard constructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
97 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
98 * \param current address of the Current instance used by
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
99 * the simulator.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
100 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
101 * \param numberOfSegments number of recombining segments
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
102 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
103 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
104 Arg(Current* current, unsigned int numberOfSegments);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
105
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
106
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
107 /** \brief Destructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
108 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
109 * Clears all Edge instances referenced in the object.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
110 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
111 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
112 virtual ~Arg();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
113
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
114
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
115 /** \brief Gets the current value of the time counter
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
116 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
117 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
118 double time() const;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
119
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
120
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
121 /** \brief Increments the time counter
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
122 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
123 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
124 void addTime(double increment);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
125
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
126
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
127 /** \brief Performs a coalescence event
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
128 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
129 * For this version, the two lineages to coalesce are
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
130 * predefined.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
131 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
132 * \param incr increment of the time counter.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
133 * \param pop index of the population.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
134 * \param index1 first lineage to coalesce.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
135 * \param index2 second lineage to coalesce.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
136 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
137 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
138 void coalescence(double incr, unsigned int pop, unsigned int index1, unsigned int index2);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
139
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
140
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
141 /** \brief Performs a coalescence event
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
142 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
143 * For this version, the two lineages to coalesce are
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
144 * randomly picked in the given population
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
145 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
146 * \param incr increment of the time counter.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
147 * \param pop index of the population.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
148 * \param random pointer to simulator's random generator
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
149 * instance.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
150 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
151 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
152 void coalescence(double incr, unsigned int pop, Random* random);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
153
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
154
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
155 /** \brief Performs a recombination event
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
156 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
157 * \param incr increment of the time counter.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
158 * \param random pointer to simulator's random generator
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
159 * instance.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
160 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
161 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
162 void recombination(double incr, Random* random);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
163
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
164
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
165 /** \brief Places a mutation
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
166 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
167 * \param segment index of the segment affected.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
168 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
169 * \param treePosition a random number placed on the
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
170 * interval defined by the tree length at this position.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
171 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
172 * \return the concerned Edge's address.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
173 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
174 * \todo why this is not encapsulated?
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
175 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
176 * Another nerve-taking point: calling this method assume
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
177 * that all Edge of have previously undergone a call of
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
178 * branchLength(position) with intervalPosition - what
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
179 * should be done by the called (that is, Mutator) through
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
180 * my (Arg's) treeLength of something. BEWARE WHEN MODIFYING
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
181 * (enhancements should be directed to Edge in my view)
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
182 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
183 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
184 Edge* mute(unsigned int segment, double treePosition);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
185
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
186
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
187 /** \brief Age of the uMRCA
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
188 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
189 * The uMRCA is the ultimate Most Recent Common Ancestor,
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
190 * that is the point where the last segment finds its most
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
191 * recent common ancestor. This member will have a meaningful
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
192 * value only if the coalescent process is completed.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
193 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
194 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
195 inline double ageUltimateMRCA() const {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
196 return _time;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
197 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
198
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
199
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
200 /** \brief Age of the MRCA for a given segment
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
201 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
202 * The MRCA is the Most Recent Common Ancestor, that is the
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
203 * point where the coalescent process is over (all lineages
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
204 * have coalesced). This member will have a meaningful
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
205 * value only if the coalescent process is completed.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
206 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
207 * Note that the value is cached; it is computed only one
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
208 * upon first call and no again, even if the Arg is modified<
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
209 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
210 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
211 inline double ageMRCA(unsigned int segmentIndex) {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
212 return _MRCA[segmentIndex]->bottom;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
213 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
214
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
215 /** \brief MRCA for each segment
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
216 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
217 * The MRCA is the Most Recent Common Ancestor, that is the
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
218 * point where the coalescent process is over (all lineages
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
219 * have coalesced). This member will have a meaningful
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
220 * value only if the coalescent process is completed.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
221 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
222 * Note that the value is cached; it is computed only one
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
223 * upon first call and no again, even if the Arg is modified
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
224 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
225 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
226 inline const Edge* MRCA(unsigned int segmentIndex) {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
227 return _MRCA[segmentIndex];
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
228 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
229
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
230 /// Ultimate MRCA
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
231
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
232 inline const Edge* uMRCA() {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
233 return edges[numberOfEdges-1];
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
234 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
235
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
236
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
237 /// the number of recombining segments
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
238 unsigned int numberOfSegments;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
239
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
240 /** \brief Formats the newick-formatted tree for a segment
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
241 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
242 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
243 std::string newick(unsigned int segment);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
244
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
245
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
246 /// Number of initial lineages
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
247 unsigned int numberOfSamples;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
248
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
249
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
250 /** \brief Total tree length (summed over all segments)
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
251 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
252 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
253 double totalLength;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
254
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
255 /** \brief Segment-specific tree length
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
256 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
257 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
258 double* segmentLengths;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
259
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
260 /// Current number of Edges in the tree (including the MRCA node)
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
261 unsigned int numberOfEdges;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
262
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
263 /// Total number of recombination events that occurred
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
264 unsigned int numberOfRecombinationEvents;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
265
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
266 /// Set the number of actual sites in all branches
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
267 void set_actualNumberOfSites(unsigned int actualNumberOfSites);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
268
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
269
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
270 private:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
271
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
272 /// Copy constructor not available
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
273 Arg(const Arg&) { }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
274
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
275 /// Assignment operator not available
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
276 Arg& operator=(const Arg&) { return *this; }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
277
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
278 void init_stable_parameters();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
279 void init_variable_parameters();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
280 void clear();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
281 void addEdge(Edge*);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
282 std::string rnewick(Edge* edge, unsigned int segment, double cache);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
283
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
284 Current* current;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
285 double _time;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
286 Edge** edges;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
287
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
288 void findMRCA(unsigned int segmentIndex);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
289 void computeTotalLength();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
290 void computeSegmentLength(unsigned int segmentIndex);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
291
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
292 unsigned int* numberOfEdgesPerSegment;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
293 Edge** _MRCA;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
294
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
295 EdgePool edgePool;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
296 };
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
297
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
298 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
299
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
300 #endif