Debian Codegraph @

src/dr/app/beauti/components/dollo/DolloComponentOptions.java

raw symbols SCIP
1 /*
2 * DolloComponentOptions.java
3 *
4 * Copyright (c) 2002-2015 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.components.dollo;
27
28 import dr.app.beauti.options.*;
29 import dr.app.beauti.types.PriorScaleType;
30
31 import java.util.List;
32
33 /**
34 * @author Marc Suchard
35 * @version $Id$
36 */
37
38 public class DolloComponentOptions implements ComponentOptions {
39
40 public static final String DEATH_RATE = "death.rate";
41 public static final String DATA_NAME = "binaryDolloDataType";
42 public static final String MODEL_NAME = "binaryDolloSubstModel";
43
44 final private BeautiOptions options;
45
46 public DolloComponentOptions(final BeautiOptions options) {
47 this.options = options;
48 }
49
50 public void createParameters(ModelOptions modelOptions) {
51 for (AbstractPartitionData partition : options.dataPartitions) {
52 if (partition.getPartitionSubstitutionModel().isDolloModel()) {
53 String prefix = partition.getName() + ".";
54 modelOptions.createParameterExponentialPrior(prefix + DEATH_RATE, "Stochastic Dollo death rate",
55 PriorScaleType.SUBSTITUTION_RATE_SCALE, 1.0E-5, 1.0E-4, 0.0);
56 modelOptions.createScaleOperator(prefix + DEATH_RATE, modelOptions.demoTuning, 1.0);
57 }
58 }
59 }
60
61 public void selectOperators(ModelOptions modelOptions, List<Operator> ops) {
62 for (AbstractPartitionData partition : options.dataPartitions) {
63 PartitionSubstitutionModel model = partition.getPartitionSubstitutionModel();
64 if (model.isDolloModel()) {
65 String prefix = partition.getName() + ".";
66 ops.add(modelOptions.getOperator(prefix + DEATH_RATE));
67 }
68 }
69 }
70
71 public void selectParameters(ModelOptions modelOptions,
72 List<Parameter> params) {
73 for (AbstractPartitionData partition : options.dataPartitions) {
74 PartitionSubstitutionModel model = partition.getPartitionSubstitutionModel();
75 if (model.isDolloModel()) {
76 String prefix = partition.getName() + ".";
77 params.add(modelOptions.getParameter(prefix + DEATH_RATE));
78 break;
79 }
80 }
81 }
82
83 public void selectStatistics(ModelOptions modelOptions,
84 List<Parameter> stats) {
85 // Do nothing
86 }
87
88 public BeautiOptions getOptions() {
89 return options;
90 }
91
92 public void setActive(boolean active) {
93 this.active = active;
94 }
95
96 public boolean isActive() {
97 return active;
98 }
99
100 private boolean active = false;
101 }