1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.analysis; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertFalse; |
25 |
|
import static org.testng.Assert.assertNull; |
26 |
|
import static org.testng.Assert.assertSame; |
27 |
|
|
28 |
|
import java.util.Iterator; |
29 |
|
|
30 |
|
import org.testng.annotations.Test; |
31 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (184) |
Complexity: 8 |
Complexity Density: 0.05 |
|
32 |
|
public class GeneticCodesTest |
33 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
34 |
1 |
@Test(groups = "Functional")... |
35 |
|
public void testGetCodeTable() |
36 |
|
{ |
37 |
1 |
GeneticCodes codes = GeneticCodes.getInstance(); |
38 |
1 |
assertEquals(codes.getStandardCodeTable().getName(), "Standard"); |
39 |
1 |
assertEquals(codes.getStandardCodeTable().getId(), "1"); |
40 |
1 |
assertSame(codes.getStandardCodeTable(), codes.getCodeTable("1")); |
41 |
1 |
assertEquals(codes.getCodeTable("2").getName(), |
42 |
|
"Vertebrate Mitochondrial"); |
43 |
1 |
assertEquals(codes.getCodeTable("11").getName(), |
44 |
|
"Bacterial, Archaeal and Plant Plastid"); |
45 |
1 |
assertEquals(codes.getCodeTable("31").getName(), |
46 |
|
"Blastocrithidia Nuclear"); |
47 |
|
} |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
1PASS
|
|
49 |
1 |
@Test(groups = "Functional")... |
50 |
|
public void testGetCodeTables() |
51 |
|
{ |
52 |
1 |
GeneticCodes codes = GeneticCodes.getInstance(); |
53 |
1 |
Iterator<GeneticCodeI> tableIterator = codes.getCodeTables().iterator(); |
54 |
1 |
String[] ids = new String[] { "1", "2", "3", "4", "5", "6", "9", "10", |
55 |
|
"11", "12", "13", "14", "15", "16", "21", "22", "23", "24", "25", |
56 |
|
"26", "27", "28", "29", "30", "31" }; |
57 |
26 |
for (int i = 0; i < ids.length; i++) |
58 |
|
{ |
59 |
25 |
assertEquals(tableIterator.next().getId(), ids[i]); |
60 |
|
} |
61 |
1 |
assertFalse(tableIterator.hasNext()); |
62 |
|
} |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
64 |
1 |
@Test(groups = "Functional")... |
65 |
|
public void testTranslate() |
66 |
|
{ |
67 |
1 |
GeneticCodes codes = GeneticCodes.getInstance(); |
68 |
|
|
69 |
1 |
GeneticCodeI gc = codes.getCodeTable("1"); |
70 |
1 |
assertNull(gc.translate("XYZ")); |
71 |
1 |
assertEquals(gc.translate("AGA"), "R"); |
72 |
|
|
73 |
1 |
gc = codes.getCodeTable("2"); |
74 |
1 |
assertEquals(gc.translate("AGA"), "*"); |
75 |
1 |
assertEquals(gc.translate("ttc"), "F"); |
76 |
|
|
77 |
|
|
78 |
1 |
gc = codes.getCodeTable("11"); |
79 |
1 |
assertEquals(gc.translate("ttc"), "F"); |
80 |
|
|
81 |
1 |
gc = codes.getCodeTable("31"); |
82 |
1 |
assertEquals(gc.translate("TGA"), "W"); |
83 |
1 |
assertEquals(gc.translate("tag"), "E"); |
84 |
1 |
assertEquals(gc.translate("AGC"), "S"); |
85 |
|
} |
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (65) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
90 |
1 |
@Test(groups = { "Functional" })... |
91 |
|
public void testTranslate_standardTable() |
92 |
|
{ |
93 |
1 |
GeneticCodeI st = GeneticCodes.getInstance().getStandardCodeTable(); |
94 |
1 |
assertEquals("F", st.translate("TTT")); |
95 |
1 |
assertEquals("F", st.translate("TTC")); |
96 |
1 |
assertEquals("L", st.translate("TTA")); |
97 |
1 |
assertEquals("L", st.translate("TTG")); |
98 |
1 |
assertEquals("L", st.translate("CTT")); |
99 |
1 |
assertEquals("L", st.translate("CTC")); |
100 |
1 |
assertEquals("L", st.translate("CTA")); |
101 |
1 |
assertEquals("L", st.translate("CTG")); |
102 |
1 |
assertEquals("I", st.translate("ATT")); |
103 |
1 |
assertEquals("I", st.translate("ATC")); |
104 |
1 |
assertEquals("I", st.translate("ATA")); |
105 |
1 |
assertEquals("M", st.translate("ATG")); |
106 |
1 |
assertEquals("V", st.translate("GTT")); |
107 |
1 |
assertEquals("V", st.translate("GTC")); |
108 |
1 |
assertEquals("V", st.translate("GTA")); |
109 |
1 |
assertEquals("V", st.translate("GTG")); |
110 |
1 |
assertEquals("S", st.translate("TCT")); |
111 |
1 |
assertEquals("S", st.translate("TCC")); |
112 |
1 |
assertEquals("S", st.translate("TCA")); |
113 |
1 |
assertEquals("S", st.translate("TCG")); |
114 |
1 |
assertEquals("P", st.translate("CCT")); |
115 |
1 |
assertEquals("P", st.translate("CCC")); |
116 |
1 |
assertEquals("P", st.translate("CCA")); |
117 |
1 |
assertEquals("P", st.translate("CCG")); |
118 |
1 |
assertEquals("T", st.translate("ACT")); |
119 |
1 |
assertEquals("T", st.translate("ACC")); |
120 |
1 |
assertEquals("T", st.translate("ACA")); |
121 |
1 |
assertEquals("T", st.translate("ACG")); |
122 |
1 |
assertEquals("A", st.translate("GCT")); |
123 |
1 |
assertEquals("A", st.translate("GCC")); |
124 |
1 |
assertEquals("A", st.translate("GCA")); |
125 |
1 |
assertEquals("A", st.translate("GCG")); |
126 |
1 |
assertEquals("Y", st.translate("TAT")); |
127 |
1 |
assertEquals("Y", st.translate("TAC")); |
128 |
1 |
assertEquals("*", st.translate("TAA")); |
129 |
1 |
assertEquals("*", st.translate("TAG")); |
130 |
1 |
assertEquals("H", st.translate("CAT")); |
131 |
1 |
assertEquals("H", st.translate("CAC")); |
132 |
1 |
assertEquals("Q", st.translate("CAA")); |
133 |
1 |
assertEquals("Q", st.translate("CAG")); |
134 |
1 |
assertEquals("N", st.translate("AAT")); |
135 |
1 |
assertEquals("N", st.translate("AAC")); |
136 |
1 |
assertEquals("K", st.translate("AAA")); |
137 |
1 |
assertEquals("K", st.translate("AAG")); |
138 |
1 |
assertEquals("D", st.translate("GAT")); |
139 |
1 |
assertEquals("D", st.translate("GAC")); |
140 |
1 |
assertEquals("E", st.translate("GAA")); |
141 |
1 |
assertEquals("E", st.translate("GAG")); |
142 |
1 |
assertEquals("C", st.translate("TGT")); |
143 |
1 |
assertEquals("C", st.translate("TGC")); |
144 |
1 |
assertEquals("*", st.translate("TGA")); |
145 |
1 |
assertEquals("W", st.translate("TGG")); |
146 |
1 |
assertEquals("R", st.translate("CGT")); |
147 |
1 |
assertEquals("R", st.translate("CGC")); |
148 |
1 |
assertEquals("R", st.translate("CGA")); |
149 |
1 |
assertEquals("R", st.translate("CGG")); |
150 |
1 |
assertEquals("S", st.translate("AGT")); |
151 |
1 |
assertEquals("S", st.translate("AGC")); |
152 |
1 |
assertEquals("R", st.translate("AGA")); |
153 |
1 |
assertEquals("R", st.translate("AGG")); |
154 |
1 |
assertEquals("G", st.translate("GGT")); |
155 |
1 |
assertEquals("G", st.translate("GGC")); |
156 |
1 |
assertEquals("G", st.translate("GGA")); |
157 |
1 |
assertEquals("G", st.translate("GGG")); |
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (56) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
164 |
1 |
@Test(groups = { "Functional" })... |
165 |
|
public void testTranslate_standardTableAmbiguityCodes() |
166 |
|
{ |
167 |
1 |
GeneticCodeI st = GeneticCodes.getInstance().getStandardCodeTable(); |
168 |
|
|
169 |
1 |
assertEquals("C", st.translate("TGY")); |
170 |
|
|
171 |
1 |
assertEquals("L", st.translate("YTA")); |
172 |
|
|
173 |
|
|
174 |
1 |
assertEquals("L", st.translate("CTW")); |
175 |
1 |
assertNull(st.translate("TTW")); |
176 |
|
|
177 |
|
|
178 |
1 |
assertEquals("G", st.translate("GGS")); |
179 |
1 |
assertNull(st.translate("ATS")); |
180 |
|
|
181 |
|
|
182 |
1 |
assertEquals("S", st.translate("TCK")); |
183 |
1 |
assertNull(st.translate("ATK")); |
184 |
|
|
185 |
|
|
186 |
1 |
assertEquals("T", st.translate("ACM")); |
187 |
|
|
188 |
1 |
assertEquals("R", st.translate("MGA")); |
189 |
1 |
assertEquals("R", st.translate("MGG")); |
190 |
1 |
assertNull(st.translate("TAM")); |
191 |
|
|
192 |
|
|
193 |
1 |
assertEquals("P", st.translate("CCD")); |
194 |
1 |
assertNull(st.translate("AAD")); |
195 |
|
|
196 |
|
|
197 |
1 |
assertEquals("V", st.translate("GTV")); |
198 |
1 |
assertNull(st.translate("TTV")); |
199 |
|
|
200 |
|
|
201 |
1 |
assertEquals("A", st.translate("GCH")); |
202 |
1 |
assertEquals("I", st.translate("ATH")); |
203 |
1 |
assertNull(st.translate("AGH")); |
204 |
|
|
205 |
|
|
206 |
1 |
assertEquals("P", st.translate("CCB")); |
207 |
1 |
assertNull(st.translate("TAB")); |
208 |
|
|
209 |
|
|
210 |
|
|
211 |
1 |
assertEquals("L", st.translate("CTR")); |
212 |
1 |
assertEquals("V", st.translate("GTR")); |
213 |
1 |
assertEquals("S", st.translate("TCR")); |
214 |
1 |
assertEquals("P", st.translate("CCR")); |
215 |
1 |
assertEquals("T", st.translate("ACR")); |
216 |
1 |
assertEquals("A", st.translate("GCR")); |
217 |
1 |
assertEquals("R", st.translate("CGR")); |
218 |
1 |
assertEquals("G", st.translate("GGR")); |
219 |
1 |
assertEquals("R", st.translate("AGR")); |
220 |
1 |
assertEquals("E", st.translate("GAR")); |
221 |
1 |
assertEquals("K", st.translate("AAR")); |
222 |
1 |
assertEquals("L", st.translate("TTR")); |
223 |
1 |
assertEquals("Q", st.translate("CAR")); |
224 |
1 |
assertEquals("*", st.translate("TAR")); |
225 |
1 |
assertEquals("*", st.translate("TRA")); |
226 |
|
|
227 |
1 |
assertEquals("R", st.translate("MGR")); |
228 |
1 |
assertNull(st.translate("ATR")); |
229 |
|
|
230 |
|
|
231 |
1 |
assertEquals("L", st.translate("CTN")); |
232 |
1 |
assertEquals("V", st.translate("GTN")); |
233 |
1 |
assertEquals("S", st.translate("TCN")); |
234 |
1 |
assertEquals("P", st.translate("CCN")); |
235 |
1 |
assertEquals("T", st.translate("ACN")); |
236 |
1 |
assertEquals("A", st.translate("GCN")); |
237 |
1 |
assertEquals("R", st.translate("CGN")); |
238 |
1 |
assertEquals("G", st.translate("GGN")); |
239 |
1 |
assertNull(st.translate("ATN")); |
240 |
1 |
assertNull(st.translate("ANT")); |
241 |
1 |
assertNull(st.translate("NAT")); |
242 |
1 |
assertNull(st.translate("ANN")); |
243 |
1 |
assertNull(st.translate("NNA")); |
244 |
1 |
assertNull(st.translate("NNN")); |
245 |
|
|
246 |
|
|
247 |
1 |
assertNull(st.translate("YWB")); |
248 |
1 |
assertNull(st.translate("VHD")); |
249 |
1 |
assertNull(st.translate("WSK")); |
250 |
|
} |
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
|
255 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
256 |
1 |
@Test(groups = { "Functional" })... |
257 |
|
public void testTranslate_nonStandardTableAmbiguityCodes() |
258 |
|
{ |
259 |
1 |
GeneticCodeI standard = GeneticCodes.getInstance() |
260 |
|
.getStandardCodeTable(); |
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
1 |
GeneticCodeI gc = GeneticCodes.getInstance().getCodeTable("2"); |
266 |
|
|
267 |
1 |
assertEquals(gc.translate("AGR"), "*"); |
268 |
1 |
assertEquals(standard.translate("AGR"), "R"); |
269 |
|
|
270 |
1 |
assertEquals(gc.translate("TGR"), "W"); |
271 |
1 |
assertNull(standard.translate("TGR")); |
272 |
|
|
273 |
|
|
274 |
|
|
275 |
|
|
276 |
1 |
gc = GeneticCodes.getInstance().getCodeTable("3"); |
277 |
|
|
278 |
1 |
assertEquals(gc.translate("ctn"), "T"); |
279 |
1 |
assertEquals(standard.translate("CTN"), "L"); |
280 |
|
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
1 |
gc = GeneticCodes.getInstance().getCodeTable("12"); |
285 |
|
|
286 |
1 |
assertEquals(gc.translate("CTG"), "S"); |
287 |
1 |
assertNull(gc.translate("CTK")); |
288 |
1 |
assertEquals(standard.translate("CTK"), "L"); |
289 |
1 |
assertEquals(gc.translate("CTH"), "L"); |
290 |
1 |
assertEquals(standard.translate("CTH"), "L"); |
291 |
1 |
assertEquals(standard.translate("CTN"), "L"); |
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
|
296 |
1 |
gc = GeneticCodes.getInstance().getCodeTable("21"); |
297 |
|
|
298 |
1 |
assertNull(gc.translate("AAR")); |
299 |
1 |
assertEquals(standard.translate("AAR"), "K"); |
300 |
|
} |
301 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
302 |
1 |
@Test(groups = "Functional")... |
303 |
|
public void testTranslateCanonical() |
304 |
|
{ |
305 |
1 |
GeneticCodes codes = GeneticCodes.getInstance(); |
306 |
|
|
307 |
1 |
GeneticCodeI gc = codes.getCodeTable("1"); |
308 |
1 |
assertNull(gc.translateCanonical("XYZ")); |
309 |
1 |
assertEquals(gc.translateCanonical("AGA"), "R"); |
310 |
|
|
311 |
1 |
assertNull(gc.translateCanonical("TGY")); |
312 |
|
|
313 |
1 |
gc = codes.getCodeTable("2"); |
314 |
1 |
assertNull(gc.translateCanonical("AGR")); |
315 |
1 |
assertEquals(gc.translateCanonical("AGA"), "*"); |
316 |
1 |
assertEquals(gc.translateCanonical("ttc"), "F"); |
317 |
|
} |
318 |
|
} |