1 // $Id: chainparam_interface.cpp,v 1.36 2011/01/12 17:27:20 mkkuhner Exp $
2 
3 /*
4  *  Copyright 2002  Peter Beerli, Mary Kuhner, Jon Yamato and Joseph Felsenstein
5  *
6  *  This software is distributed free of charge for non-commercial use
7  *  and is copyrighted.  Of course, we do not guarantee that the software
8  *  works, and are not responsible for any damage you may cause or have.
9  *
10  */
11 
12 #include <iostream>
13 #include "arranger.h"
14 #include "chainparam.h"
15 #include "chainparam_interface.h"
16 #include "constants.h"
17 #include "stringx.h"
18 #include "ui_strings.h"
19 #include "ui_vars.h"
20 
21 using namespace std;
22 
23 /// uiFinalChains
24 
uiFinalChains()25 uiFinalChains::uiFinalChains()
26     : SetGetLong(uistr::finalChains)
27 {
28 }
29 
~uiFinalChains()30 uiFinalChains::~uiFinalChains()
31 {
32 }
33 
Get(UIVars & vars,UIId id)34 long uiFinalChains::Get(UIVars& vars, UIId id)
35 {
36     return vars.chains.GetFinalNumberOfChains();
37 }
38 
Set(UIVars & vars,UIId id,long val)39 void uiFinalChains::Set(UIVars& vars, UIId id, long val)
40 {
41     vars.chains.SetFinalNumberOfChains(val);
42 }
43 
44 /// uiFinalDiscard
45 
uiFinalDiscard()46 uiFinalDiscard::uiFinalDiscard()
47     : SetGetLong(uistr::finalDiscard)
48 {
49 }
50 
~uiFinalDiscard()51 uiFinalDiscard::~uiFinalDiscard()
52 {
53 }
54 
Get(UIVars & vars,UIId id)55 long uiFinalDiscard::Get(UIVars& vars, UIId id)
56 {
57     return vars.chains.GetFinalNumberOfChainsToDiscard();
58 }
59 
Set(UIVars & vars,UIId id,long val)60 void uiFinalDiscard::Set(UIVars& vars, UIId id, long val)
61 {
62     vars.chains.SetFinalNumberOfChainsToDiscard(val);
63 }
64 
65 /// uiFinalSamples
66 
uiFinalSamples()67 uiFinalSamples::uiFinalSamples()
68     : SetGetLong(uistr::finalSamples)
69 {
70 }
71 
~uiFinalSamples()72 uiFinalSamples::~uiFinalSamples()
73 {
74 }
75 
Get(UIVars & vars,UIId id)76 long uiFinalSamples::Get(UIVars& vars, UIId id)
77 {
78     return vars.chains.GetFinalNumberOfSamples();
79 }
80 
Set(UIVars & vars,UIId id,long val)81 void uiFinalSamples::Set(UIVars& vars, UIId id, long val)
82 {
83     vars.chains.SetFinalNumberOfSamples(val);
84 }
85 
86 /// uiFinalInterval
87 
uiFinalInterval()88 uiFinalInterval::uiFinalInterval()
89     : SetGetLong(uistr::finalInterval)
90 {
91 }
92 
~uiFinalInterval()93 uiFinalInterval::~uiFinalInterval()
94 {
95 }
96 
Get(UIVars & vars,UIId id)97 long uiFinalInterval::Get(UIVars& vars, UIId id)
98 {
99     return vars.chains.GetFinalChainSamplingInterval();
100 }
101 
Set(UIVars & vars,UIId id,long val)102 void uiFinalInterval::Set(UIVars& vars, UIId id, long val)
103 {
104     vars.chains.SetFinalChainSamplingInterval(val);
105 }
106 
107 /// uiInitialChains
108 
uiInitialChains()109 uiInitialChains::uiInitialChains()
110     : SetGetLong(uistr::initialChains)
111 {
112 }
113 
~uiInitialChains()114 uiInitialChains::~uiInitialChains()
115 {
116 }
117 
Get(UIVars & vars,UIId id)118 long uiInitialChains::Get(UIVars& vars, UIId id)
119 {
120     return vars.chains.GetInitialNumberOfChains();
121 }
122 
Set(UIVars & vars,UIId id,long val)123 void uiInitialChains::Set(UIVars& vars, UIId id, long val)
124 {
125     vars.chains.SetInitialNumberOfChains(val);
126 }
127 
128 /// uiInitialDiscard
129 
uiInitialDiscard()130 uiInitialDiscard::uiInitialDiscard()
131     : SetGetLong(uistr::initialDiscard)
132 {
133 }
134 
~uiInitialDiscard()135 uiInitialDiscard::~uiInitialDiscard()
136 {
137 }
138 
Get(UIVars & vars,UIId id)139 long uiInitialDiscard::Get(UIVars& vars, UIId id)
140 {
141     return vars.chains.GetInitialNumberOfChainsToDiscard();
142 }
143 
Set(UIVars & vars,UIId id,long val)144 void uiInitialDiscard::Set(UIVars& vars, UIId id, long val)
145 {
146     vars.chains.SetInitialNumberOfChainsToDiscard(val);
147 }
148 
149 /// uiInitialSamples
150 
uiInitialSamples()151 uiInitialSamples::uiInitialSamples()
152     : SetGetLong(uistr::initialSamples)
153 {
154 }
155 
~uiInitialSamples()156 uiInitialSamples::~uiInitialSamples()
157 {
158 }
159 
Get(UIVars & vars,UIId id)160 long uiInitialSamples::Get(UIVars& vars, UIId id)
161 {
162     return vars.chains.GetInitialNumberOfSamples();
163 }
164 
Set(UIVars & vars,UIId id,long val)165 void uiInitialSamples::Set(UIVars& vars, UIId id, long val)
166 {
167     vars.chains.SetInitialNumberOfSamples(val);
168 }
169 
170 /// uiInitialInterval
171 
uiInitialInterval()172 uiInitialInterval::uiInitialInterval()
173     : SetGetLong(uistr::initialInterval)
174 {
175 }
176 
~uiInitialInterval()177 uiInitialInterval::~uiInitialInterval()
178 {
179 }
180 
Get(UIVars & vars,UIId id)181 long uiInitialInterval::Get(UIVars& vars, UIId id)
182 {
183     return vars.chains.GetInitialChainSamplingInterval();
184 }
185 
Set(UIVars & vars,UIId id,long val)186 void uiInitialInterval::Set(UIVars& vars, UIId id, long val)
187 {
188     vars.chains.SetInitialChainSamplingInterval(val);
189 }
190 
191 /// uiHeatedChain
192 
uiHeatedChain()193 uiHeatedChain::uiHeatedChain()
194     : SetGetDouble(uistr::heatedChain)
195 {
196 }
197 
~uiHeatedChain()198 uiHeatedChain::~uiHeatedChain()
199 {
200 }
201 
Get(UIVars & vars,UIId id)202 double uiHeatedChain::Get(UIVars& vars, UIId id)
203 {
204     return vars.chains.GetChainTemperature(id.GetIndex1());
205 }
206 
Set(UIVars & vars,UIId id,double val)207 void uiHeatedChain::Set(UIVars& vars, UIId id, double val)
208 {
209     vars.chains.SetChainTemperature(val,id.GetIndex1());
210 }
211 
212 /// uiHeatedChains
213 
uiHeatedChains()214 uiHeatedChains::uiHeatedChains()
215     : GetDoubleVec1d(uistr::heatedChains)
216 {
217 }
218 
~uiHeatedChains()219 uiHeatedChains::~uiHeatedChains()
220 {
221 }
222 
Get(UIVars & vars,UIId id)223 DoubleVec1d uiHeatedChains::Get(UIVars& vars, UIId id)
224 {
225     return vars.chains.GetChainTemperatures();
226 }
227 
228 /// uiHeatedChainCount
229 
uiHeatedChainCount()230 uiHeatedChainCount::uiHeatedChainCount()
231     : SetGetLong(uistr::heatedChainCount)
232 {
233 }
234 
~uiHeatedChainCount()235 uiHeatedChainCount::~uiHeatedChainCount()
236 {
237 }
238 
Get(UIVars & vars,UIId id)239 long uiHeatedChainCount::Get(UIVars& vars, UIId id)
240 {
241     return vars.chains.GetChainCount();
242 }
243 
Set(UIVars & vars,UIId id,long val)244 void uiHeatedChainCount::Set(UIVars& vars, UIId id, long val)
245 {
246     vars.chains.SetChainCount(val);
247 }
248 
249 /// uiTempInterval
250 
uiTempInterval()251 uiTempInterval::uiTempInterval()
252     : SetGetLong(uistr::tempInterval)
253 {
254 }
255 
~uiTempInterval()256 uiTempInterval::~uiTempInterval()
257 {
258 }
259 
Get(UIVars & vars,UIId id)260 long uiTempInterval::Get(UIVars& vars, UIId id)
261 {
262     return vars.chains.GetTemperatureInterval();
263 }
264 
Set(UIVars & vars,UIId id,long val)265 void uiTempInterval::Set(UIVars& vars, UIId id, long val)
266 {
267     vars.chains.SetTemperatureInterval(val);
268 }
269 
270 /// uiAdaptiveTemp
271 
uiAdaptiveTemp()272 uiAdaptiveTemp::uiAdaptiveTemp()
273     : SetGetBool(uistr::tempAdapt)
274 {
275 }
276 
~uiAdaptiveTemp()277 uiAdaptiveTemp::~uiAdaptiveTemp()
278 {
279 }
280 
Get(UIVars & vars,UIId id)281 bool uiAdaptiveTemp::Get(UIVars& vars, UIId id)
282 {
283     return vars.chains.GetAdaptiveTemperatures();
284 }
285 
Set(UIVars & vars,UIId id,bool val)286 void uiAdaptiveTemp::Set(UIVars& vars, UIId id, bool val)
287 {
288     vars.chains.SetAdaptiveTemperatures(val);
289 }
290 
291 /// uiNumReps
292 
uiNumReps()293 uiNumReps::uiNumReps()
294     : SetGetLong(uistr::replicates)
295 {
296 }
297 
~uiNumReps()298 uiNumReps::~uiNumReps()
299 {
300 }
301 
Get(UIVars & vars,UIId id)302 long uiNumReps::Get(UIVars& vars, UIId id)
303 {
304     return vars.chains.GetNumberOfReplicates();
305 }
306 
Set(UIVars & vars,UIId id,long val)307 void uiNumReps::Set(UIVars& vars, UIId id, long val)
308 {
309     vars.chains.SetNumberOfReplicates(val);
310 }
311 
312 /// uiDropArranger
313 
uiDropArranger()314 uiDropArranger::uiDropArranger()
315     : SetGetDouble(uistr::dropArranger)
316 {
317 }
318 
~uiDropArranger()319 uiDropArranger::~uiDropArranger()
320 {
321 }
322 
Get(UIVars & vars,UIId id)323 double uiDropArranger::Get(UIVars& vars, UIId id)
324 {
325     return vars.chains.GetDropArrangerRelativeTiming();
326 }
327 
Set(UIVars & vars,UIId id,double val)328 void uiDropArranger::Set(UIVars& vars, UIId id, double val)
329 {
330     vars.chains.SetDropArrangerRelativeTiming(val);
331 }
332 
333 /// uiSizeArranger
334 
uiSizeArranger()335 uiSizeArranger::uiSizeArranger()
336     : SetGetDouble(uistr::sizeArranger)
337 {
338 }
339 
~uiSizeArranger()340 uiSizeArranger::~uiSizeArranger()
341 {
342 }
343 
Get(UIVars & vars,UIId id)344 double uiSizeArranger::Get(UIVars& vars, UIId id)
345 {
346     return vars.chains.GetSizeArrangerRelativeTiming();
347 }
348 
Set(UIVars & vars,UIId id,double val)349 void uiSizeArranger::Set(UIVars& vars, UIId id, double val)
350 {
351     vars.chains.SetSizeArrangerRelativeTiming(val);
352 }
353 
354 /// uiBayesArranger
355 
uiBayesArranger()356 uiBayesArranger::uiBayesArranger()
357     : SetGetDouble(uistr::bayesArranger)
358 {
359 }
360 
~uiBayesArranger()361 uiBayesArranger::~uiBayesArranger()
362 {
363 }
364 
Get(UIVars & vars,UIId id)365 double uiBayesArranger::Get(UIVars& vars, UIId id)
366 {
367     return vars.chains.GetBayesianArrangerRelativeTiming();
368 }
369 
Set(UIVars & vars,UIId id,double val)370 void uiBayesArranger::Set(UIVars& vars, UIId id, double val)
371 {
372     vars.chains.SetBayesianArrangerRelativeTiming(val);
373 }
374 
375 /// uiLocusArranger
376 
uiLocusArranger()377 uiLocusArranger::uiLocusArranger()
378     : SetGetDouble(uistr::locusArranger)
379 {
380 }
381 
~uiLocusArranger()382 uiLocusArranger::~uiLocusArranger()
383 {
384 }
385 
Get(UIVars & vars,UIId id)386 double uiLocusArranger::Get(UIVars& vars, UIId id)
387 {
388     return vars.chains.GetLocusArrangerRelativeTiming();
389 }
390 
Set(UIVars & vars,UIId id,double val)391 void uiLocusArranger::Set(UIVars& vars, UIId id, double val)
392 {
393     vars.chains.SetLocusArrangerRelativeTiming(val);
394 }
395 
396 /// uiHapArranger
397 
uiHapArranger()398 uiHapArranger::uiHapArranger()
399     : SetGetDouble(uistr::hapArranger)
400 {
401 }
402 
~uiHapArranger()403 uiHapArranger::~uiHapArranger()
404 {
405 }
406 
Get(UIVars & vars,UIId id)407 double uiHapArranger::Get(UIVars& vars, UIId id)
408 {
409     return vars.chains.GetHaplotypeArrangerRelativeTiming();
410 }
411 
Set(UIVars & vars,UIId id,double val)412 void uiHapArranger::Set(UIVars& vars, UIId id, double val)
413 {
414     vars.chains.SetHaplotypeArrangerRelativeTiming(val);
415 }
416 
417 /// uiProbHapArranger
418 
uiProbHapArranger()419 uiProbHapArranger::uiProbHapArranger()
420     : SetGetDouble(uistr::probhapArranger)
421 {
422 }
423 
~uiProbHapArranger()424 uiProbHapArranger::~uiProbHapArranger()
425 {
426 }
427 
Get(UIVars & vars,UIId id)428 double uiProbHapArranger::Get(UIVars& vars, UIId id)
429 {
430     return vars.chains.GetProbHapArrangerRelativeTiming();
431 }
432 
Set(UIVars & vars,UIId id,double val)433 void uiProbHapArranger::Set(UIVars& vars, UIId id, double val)
434 {
435     vars.chains.SetProbHapArrangerRelativeTiming(val);
436 }
437 
438 /// uiZilchArranger
439 
uiZilchArranger()440 uiZilchArranger::uiZilchArranger()
441     : SetGetDouble(uistr::zilchArranger)
442 {
443 }
444 
~uiZilchArranger()445 uiZilchArranger::~uiZilchArranger()
446 {
447 }
448 
Get(UIVars & vars,UIId id)449 double uiZilchArranger::Get(UIVars& vars, UIId id)
450 {
451     return vars.chains.GetZilchArrangerRelativeTiming();
452 }
453 
Set(UIVars & vars,UIId id,double val)454 void uiZilchArranger::Set(UIVars& vars, UIId id, double val)
455 {
456     vars.chains.SetZilchArrangerRelativeTiming(val);
457 }
458 
459 /// uiStairArranger
460 
uiStairArranger()461 uiStairArranger::uiStairArranger()
462     : SetGetDouble(uistr::stairArranger)
463 {
464 }
465 
~uiStairArranger()466 uiStairArranger::~uiStairArranger()
467 {
468 }
469 
Get(UIVars & vars,UIId id)470 double uiStairArranger::Get(UIVars& vars, UIId id)
471 {
472     return vars.chains.GetStairArrangerRelativeTiming();
473 }
474 
Set(UIVars & vars,UIId id,double val)475 void uiStairArranger::Set(UIVars& vars, UIId id, double val)
476 {
477     vars.chains.SetStairArrangerRelativeTiming(val);
478 }
479 
480 /// uiEpochSizeArranger
481 
uiEpochSizeArranger()482 uiEpochSizeArranger::uiEpochSizeArranger()
483     : SetGetDouble(uistr::epochSizeArranger)
484 {
485 }
486 
~uiEpochSizeArranger()487 uiEpochSizeArranger::~uiEpochSizeArranger()
488 {
489 }
490 
Get(UIVars & vars,UIId id)491 double uiEpochSizeArranger::Get(UIVars& vars, UIId id)
492 {
493     return vars.chains.GetEpochSizeArrangerRelativeTiming();
494 }
495 
Set(UIVars & vars,UIId id,double val)496 void uiEpochSizeArranger::Set(UIVars& vars, UIId id, double val)
497 {
498     vars.chains.SetEpochSizeArrangerRelativeTiming(val);
499 }
500 
501 /// uiCanHapArrange
502 
uiCanHapArrange()503 uiCanHapArrange::uiCanHapArrange()
504     : GetBool(uistr::canHapArrange)
505 {
506 }
507 
~uiCanHapArrange()508 uiCanHapArrange::~uiCanHapArrange()
509 {
510 }
511 
Get(UIVars & vars,UIId id)512 bool uiCanHapArrange::Get(UIVars& vars, UIId id)
513 {
514     return vars.chains.GetHaplotypeArrangerPossible();
515 }
516 
517 /// uiBayesianAnalysis
518 
uiBayesianAnalysis()519 uiBayesianAnalysis::uiBayesianAnalysis()
520     : SetGetBoolBayesLike(uistr::bayesian)
521 {
522 }
523 
~uiBayesianAnalysis()524 uiBayesianAnalysis::~uiBayesianAnalysis()
525 {
526 }
527 
Get(UIVars & vars,UIId id)528 bool uiBayesianAnalysis::Get(UIVars& vars, UIId id)
529 {
530     return vars.chains.GetDoBayesianAnalysis();
531 }
532 
Set(UIVars & vars,UIId id,bool val)533 void uiBayesianAnalysis::Set(UIVars& vars, UIId id, bool val)
534 {
535     vars.chains.SetDoBayesianAnalysis(val);
536 }
537 
538 //____________________________________________________________________________________
539