Debian Codegraph @

src/dr/evomodel/substmodel/aminoacid/LG.java

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