Debian Codegraph @

src/dr/evomodel/branchmodel/BranchModel.java

raw symbols SCIP
1 /*
2 * BranchModel.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.evomodel.branchmodel;
27
28 import dr.evomodel.substmodel.FrequencyModel;
29 import dr.evomodel.substmodel.SubstitutionModel;
30 import dr.evolution.tree.NodeRef;
31 import dr.inference.model.Model;
32
33 import java.util.List;
34
35 /**
36 * This is an interface which provides a mapping of substitution models to branches.
37 *
38 * @author Andrew Rambaut
39 * @author Filip Bielejec
40 * @author Marc A. Suchard
41 * @version $Id$
42 */
43 public interface BranchModel extends Model {
44 /**
45 * Returns a mapping of substitution models to the given branch. The Mapping
46 * contains a list of substitution models in order from tipward to rootward
47 * and a set of relative weights for each (may be times or proportions).
48 *
49 * @param branch the branch
50 * @return a Mapping object
51 */
52 Mapping getBranchModelMapping(final NodeRef branch);
53
54 /**
55 * Gets the list of substitution models in order they will be referred to
56 * by the indices returned by the mappings.
57 * @return the list of substitution models
58 */
59 List<SubstitutionModel> getSubstitutionModels();
60
61 /**
62 * Gets the substitution model that will be applied at the root.
63 * @return the substitution model
64 */
65 SubstitutionModel getRootSubstitutionModel();
66
67 /**
68 * Gets the frequency model that will be applied at the root.
69 * @return the substitution model
70 */
71 FrequencyModel getRootFrequencyModel();
72
73 /**
74 * Is this model going to require convolution of matrices along any branches (essentially
75 * are the mappings ever going to return more than one substitution model.
76 * @return does it?
77 */
78 boolean requiresMatrixConvolution();
79
80 interface Mapping {
81 int[] getOrder();
82 double[] getWeights();
83 }
84
85 Mapping DEFAULT = new Mapping() {
86 public int[] getOrder() {
87 return new int[] { 0 };
88 }
89
90 public double[] getWeights() {
91 return new double[] { 1.0 };
92 }
93 };
94 }