Debian Codegraph @

src/dr/oldevomodel/substmodel/OnePhaseModel.java

raw symbols SCIP
1 /*
2 * OnePhaseModel.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.oldevomodel.substmodel;
27
28 import dr.evolution.datatype.Microsatellite;
29 import dr.inference.model.Parameter;
30 import dr.inference.model.Variable;
31
32 import java.util.ArrayList;
33
34
35 /**
36 * @author Chieh-Hsi Wu
37 *
38 * An abstract for One Phase Microsatellite Models
39 */
40 public abstract class OnePhaseModel extends MicrosatelliteModel{
41 protected ArrayList<Variable<Double>> nestedParams = null;
42
43 /**
44 * Constructor
45 *
46 * @param name Model name
47 * @param microsatellite Microsatellite data type
48 * @param freqModel Equilibrium frequencies
49 * @param parameter Infinitesimal rates
50 */
51 public OnePhaseModel(String name, Microsatellite microsatellite, FrequencyModel freqModel, Parameter parameter){
52 super(name, microsatellite, freqModel, parameter);
53 nestedParams=new ArrayList<Variable<Double>>();
54 }
55
56 /*
57 * adding the parameters only if its not a submodel.
58 */
59 protected void addParam(Variable<Double> param){
60 if(isNested){
61 nestedParams.add(param);
62 }else{
63 super.addVariable(param);
64 }
65 }
66
67 /*
68 * get the parameters in this submodel
69 */
70 public Variable<Double> getNestedParameter(int i){
71 return nestedParams.get(i);
72 }
73
74 /*
75 * get number of nested parameters in the submodel
76 */
77 public int getNestedParameterCount(){
78 return nestedParams.size();
79 }
80
81 /*
82 * The One Phase Models are special cases of the birth-death chain,
83 * and therefore we can use this to calculate the stationay distribution
84 * given a infinitesimal rate matrix.
85 */
86 public void computeStationaryDistribution(){
87 if(useStationaryFreqs){
88 computeOnePhaseStationaryDistribution();
89 }
90 super.computeStationaryDistribution();
91
92 }
93
94
95 }