Debian Codegraph @

src/dr/oldevomodel/ibd/HKYRates.java

raw symbols SCIP
1 /*
2 * HKYRates.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.ibd;
27
28 import dr.oldevomodel.substmodel.FrequencyModel;
29 import dr.oldevomodel.substmodel.HKY;
30 import dr.inference.model.Parameter;
31
32 /**
33 * Package: dr.evomodel.ibd
34 * Description:
35 * <p/>
36 * <p/>
37 * Created by
38 * avaleks ([email protected])
39 * Date: 05-Aug-2008
40 * Time: 09:32:35
41 */
42 public class HKYRates extends HKY {
43 /**
44 * Constructor
45 */
46 public HKYRates(Parameter kappaParameter, FrequencyModel freqModel) {
47 super(kappaParameter, freqModel);
48 }
49
50 public double[] getRelativeRates(double[] rateMatrix) {
51 double kappa = getKappa();
52 double[] freq = getFrequencyModel().getFrequencies();
53 // A - C - G - T
54 rateMatrix[0] = -(freq[1] + freq[3]) - freq[2] * kappa;
55 rateMatrix[1] = freq[1];
56 rateMatrix[2] = freq[2] * kappa;
57 rateMatrix[3] = freq[3];
58
59 rateMatrix[4] = freq[0];
60 rateMatrix[5] = -(freq[0] + freq[2]) - freq[3] * kappa;
61 rateMatrix[6] = freq[2];
62 rateMatrix[7] = freq[3] * kappa;
63
64 rateMatrix[8] = freq[0] * kappa;
65 rateMatrix[9] = freq[1];
66 rateMatrix[10] = -(freq[1] + freq[3]) - freq[0] * kappa;
67 rateMatrix[11] = freq[3];
68
69 rateMatrix[12] = freq[0];
70 rateMatrix[13] = freq[1] * kappa;
71 rateMatrix[14] = freq[2];
72 rateMatrix[15] = -(freq[0] + freq[1]) - freq[1] * kappa;
73
74
75 return rateMatrix;
76 }
77 }