Debian Codegraph @

src/dr/app/beauti/options/PartitionTreePrior.java

raw symbols SCIP
1 /*
2 * PartitionTreePrior.java
3 *
4 * Copyright (c) 2002-2018 Alexei Drummond, Andrew Rambaut and Marc Suchard
5 *
6 * This file is part of BEAST.
7 * See the NOTICE file distributed with this work for additional
8 * information regarding copyright ownership and licensing.
9 *
10 * BEAST is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * BEAST is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with BEAST; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
24 */
25
26 package dr.app.beauti.options;
27
28 import dr.app.beauti.types.*;
29 import dr.evomodel.coalescent.VariableDemographicModel;
30 import dr.evomodel.speciation.CalibrationPoints;
31 import dr.evomodelxml.speciation.BirthDeathEpidemiologyModelParser;
32 import dr.evomodelxml.speciation.BirthDeathModelParser;
33 import dr.evomodelxml.speciation.BirthDeathSerialSamplingModelParser;
34 import dr.math.MathUtils;
35
36 import java.util.List;
37
38 /**
39 * @author Alexei Drummond
40 * @author Andrew Rambaut
41 * @author Walter Xie
42 */
43 public class PartitionTreePrior extends PartitionOptions {
44
45 private static final long serialVersionUID = 8222609132259262723L;
46
47 private TreePriorType nodeHeightPrior = TreePriorType.CONSTANT;
48 private TreePriorParameterizationType parameterization = TreePriorParameterizationType.GROWTH_RATE;
49 private int skylineGroupCount = 10;
50 private TreePriorParameterizationType skylineModel = TreePriorParameterizationType.CONSTANT_SKYLINE;
51 private TreePriorParameterizationType skyrideSmoothing = TreePriorParameterizationType.TIME_AWARE_SKYRIDE;
52 private int skyGridCount = 50;
53 private double skyGridInterval = Double.NaN;
54 private VariableDemographicModel.Type extendedSkylineModel = VariableDemographicModel.Type.LINEAR;
55 private double birthDeathSamplingProportion = 1.0;
56 private PopulationSizeModelType populationSizeModel = PopulationSizeModelType.CONTINUOUS_CONSTANT;
57 private CalibrationPoints.CorrectionType calibCorrectionType = CalibrationPoints.CorrectionType.EXACT;
58 private boolean fixedTree = false;
59
60 public PartitionTreePrior(BeautiOptions options, PartitionTreeModel treeModel) {
61 super(options, treeModel.getName());
62
63 initModelParametersAndOpererators();
64 }
65
66 /**
67 * A copy constructor
68 *
69 * @param options the beauti options
70 * @param name the name of the new model
71 * @param source the source model
72 */
73 public PartitionTreePrior(BeautiOptions options, String name, PartitionTreePrior source) {
74 super(options, name);
75
76 this.nodeHeightPrior = source.nodeHeightPrior;
77 this.parameterization = source.parameterization;
78 this.skylineGroupCount = source.skylineGroupCount;
79 this.skylineModel = source.skylineModel;
80 this.skyrideSmoothing = source.skyrideSmoothing;
81 this.skyGridCount = source.skyGridCount;
82 this.skyGridInterval = source.skyGridInterval;
83
84 this.extendedSkylineModel = source.extendedSkylineModel;
85 this.birthDeathSamplingProportion = source.birthDeathSamplingProportion;
86 this.populationSizeModel = source.populationSizeModel;
87 this.calibCorrectionType = source.calibCorrectionType;
88 this.fixedTree = source.fixedTree;
89
90 initModelParametersAndOpererators();
91 }
92
93 @Override
94 public void initModelParametersAndOpererators() {
95
96 createParameterOneOverXPrior("constant.popSize", "coalescent population size parameter",
97 PriorScaleType.TIME_SCALE, 1.0);
98
99 createParameterOneOverXPrior("exponential.popSize", "coalescent population size parameter",
100 PriorScaleType.TIME_SCALE, 1.0);
101 createParameterLaplacePrior("exponential.growthRate", "coalescent growth rate parameter",
102 PriorScaleType.GROWTH_RATE_SCALE, 0.0, 0.0, 1.0);
103 createParameterGammaPrior("exponential.doublingTime", "coalescent doubling time parameter",
104 PriorScaleType.NONE, 100.0, 0.001, 1000, true);
105
106 createParameterOneOverXPrior("logistic.popSize", "coalescent population size parameter",
107 PriorScaleType.TIME_SCALE, 1.0);
108 createParameterLaplacePrior("logistic.growthRate", "coalescent logistic growth rate parameter",
109 PriorScaleType.GROWTH_RATE_SCALE, 0.1, 0.0, 1.0);
110 createParameterGammaPrior("logistic.doublingTime", "coalescent doubling time parameter",
111 PriorScaleType.NONE, 100.0, 0.001, 1000, true);
112 createParameterGammaPrior("logistic.t50", "logistic shape parameter",
113 PriorScaleType.NONE, 1.0, 0.001, 1000, true);
114
115 createParameterOneOverXPrior("expansion.popSize", "coalescent population size parameter",
116 PriorScaleType.TIME_SCALE, 1.0);
117 createParameterLaplacePrior("expansion.growthRate", "coalescent expansion growth rate parameter",
118 PriorScaleType.GROWTH_RATE_SCALE, 0.1, 0.0, 1.0);
119 createParameterGammaPrior("expansion.doublingTime", "coalescent doubling time parameter",
120 PriorScaleType.NONE, 100.0, 0.001, 1000, true);
121 createZeroOneParameterUniformPrior("expansion.ancestralProportion", "ancestral population proportion", 0.1);
122
123 createNonNegativeParameterUniformPrior("skyline.popSize", "Bayesian Skyline population sizes",
124 PriorScaleType.TIME_SCALE, 1.0, 0.0, Parameter.UNIFORM_MAX_BOUND);
125 createParameter("skyline.groupSize", "Bayesian Skyline group sizes");
126 // skyride.logPopSize is log unit unlike other popSize
127 createParameterUniformPrior("skyride.logPopSize", "GMRF Bayesian skyride population sizes (log unit)",
128 PriorScaleType.LOG_TIME_SCALE, 1.0, -Parameter.UNIFORM_MAX_BOUND, Parameter.UNIFORM_MAX_BOUND);
129 createParameter("skyride.groupSize", "GMRF Bayesian skyride group sizes (for backward compatibility)");
130 createParameterGammaPrior("skyride.precision", "GMRF Bayesian skyride precision",
131 PriorScaleType.NONE, 1.0, 0.001, 1000, true);
132
133 createParameterUniformPrior("skygrid.logPopSize", "GMRF Bayesian SkyGrid population sizes (log unit)",
134 PriorScaleType.LOG_TIME_SCALE, 1.0, -Parameter.UNIFORM_MAX_BOUND, Parameter.UNIFORM_MAX_BOUND);
135 createParameterGammaPrior("skygrid.precision", "GMRF Bayesian SkyGrid precision",
136 PriorScaleType.NONE, 0.1, 0.001, 1000, true);
137 createParameterUniformPrior("skygrid.numGridPoints", "GMRF Bayesian SkyGrid number of grid points)",
138 PriorScaleType.NONE, 1.0, -Parameter.UNIFORM_MAX_BOUND, Parameter.UNIFORM_MAX_BOUND);
139 createParameterUniformPrior("skygrid.cutOff", "GMRF Bayesian SkyGrid cut-off time",
140 PriorScaleType.TIME_SCALE, 1.0, 0.0, Parameter.UNIFORM_MAX_BOUND);
141
142 createNonNegativeParameterUniformPrior("demographic.popSize", "Extended Bayesian Skyline population sizes",
143 PriorScaleType.TIME_SCALE, 1.0, 0.0, Parameter.UNIFORM_MAX_BOUND);
144 createParameter("demographic.indicators", "Extended Bayesian Skyline population switch", 0.0);
145 createParameterOneOverXPrior("demographic.populationMean", "Extended Bayesian Skyline population prior mean",
146 PriorScaleType.TIME_SCALE, 1);
147
148 createDiscreteStatistic("demographic.populationSizeChanges", "Average number of population change points"); // POISSON_PRIOR
149
150 /*createNonNegativeParameterUniformPrior("yule.birthRate", "Yule speciation process birth rate",
151 PriorScaleType.BIRTH_RATE_SCALE, 1.0, 0.0, Parameter.UNIFORM_MAX_BOUND);*/
152 createParameterLognormalPrior("yule.birthRate", "Yule speciation process birth rate",
153 PriorScaleType.NONE, 2.0, 1.0, 1.5, 0.0);
154
155 /*createNonNegativeParameterUniformPrior(BirthDeathModelParser.MEAN_GROWTH_RATE_PARAM_NAME, "Birth-Death speciation process rate",
156 PriorScaleType.BIRTH_RATE_SCALE, 0.01, 0.0, 100000.0);*/
157 createParameterLognormalPrior(BirthDeathModelParser.MEAN_GROWTH_RATE_PARAM_NAME, "Birth-Death speciation process rate",
158 PriorScaleType.NONE, 2.0, 1.0, 1.5, 0.0);
159 createNonNegativeParameterUniformPrior(BirthDeathModelParser.RELATIVE_DEATH_RATE_PARAM_NAME, "Birth-Death speciation process relative death rate",
160 PriorScaleType.NONE, 0.5, 0.0, 1.0);
161 createParameterBetaDistributionPrior(BirthDeathModelParser.BIRTH_DEATH + "." + BirthDeathModelParser.SAMPLE_PROB,
162 "Birth-Death the proportion of taxa sampled from birth-death tree",
163 0.01, 1.0, 1.0, 0.0);
164 /*createNonNegativeParameterUniformPrior(BirthDeathSerialSamplingModelParser.BDSS + "."
165 + BirthDeathSerialSamplingModelParser.LAMBDA,
166 "Birth-Death speciation process rate", PriorScaleType.BIRTH_RATE_SCALE,
167 2.0, 0.0, 100000.0);*/
168 createParameterLognormalPrior(BirthDeathSerialSamplingModelParser.BDSS + "."
169 + BirthDeathSerialSamplingModelParser.LAMBDA,"Birth-Death speciation process rate",
170 PriorScaleType.NONE, 2.0, 1.0, 1.5, 0.0);
171 createZeroOneParameterUniformPrior(BirthDeathSerialSamplingModelParser.BDSS + "."
172 + BirthDeathSerialSamplingModelParser.RELATIVE_MU,
173 "Birth-Death relative death rate", 0.5);
174
175 /*createNonNegativeParameterUniformPrior(BirthDeathSerialSamplingModelParser.BDSS + "."
176 + BirthDeathSerialSamplingModelParser.PSI,
177 "Birth-Death rate of sampling taxa through time", PriorScaleType.NONE,
178 0.05, 0.0, 100.0);*/
179 createParameterLognormalPrior(BirthDeathSerialSamplingModelParser.BDSS + "."
180 + BirthDeathSerialSamplingModelParser.PSI,"Birth-Death rate of sampling taxa through time",
181 PriorScaleType.NONE, 2.0, 1.0, 1.5, 0.0);
182 /*createNonNegativeParameterUniformPrior(BirthDeathSerialSamplingModelParser.BDSS + "."
183 + BirthDeathSerialSamplingModelParser.ORIGIN,
184 "Birth-Death the time of the lineage originated (must > root height)", PriorScaleType.ORIGIN_SCALE,
185 1.0, 0.0, Parameter.UNIFORM_MAX_BOUND);*/
186 createParameterLognormalPrior(BirthDeathSerialSamplingModelParser.BDSS + "."
187 + BirthDeathSerialSamplingModelParser.ORIGIN,"Birth-Death the time of the lineage originated (must > root height)",
188 PriorScaleType.NONE, 2.0, 1.0, 1.5, 0.0);
189
190 /*createNonNegativeParameterUniformPrior(BirthDeathEpidemiologyModelParser.ORIGIN,
191 "The origin of the infection, x0 > tree.rootHeight", PriorScaleType.ORIGIN_SCALE,
192 1.0, 0.0, Parameter.UNIFORM_MAX_BOUND);*/
193 createParameterLognormalPrior(BirthDeathEpidemiologyModelParser.ORIGIN,
194 "The origin of the infection, x0 > tree.rootHeight",
195 PriorScaleType.NONE, 2.0, 1.0, 1.5, 0.0);
196 createParameterLognormalPrior(BirthDeathEpidemiologyModelParser.R0, "R0",
197 PriorScaleType.NONE, 2.0, 1.0, 1.25, 0.0);
198 /*createNonNegativeParameterUniformPrior(BirthDeathEpidemiologyModelParser.RECOVERY_RATE,
199 "recoveryRate", PriorScaleType.NONE,
200 0.05, 0.0, 100.0);*/
201 createParameterLognormalPrior(BirthDeathEpidemiologyModelParser.RECOVERY_RATE,"recoveryRate",
202 PriorScaleType.NONE, 2.0, 1.0, 1.5, 0.0);
203 createParameterBetaDistributionPrior(BirthDeathEpidemiologyModelParser.SAMPLING_PROBABILITY,
204 "samplingProbability",
205 0.01, 1.0, 1.0, 0.0);
206
207 createScaleOperator("constant.popSize", demoTuning, demoWeights);
208 createScaleOperator("exponential.popSize", demoTuning, demoWeights);
209 createOperator("exponential.growthRate", OperatorType.RANDOM_WALK, 1.0, demoWeights);
210 createScaleOperator("exponential.doublingTime", demoTuning, demoWeights);
211 createScaleOperator("logistic.popSize", demoTuning, demoWeights);
212 createOperator("logistic.growthRate", OperatorType.RANDOM_WALK, 1.0, demoWeights);
213 // createScaleOperator("logistic.growthRate", demoTuning, demoWeights);
214 createScaleOperator("logistic.doublingTime", demoTuning, demoWeights);
215 createScaleOperator("logistic.t50", demoTuning, demoWeights);
216 createScaleOperator("expansion.popSize", demoTuning, demoWeights);
217 createOperator("expansion.growthRate", OperatorType.RANDOM_WALK, 1.0, demoWeights);
218 // createScaleOperator("expansion.growthRate", demoTuning, demoWeights);
219 createScaleOperator("expansion.doublingTime", demoTuning, demoWeights);
220 //createScaleOperator("expansion.ancestralProportion", demoTuning, demoWeights);
221 createOperator("expansion.ancestralProportion", OperatorType.RANDOM_WALK_LOGIT, demoTuning, demoWeights);
222 createScaleOperator("skyline.popSize", demoTuning, demoWeights * 5);
223 createOperator("skyline.groupSize", OperatorType.INTEGER_DELTA_EXCHANGE, 1.0, demoWeights * 2);
224 createOperator("demographic.populationMean", OperatorType.SCALE, 0.9, demoWeights);
225 createOperator("demographic.indicators", OperatorType.BITFLIP, 1, 2 * treeWeights);
226
227 // hack pass distribution in name
228 createOperatorUsing2Parameters("demographic.popSize", "demographic.populationMeanDist", "", "demographic.popSize",
229 "demographic.indicators", OperatorType.SAMPLE_NONACTIVE, 1, 5 * demoWeights);
230 createOperatorUsing2Parameters("demographic.scaleActive", "demographic.scaleActive", "", "demographic.popSize",
231 "demographic.indicators", OperatorType.SCALE_WITH_INDICATORS, 0.5, 2 * demoWeights);
232 createOperatorUsing2Parameters("gmrfGibbsOperator", "gmrfGibbsOperator", "Gibbs sampler for GMRF Skyride", "skyride.logPopSize",
233 "skyride.precision", OperatorType.GMRF_GIBBS_OPERATOR, 2, 2);
234 createOperatorUsing2Parameters("gmrfSkyGridGibbsOperator", "gmrfGibbsOperator", "Gibbs sampler for Bayesian SkyGrid", "skygrid.logPopSize",
235 "skygrid.precision", OperatorType.SKY_GRID_GIBBS_OPERATOR, 1.0, 2);
236 createScaleOperator("skygrid.precision", "description", 0.75, 1.0);
237
238 createScaleOperator("yule.birthRate", demoTuning, demoWeights);
239
240 createScaleOperator(BirthDeathModelParser.MEAN_GROWTH_RATE_PARAM_NAME, demoTuning, demoWeights);
241 //createScaleOperator(BirthDeathModelParser.RELATIVE_DEATH_RATE_PARAM_NAME, demoTuning, demoWeights);
242 createOperator(BirthDeathModelParser.RELATIVE_DEATH_RATE_PARAM_NAME, OperatorType.RANDOM_WALK_LOGIT, demoTuning, demoWeights);
243
244 createScaleOperator(BirthDeathModelParser.BIRTH_DEATH + "." + BirthDeathModelParser.SAMPLE_PROB, demoTuning, demoWeights);
245 createScaleOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
246 + BirthDeathSerialSamplingModelParser.LAMBDA, demoTuning, 1);
247 /*createScaleOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
248 + BirthDeathSerialSamplingModelParser.RELATIVE_MU, demoTuning, 1);*/
249 createOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
250 + BirthDeathSerialSamplingModelParser.RELATIVE_MU, OperatorType.RANDOM_WALK_LOGIT, demoTuning, 1);
251 createScaleOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
252 + BirthDeathSerialSamplingModelParser.PSI, demoTuning, 1); // todo random worl op ?
253 createScaleOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
254 + BirthDeathSerialSamplingModelParser.ORIGIN, demoTuning, 1);
255 // createScaleOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
256 // + BirthDeathSerialSamplingModelParser.R, demoTuning, 1);
257 // createScaleOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
258 // + BirthDeathSerialSamplingModelParser.HAS_FINAL_SAMPLE, demoTuning, 1);
259 // createOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
260 // + BirthDeathSerialSamplingModelParser.SAMPLE_BECOMES_NON_INFECTIOUS,
261 // OperatorType.RANDOM_WALK, 1.0, demoWeights);
262
263 createScaleOperator(BirthDeathEpidemiologyModelParser.ORIGIN, demoTuning, 1);
264 createScaleOperator(BirthDeathEpidemiologyModelParser.R0, demoTuning, 1);
265 createScaleOperator(BirthDeathEpidemiologyModelParser.RECOVERY_RATE, demoTuning, 1);
266 createScaleOperator(BirthDeathEpidemiologyModelParser.SAMPLING_PROBABILITY, demoTuning, 1);
267 }
268
269 @Override
270 public List<Parameter> selectParameters(List<Parameter> params) {
271 // setAvgRootAndRate();
272
273 if (nodeHeightPrior == TreePriorType.CONSTANT) {
274 params.add(getParameter("constant.popSize"));
275 } else if (nodeHeightPrior == TreePriorType.EXPONENTIAL) {
276 params.add(getParameter("exponential.popSize"));
277 if (parameterization == TreePriorParameterizationType.GROWTH_RATE) {
278 params.add(getParameter("exponential.growthRate"));
279 } else {
280 params.add(getParameter("exponential.doublingTime"));
281 }
282 } else if (nodeHeightPrior == TreePriorType.LOGISTIC) {
283 params.add(getParameter("logistic.popSize"));
284 if (parameterization == TreePriorParameterizationType.GROWTH_RATE) {
285 params.add(getParameter("logistic.growthRate"));
286 } else {
287 params.add(getParameter("logistic.doublingTime"));
288 }
289 params.add(getParameter("logistic.t50"));
290 } else if (nodeHeightPrior == TreePriorType.EXPANSION) {
291 params.add(getParameter("expansion.popSize"));
292 if (parameterization == TreePriorParameterizationType.GROWTH_RATE) {
293 params.add(getParameter("expansion.growthRate"));
294 } else {
295 params.add(getParameter("expansion.doublingTime"));
296 }
297 params.add(getParameter("expansion.ancestralProportion"));
298 } else if (nodeHeightPrior == TreePriorType.SKYLINE) {
299 params.add(getParameter("skyline.popSize"));
300 } else if (nodeHeightPrior == TreePriorType.EXTENDED_SKYLINE) {
301 params.add(getParameter("demographic.populationSizeChanges"));
302 params.add(getParameter("demographic.populationMean"));
303 } else if (nodeHeightPrior == TreePriorType.GMRF_SKYRIDE) {
304 // params.add(getParameter("skyride.popSize")); // force user to use GMRF, not allowed to change
305 params.add(getParameter("skyride.precision"));
306 } else if (nodeHeightPrior == TreePriorType.SKYGRID) {
307 // params.add(getParameter("skyride.popSize")); // force user to use GMRF, not allowed to change
308 params.add(getParameter("skygrid.precision"));
309 } else if (nodeHeightPrior == TreePriorType.YULE || nodeHeightPrior == TreePriorType.YULE_CALIBRATION) {
310 params.add(getParameter("yule.birthRate"));
311 } else if (nodeHeightPrior == TreePriorType.BIRTH_DEATH || nodeHeightPrior == TreePriorType.BIRTH_DEATH_INCOMPLETE_SAMPLING) {
312 params.add(getParameter(BirthDeathModelParser.MEAN_GROWTH_RATE_PARAM_NAME));
313 params.add(getParameter(BirthDeathModelParser.RELATIVE_DEATH_RATE_PARAM_NAME));
314 if (nodeHeightPrior == TreePriorType.BIRTH_DEATH_INCOMPLETE_SAMPLING)
315 params.add(getParameter(BirthDeathModelParser.BIRTH_DEATH + "." + BirthDeathModelParser.SAMPLE_PROB));
316
317 } else if (nodeHeightPrior == TreePriorType.BIRTH_DEATH_SERIAL_SAMPLING) {
318 params.add(getParameter(BirthDeathSerialSamplingModelParser.BDSS + "."
319 + BirthDeathSerialSamplingModelParser.LAMBDA));
320 params.add(getParameter(BirthDeathSerialSamplingModelParser.BDSS + "."
321 + BirthDeathSerialSamplingModelParser.RELATIVE_MU));
322 Parameter psi = getParameter(BirthDeathSerialSamplingModelParser.BDSS + "."
323 + BirthDeathSerialSamplingModelParser.PSI);
324 if (options.maximumTipHeight > 0) {
325 psi.setInitial(MathUtils.round(1 / options.maximumTipHeight, 4));
326 }
327 params.add(psi);
328 params.add(getParameter(BirthDeathSerialSamplingModelParser.BDSS + "."
329 + BirthDeathSerialSamplingModelParser.ORIGIN));
330 // params.add(getParameter(BirthDeathSerialSamplingModelParser.BDSS + "."
331 // + BirthDeathSerialSamplingModelParser.SAMPLE_PROBABILITY));
332
333 } else if (nodeHeightPrior == TreePriorType.BIRTH_DEATH_BASIC_REPRODUCTIVE_NUMBER) {
334 params.add(getParameter(BirthDeathEpidemiologyModelParser.ORIGIN));
335 params.add(getParameter(BirthDeathEpidemiologyModelParser.R0));
336 params.add(getParameter(BirthDeathEpidemiologyModelParser.RECOVERY_RATE));
337 params.add(getParameter(BirthDeathEpidemiologyModelParser.SAMPLING_PROBABILITY));
338
339 }
340 return params;
341 }
342
343 @Override
344 public List<Operator> selectOperators(List<Operator> ops) {
345
346 if (nodeHeightPrior == TreePriorType.CONSTANT) {
347 ops.add(getOperator("constant.popSize"));
348 } else if (nodeHeightPrior == TreePriorType.EXPONENTIAL) {
349 ops.add(getOperator("exponential.popSize"));
350 if (parameterization == TreePriorParameterizationType.GROWTH_RATE) {
351 ops.add(getOperator("exponential.growthRate"));
352 } else {
353 ops.add(getOperator("exponential.doublingTime"));
354 }
355 } else if (nodeHeightPrior == TreePriorType.LOGISTIC) {
356 ops.add(getOperator("logistic.popSize"));
357 if (parameterization == TreePriorParameterizationType.GROWTH_RATE) {
358 ops.add(getOperator("logistic.growthRate"));
359 } else {
360 ops.add(getOperator("logistic.doublingTime"));
361 }
362 ops.add(getOperator("logistic.t50"));
363 } else if (nodeHeightPrior == TreePriorType.EXPANSION) {
364 ops.add(getOperator("expansion.popSize"));
365 if (parameterization == TreePriorParameterizationType.GROWTH_RATE) {
366 ops.add(getOperator("expansion.growthRate"));
367 } else {
368 ops.add(getOperator("expansion.doublingTime"));
369 }
370 ops.add(getOperator("expansion.ancestralProportion"));
371 } else if (nodeHeightPrior == TreePriorType.SKYLINE) {
372 ops.add(getOperator("skyline.popSize"));
373 ops.add(getOperator("skyline.groupSize"));
374 } else if (nodeHeightPrior == TreePriorType.GMRF_SKYRIDE) {
375 ops.add(getOperator("gmrfGibbsOperator"));
376 } else if (nodeHeightPrior == TreePriorType.SKYGRID) {
377 ops.add(getOperator("gmrfSkyGridGibbsOperator"));
378 ops.add(getOperator("skygrid.precision"));
379 } else if (nodeHeightPrior == TreePriorType.EXTENDED_SKYLINE) {
380 ops.add(getOperator("demographic.populationMean"));
381 ops.add(getOperator("demographic.popSize"));
382 ops.add(getOperator("demographic.indicators"));
383 ops.add(getOperator("demographic.scaleActive"));
384 } else if (nodeHeightPrior == TreePriorType.YULE || nodeHeightPrior == TreePriorType.YULE_CALIBRATION) {
385 ops.add(getOperator("yule.birthRate"));
386 } else if (nodeHeightPrior == TreePriorType.BIRTH_DEATH || nodeHeightPrior == TreePriorType.BIRTH_DEATH_INCOMPLETE_SAMPLING) {
387 ops.add(getOperator(BirthDeathModelParser.MEAN_GROWTH_RATE_PARAM_NAME));
388 ops.add(getOperator(BirthDeathModelParser.RELATIVE_DEATH_RATE_PARAM_NAME));
389 if (nodeHeightPrior == TreePriorType.BIRTH_DEATH_INCOMPLETE_SAMPLING)
390 ops.add(getOperator(BirthDeathModelParser.BIRTH_DEATH + "." + BirthDeathModelParser.SAMPLE_PROB));
391 } else if (nodeHeightPrior == TreePriorType.BIRTH_DEATH_SERIAL_SAMPLING) {
392 ops.add(getOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
393 + BirthDeathSerialSamplingModelParser.LAMBDA));
394 ops.add(getOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
395 + BirthDeathSerialSamplingModelParser.RELATIVE_MU));
396 ops.add(getOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
397 + BirthDeathSerialSamplingModelParser.PSI));
398 ops.add(getOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
399 + BirthDeathSerialSamplingModelParser.ORIGIN));
400 // ops.add(getOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
401 // + BirthDeathSerialSamplingModelParser.SAMPLE_PROBABILITY));
402
403 // if (nodeHeightPrior == TreePriorType.BIRTH_DEATH_BASIC_REPRODUCTIVE_NUMBER) {
404 // ops.add(getOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
405 // + BirthDeathSerialSamplingModelParser.R));
406 // ops.add(getOperator(BirthDeathSerialSamplingModelParser.BDSS + "."
407 // + BirthDeathSerialSamplingModelParser.HAS_FINAL_SAMPLE));
408 // }
409 } else if (nodeHeightPrior == TreePriorType.BIRTH_DEATH_BASIC_REPRODUCTIVE_NUMBER) {
410 ops.add(getOperator(BirthDeathEpidemiologyModelParser.ORIGIN));
411 ops.add(getOperator(BirthDeathEpidemiologyModelParser.R0));
412 ops.add(getOperator(BirthDeathEpidemiologyModelParser.RECOVERY_RATE));
413 ops.add(getOperator(BirthDeathEpidemiologyModelParser.SAMPLING_PROBABILITY));
414 }
415 return ops;
416 }
417
418
419 //////////////////////////////////////////////////////
420 public String getPrefix() {
421 String prefix = "";
422 if (options.getPartitionTreePriors().size() > 1) {//|| options.isSpeciesAnalysis()
423 // There is more than one active partition model, or doing species analysis
424 prefix += getName() + ".";
425 }
426 return prefix;
427 }
428
429 /////////////////////////////////////////////////////////////////////////
430
431 public TreePriorType getNodeHeightPrior() {
432 return nodeHeightPrior;
433 }
434
435 public void setNodeHeightPrior(TreePriorType nodeHeightPrior) {
436 this.nodeHeightPrior = nodeHeightPrior;
437 }
438
439 public TreePriorParameterizationType getParameterization() {
440 return parameterization;
441 }
442
443 public void setParameterization(TreePriorParameterizationType parameterization) {
444 this.parameterization = parameterization;
445 }
446
447 public int getSkylineGroupCount() {
448 return skylineGroupCount;
449 }
450
451 public void setSkylineGroupCount(int skylineGroupCount) {
452 this.skylineGroupCount = skylineGroupCount;
453 }
454
455 public TreePriorParameterizationType getSkylineModel() {
456 return skylineModel;
457 }
458
459 public void setSkylineModel(TreePriorParameterizationType skylineModel) {
460 this.skylineModel = skylineModel;
461 }
462
463 public TreePriorParameterizationType getSkyrideSmoothing() {
464 return skyrideSmoothing;
465 }
466
467 public void setSkyrideSmoothing(TreePriorParameterizationType skyrideSmoothing) {
468 this.skyrideSmoothing = skyrideSmoothing;
469 }
470
471 public int getSkyGridCount() {
472 return skyGridCount;
473 }
474
475 public void setSkyGridCount(int count) {
476 this.skyGridCount = count;
477 }
478
479 public double getSkyGridInterval() {
480 return skyGridInterval;
481 }
482
483 public void setSkyGridInterval(double x) {
484 this.skyGridInterval = x;
485 }
486
487 public double getBirthDeathSamplingProportion() {
488 return birthDeathSamplingProportion;
489 }
490
491 public void setBirthDeathSamplingProportion(double birthDeathSamplingProportion) {
492 this.birthDeathSamplingProportion = birthDeathSamplingProportion;
493 }
494
495 public boolean isFixedTree() {
496 return fixedTree;
497 }
498
499 public void setFixedTree(boolean fixedTree) {
500 this.fixedTree = fixedTree;
501 }
502
503 public void setExtendedSkylineModel(VariableDemographicModel.Type extendedSkylineModel) {
504 this.extendedSkylineModel = extendedSkylineModel;
505 }
506
507 public VariableDemographicModel.Type getExtendedSkylineModel() {
508 return extendedSkylineModel;
509 }
510
511 public PopulationSizeModelType getPopulationSizeModel() {
512 return populationSizeModel;
513 }
514
515 public void setPopulationSizeModel(PopulationSizeModelType populationSizeModel) {
516 this.populationSizeModel = populationSizeModel;
517 }
518
519 public CalibrationPoints.CorrectionType getCalibCorrectionType() {
520 return calibCorrectionType;
521 }
522
523 public void setCalibCorrectionType(CalibrationPoints.CorrectionType calibCorrectionType) {
524 this.calibCorrectionType = calibCorrectionType;
525 }
526
527 public BeautiOptions getOptions() {
528 return options;
529 }
530
531 }