Debian Codegraph @

src/dr/oldevomodel/substmodel/LG.java

raw symbols SCIP
1 /*
2 * LG.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.AminoAcids;
29 import dr.util.Author;
30 import dr.util.Citation;
31
32 import java.util.*;
33
34 /**
35 * LG model of amino acid evolution (Le and Gascuel, 2008)
36 * Le, S. Q. and O. Gascuel. 2008. Mol. Biol. Evol. 25(7):1307-1320.
37 *
38 * @author Guy Baele
39 */
40 public class LG extends EmpiricalRateMatrix.AbstractAminoAcid {
41
42 public static final LG INSTANCE = new LG();
43
44 // The rates below are specified assuming that the amino acids are in this order:
45 // ARNDCQEGHILKMFPSTWYV
46 // but the AminoAcids dataType wants them in this order:
47 // ACDEFGHIKLMNPQRSTVWY
48 // This is solved by calling the setEmpiricalRates and setEmpiricalFrequencies methods
49 private LG() { super("LG");
50
51 int n = AminoAcids.INSTANCE.getStateCount();
52
53 double[][] rate = new double[n][n];
54
55 // Q matrix
56 rate[0][1] = 0.425093;
57 rate[0][2] = 0.276818;
58 rate[0][3] = 0.395144;
59 rate[0][4] = 2.489084;
60 rate[0][5] = 0.969894;
61 rate[0][6] = 1.038545;
62 rate[0][7] = 2.066040;
63 rate[0][8] = 0.358858;
64 rate[0][9] = 0.149830;
65 rate[0][10] = 0.395337;
66 rate[0][11] = 0.536518;
67 rate[0][12] = 1.124035;
68 rate[0][13] = 0.253701;
69 rate[0][14] = 1.177651;
70 rate[0][15] = 4.727182;
71 rate[0][16] = 2.139501;
72 rate[0][17] = 0.180717;
73 rate[0][18] = 0.218959;
74 rate[0][19] = 2.547870;
75
76 rate[1][2] = 0.751878;
77 rate[1][3] = 0.123954;
78 rate[1][4] = 0.534551;
79 rate[1][5] = 2.807908;
80 rate[1][6] = 0.363970;
81 rate[1][7] = 0.390192;
82 rate[1][8] = 2.426601;
83 rate[1][9] = 0.126991;
84 rate[1][10] = 0.301848;
85 rate[1][11] = 6.326067;
86 rate[1][12] = 0.484133;
87 rate[1][13] = 0.052722;
88 rate[1][14] = 0.332533;
89 rate[1][15] = 0.858151;
90 rate[1][16] = 0.578987;
91 rate[1][17] = 0.593607;
92 rate[1][18] = 0.314440;
93 rate[1][19] = 0.170887;
94
95 rate[2][3] = 5.076149;
96 rate[2][4] = 0.528768;
97 rate[2][5] = 1.695752;
98 rate[2][6] = 0.541712;
99 rate[2][7] = 1.437645;
100 rate[2][8] = 4.509238;
101 rate[2][9] = 0.191503;
102 rate[2][10] = 0.068427;
103 rate[2][11] = 2.145078;
104 rate[2][12] = 0.371004;
105 rate[2][13] = 0.089525;
106 rate[2][14] = 0.161787;
107 rate[2][15] = 4.008358;
108 rate[2][16] = 2.000679;
109 rate[2][17] = 0.045376;
110 rate[2][18] = 0.612025;
111 rate[2][19] = 0.083688;
112
113 rate[3][4] = 0.062556;
114 rate[3][5] = 0.523386;
115 rate[3][6] = 5.243870;
116 rate[3][7] = 0.844926;
117 rate[3][8] = 0.927114;
118 rate[3][9] = 0.010690;
119 rate[3][10] = 0.015076;
120 rate[3][11] = 0.282959;
121 rate[3][12] = 0.025548;
122 rate[3][13] = 0.017416;
123 rate[3][14] = 0.394456;
124 rate[3][15] = 1.240275;
125 rate[3][16] = 0.425860;
126 rate[3][17] = 0.029890;
127 rate[3][18] = 0.135107;
128 rate[3][19] = 0.037967;
129
130 rate[4][5] = 0.084808;
131 rate[4][6] = 0.003499;
132 rate[4][7] = 0.569265;
133 rate[4][8] = 0.640543;
134 rate[4][9] = 0.320627;
135 rate[4][10] = 0.594007;
136 rate[4][11] = 0.013266;
137 rate[4][12] = 0.893680;
138 rate[4][13] = 1.105251;
139 rate[4][14] = 0.075382;
140 rate[4][15] = 2.784478;
141 rate[4][16] = 1.143480;
142 rate[4][17] = 0.670128;
143 rate[4][18] = 1.165532;
144 rate[4][19] = 1.959291;
145
146 rate[5][6] = 4.128591;
147 rate[5][7] = 0.267959;
148 rate[5][8] = 4.813505;
149 rate[5][9] = 0.072854;
150 rate[5][10] = 0.582457;
151 rate[5][11] = 3.234294;
152 rate[5][12] = 1.672569;
153 rate[5][13] = 0.035855;
154 rate[5][14] = 0.624294;
155 rate[5][15] = 1.223828;
156 rate[5][16] = 1.080136;
157 rate[5][17] = 0.236199;
158 rate[5][18] = 0.257336;
159 rate[5][19] = 0.210332;
160
161 rate[6][7] = 0.348847;
162 rate[6][8] = 0.423881;
163 rate[6][9] = 0.044265;
164 rate[6][10] = 0.069673;
165 rate[6][11] = 1.807177;
166 rate[6][12] = 0.173735;
167 rate[6][13] = 0.018811;
168 rate[6][14] = 0.419409;
169 rate[6][15] = 0.611973;
170 rate[6][16] = 0.604545;
171 rate[6][17] = 0.077852;
172 rate[6][18] = 0.120037;
173 rate[6][19] = 0.245034;
174
175 rate[7][8] = 0.311484;
176 rate[7][9] = 0.008705;
177 rate[7][10] = 0.044261;
178 rate[7][11] = 0.296636;
179 rate[7][12] = 0.139538;
180 rate[7][13] = 0.089586;
181 rate[7][14] = 0.196961;
182 rate[7][15] = 1.739990;
183 rate[7][16] = 0.129836;
184 rate[7][17] = 0.268491;
185 rate[7][18] = 0.054679;
186 rate[7][19] = 0.076701;
187
188 rate[8][9] = 0.108882;
189 rate[8][10] = 0.366317;
190 rate[8][11] = 0.697264;
191 rate[8][12] = 0.442472;
192 rate[8][13] = 0.682139;
193 rate[8][14] = 0.508851;
194 rate[8][15] = 0.990012;
195 rate[8][16] = 0.584262;
196 rate[8][17] = 0.597054;
197 rate[8][18] = 5.306834;
198 rate[8][19] = 0.119013;
199
200 rate[9][10] = 4.145067;
201 rate[9][11] = 0.159069;
202 rate[9][12] = 4.273607;
203 rate[9][13] = 1.112727;
204 rate[9][14] = 0.078281;
205 rate[9][15] = 0.064105;
206 rate[9][16] = 1.033739;
207 rate[9][17] = 0.111660;
208 rate[9][18] = 0.232523;
209 rate[9][19] = 10.649107;
210
211 rate[10][11] = 0.137500;
212 rate[10][12] = 6.312358;
213 rate[10][13] = 2.592692;
214 rate[10][14] = 0.249060;
215 rate[10][15] = 0.182287;
216 rate[10][16] = 0.302936;
217 rate[10][17] = 0.619632;
218 rate[10][18] = 0.299648;
219 rate[10][19] = 1.702745;
220
221 rate[11][12] = 0.656604;
222 rate[11][13] = 0.023918;
223 rate[11][14] = 0.390322;
224 rate[11][15] = 0.748683;
225 rate[11][16] = 1.136863;
226 rate[11][17] = 0.049906;
227 rate[11][18] = 0.131932;
228 rate[11][19] = 0.185202;
229
230 rate[12][13] = 1.798853;
231 rate[12][14] = 0.099849;
232 rate[12][15] = 0.346960;
233 rate[12][16] = 2.020366;
234 rate[12][17] = 0.696175;
235 rate[12][18] = 0.481306;
236 rate[12][19] = 1.898718;
237
238 rate[13][14] = 0.094464;
239 rate[13][15] = 0.361819;
240 rate[13][16] = 0.165001;
241 rate[13][17] = 2.457121;
242 rate[13][18] = 7.803902;
243 rate[13][19] = 0.654683;
244
245 rate[14][15] = 1.338132;
246 rate[14][16] = 0.571468;
247 rate[14][17] = 0.095131;
248 rate[14][18] = 0.089613;
249 rate[14][19] = 0.296501;
250
251 rate[15][16] = 6.472279;
252 rate[15][17] = 0.248862;
253 rate[15][18] = 0.400547;
254 rate[15][19] = 0.098369;
255
256 rate[16][17] = 0.140825;
257 rate[16][18] = 0.245841;
258 rate[16][19] = 2.188158;
259
260 rate[17][18] = 3.151815;
261 rate[17][19] = 0.189510;
262
263 rate[18][19] = 0.249313;
264
265 setEmpiricalRates(rate, "ARNDCQEGHILKMFPSTWYV");
266
267 //the order of the amino acid codes below
268 //Ala = A
269 //Arg = R
270 //Asn = N
271 //Asp = D
272 //Cys = C
273 //Gln = Q
274 //Glu = E
275 //Gly = G
276 //His = H
277 //Ile = I
278 //Leu = L
279 //Lys = K
280 //Met = M
281 //Phe = F
282 //Pro = P
283 //Ser = S
284 //Thr = T
285 //Trp = W
286 //Tyr = Y
287 //Val = V
288 double[] f = new double[n];
289 f[0] = 0.079066;
290 f[1] = 0.055941;
291 f[2] = 0.041977;
292 f[3] = 0.053052;
293 f[4] = 0.012937;
294 f[5] = 0.040767;
295 f[6] = 0.071586;
296 f[7] = 0.057337;
297 f[8] = 0.022355;
298 f[9] = 0.062157;
299 f[10] = 0.099081;
300 f[11] = 0.064600;
301 f[12] = 0.022951;
302 f[13] = 0.042302;
303 f[14] = 0.044040;
304 f[15] = 0.061197;
305 f[16] = 0.053287;
306 f[17] = 0.012066;
307 f[18] = 0.034155;
308 f[19] = 0.069147;
309 setEmpiricalFrequencies(f, "ARNDCQEGHILKMFPSTWYV");
310 }
311
312 @Override
313 public Citation.Category getCategory() {
314 return Citation.Category.SUBSTITUTION_MODELS;
315 }
316
317 @Override
318 public String getDescription() {
319 return "LG amino acid substitution model";
320 }
321
322 @Override
323 public List<Citation> getCitations() {
324 return Collections.singletonList(CITATION);
325 }
326
327
328 public static Citation CITATION = new Citation(
329 new Author[]{
330 new Author("S. Q.", "Le"),
331 new Author("O.", "Gascuel")
332 },
333 "An Improved General Amino Acid Replacement Matrix",
334 2008,
335 "Mol. Biol. Evol.",
336 25,
337 1307, 1320,
338 Citation.Status.PUBLISHED
339 );
340 }