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.assertNotEquals; |
24 |
|
import static org.testng.AssertJUnit.assertEquals; |
25 |
|
import static org.testng.AssertJUnit.assertFalse; |
26 |
|
import static org.testng.AssertJUnit.assertNotNull; |
27 |
|
import static org.testng.AssertJUnit.assertNull; |
28 |
|
import static org.testng.AssertJUnit.assertSame; |
29 |
|
import static org.testng.AssertJUnit.assertTrue; |
30 |
|
|
31 |
|
import java.awt.Color; |
32 |
|
import java.io.IOException; |
33 |
|
import java.util.ArrayList; |
34 |
|
import java.util.Arrays; |
35 |
|
import java.util.HashMap; |
36 |
|
import java.util.LinkedHashMap; |
37 |
|
import java.util.List; |
38 |
|
import java.util.Map; |
39 |
|
import java.util.Set; |
40 |
|
import java.util.SortedMap; |
41 |
|
import java.util.TreeMap; |
42 |
|
|
43 |
|
import org.testng.Assert; |
44 |
|
import org.testng.annotations.BeforeClass; |
45 |
|
import org.testng.annotations.DataProvider; |
46 |
|
import org.testng.annotations.Test; |
47 |
|
|
48 |
|
import jalview.datamodel.AlignedCodonFrame; |
49 |
|
import jalview.datamodel.Alignment; |
50 |
|
import jalview.datamodel.AlignmentAnnotation; |
51 |
|
import jalview.datamodel.AlignmentI; |
52 |
|
import jalview.datamodel.Annotation; |
53 |
|
import jalview.datamodel.ContactListI; |
54 |
|
import jalview.datamodel.ContactMatrixI; |
55 |
|
import jalview.datamodel.DBRefEntry; |
56 |
|
import jalview.datamodel.GeneLociI; |
57 |
|
import jalview.datamodel.Mapping; |
58 |
|
import jalview.datamodel.SearchResultMatchI; |
59 |
|
import jalview.datamodel.SearchResultsI; |
60 |
|
import jalview.datamodel.SeqDistanceContactMatrix; |
61 |
|
import jalview.datamodel.Sequence; |
62 |
|
import jalview.datamodel.SequenceFeature; |
63 |
|
import jalview.datamodel.SequenceGroup; |
64 |
|
import jalview.datamodel.SequenceI; |
65 |
|
import jalview.gui.JvOptionPane; |
66 |
|
import jalview.io.AppletFormatAdapter; |
67 |
|
import jalview.io.DataSourceType; |
68 |
|
import jalview.io.FileFormat; |
69 |
|
import jalview.io.FileFormatI; |
70 |
|
import jalview.io.FormatAdapter; |
71 |
|
import jalview.io.gff.SequenceOntologyI; |
72 |
|
import jalview.util.Comparison; |
73 |
|
import jalview.util.MapList; |
74 |
|
import jalview.util.MappingUtils; |
75 |
|
|
|
|
| 93.5% |
Uncovered Elements: 88 (1,358) |
Complexity: 61 |
Complexity Density: 0.05 |
|
76 |
|
public class AlignmentUtilsTests |
77 |
|
{ |
78 |
|
private static Sequence ts = new Sequence("short", |
79 |
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm"); |
80 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
|
81 |
1 |
@BeforeClass(alwaysRun = true)... |
82 |
|
public void setUpJvOptionPane() |
83 |
|
{ |
84 |
1 |
JvOptionPane.setInteractiveMode(false); |
85 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
86 |
|
|
87 |
1 |
AlignmentAnnotation ann1 = new AlignmentAnnotation( |
88 |
|
"Secondary Structure", "Secondary Structure", |
89 |
|
new Annotation[] {}); |
90 |
1 |
AlignmentAnnotation ann2 = new AlignmentAnnotation("jnetpred", |
91 |
|
"jnetpred", new Annotation[] {}); |
92 |
1 |
AlignmentAnnotation ann3 = new AlignmentAnnotation("Temp", "Temp", |
93 |
|
new Annotation[] {}); |
94 |
1 |
AlignmentAnnotation ann4 = new AlignmentAnnotation("Temp", "Temp", |
95 |
|
new Annotation[] {}); |
96 |
|
|
97 |
1 |
AlignmentAnnotation[] anns1 = new AlignmentAnnotation[] { ann1, ann3, |
98 |
|
ann4 }; |
99 |
|
|
100 |
1 |
AlignmentAnnotation[] anns2 = new AlignmentAnnotation[] { ann2, ann3, |
101 |
|
ann4 }; |
102 |
|
|
103 |
1 |
AlignmentAnnotation[] anns3 = new AlignmentAnnotation[] { ann3, ann4 }; |
104 |
|
|
105 |
1 |
AlignmentAnnotation[] anns4 = new AlignmentAnnotation[0]; |
106 |
|
|
107 |
1 |
AlignmentAnnotation[] anns5 = new AlignmentAnnotation[] { ann1, ann2, |
108 |
|
ann3, ann4 }; |
109 |
|
} |
110 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (28) |
Complexity: 5 |
Complexity Density: 0.25 |
1PASS
|
|
111 |
1 |
@Test(groups = { "Functional" })... |
112 |
|
public void testExpandContext() |
113 |
|
{ |
114 |
1 |
AlignmentI al = new Alignment(new Sequence[] {}); |
115 |
6 |
for (int i = 4; i < 14; i += 2) |
116 |
|
{ |
117 |
5 |
SequenceI s1 = ts.deriveSequence().getSubSequence(i, i + 7); |
118 |
5 |
al.addSequence(s1); |
119 |
|
} |
120 |
1 |
System.out.println(new AppletFormatAdapter() |
121 |
|
.formatSequences(FileFormat.Clustal, al, true)); |
122 |
27 |
for (int flnk = -1; flnk < 25; flnk++) |
123 |
|
{ |
124 |
26 |
AlignmentI exp = AlignmentUtils.expandContext(al, flnk); |
125 |
26 |
System.out.println("\nFlank size: " + flnk); |
126 |
26 |
System.out.println(new AppletFormatAdapter() |
127 |
|
.formatSequences(FileFormat.Clustal, exp, true)); |
128 |
26 |
if (flnk == -1) |
129 |
|
{ |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
1 |
for (SequenceI sq : exp.getSequences()) |
134 |
|
{ |
135 |
5 |
String ung = sq.getSequenceAsString().replaceAll("-+", ""); |
136 |
5 |
final String errorMsg = "Flanking sequence not the same as original dataset sequence.\n" |
137 |
|
+ ung + "\n" |
138 |
|
+ sq.getDatasetSequence().getSequenceAsString(); |
139 |
5 |
assertTrue(errorMsg, ung.equalsIgnoreCase( |
140 |
|
sq.getDatasetSequence().getSequenceAsString())); |
141 |
|
} |
142 |
|
} |
143 |
25 |
else if (flnk == 24) |
144 |
|
{ |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
1 |
assertTrue(exp.getSequenceAt(4).getSequenceAsString() |
149 |
|
.startsWith("abc")); |
150 |
1 |
assertTrue(exp.getSequenceAt(3).getSequenceAsString() |
151 |
|
.startsWith("--abc")); |
152 |
1 |
assertTrue(exp.getSequenceAt(2).getSequenceAsString() |
153 |
|
.startsWith("----abc")); |
154 |
1 |
assertTrue(exp.getSequenceAt(1).getSequenceAsString() |
155 |
|
.startsWith("------abc")); |
156 |
1 |
assertTrue(exp.getSequenceAt(0).getSequenceAsString() |
157 |
|
.startsWith("--------abc")); |
158 |
|
} |
159 |
|
} |
160 |
|
} |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (43) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
165 |
1 |
@Test(groups = { "Functional" })... |
166 |
|
public void testExpandContext_annotation() |
167 |
|
{ |
168 |
1 |
AlignmentI al = new Alignment(new Sequence[] {}); |
169 |
1 |
SequenceI ds = new Sequence("Seq1", "ABCDEFGHI"); |
170 |
|
|
171 |
1 |
SequenceI seq1 = ds.deriveSequence().getSubSequence(3, 6); |
172 |
1 |
al.addSequence(seq1); |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
1 |
Annotation[] anns = new Annotation[] { new Annotation(4), |
178 |
|
new Annotation(5), new Annotation(6) }; |
179 |
1 |
AlignmentAnnotation ann = new AlignmentAnnotation("SS", |
180 |
|
"secondary structure", anns); |
181 |
1 |
seq1.addAlignmentAnnotation(ann); |
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
1 |
assertEquals(3, ann.annotations.length); |
187 |
1 |
assertEquals(4, ann.annotations[0].value, 0.001); |
188 |
1 |
assertEquals(5, ann.annotations[1].value, 0.001); |
189 |
1 |
assertEquals(6, ann.annotations[2].value, 0.001); |
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
1 |
assertNull(ann.getAnnotationForPosition(1)); |
197 |
1 |
assertNull(ann.getAnnotationForPosition(2)); |
198 |
1 |
assertNull(ann.getAnnotationForPosition(3)); |
199 |
1 |
assertEquals(4, ann.getAnnotationForPosition(4).value, 0.001); |
200 |
1 |
assertEquals(5, ann.getAnnotationForPosition(5).value, 0.001); |
201 |
1 |
assertEquals(6, ann.getAnnotationForPosition(6).value, 0.001); |
202 |
1 |
assertNull(ann.getAnnotationForPosition(7)); |
203 |
1 |
assertNull(ann.getAnnotationForPosition(8)); |
204 |
1 |
assertNull(ann.getAnnotationForPosition(9)); |
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
|
209 |
1 |
AlignmentI expanded = AlignmentUtils.expandContext(al, -1); |
210 |
1 |
assertEquals("abcDEFghi", |
211 |
|
expanded.getSequenceAt(0).getSequenceAsString()); |
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
1 |
ann = expanded.getSequenceAt(0).getAnnotation()[0]; |
218 |
1 |
assertSame(ann, expanded.getAlignmentAnnotation()[0]); |
219 |
1 |
assertSame(expanded.getSequenceAt(0), ann.sequenceRef); |
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
1 |
assertNull(ann.annotations[0]); |
226 |
1 |
assertNull(ann.annotations[1]); |
227 |
1 |
assertNull(ann.annotations[2]); |
228 |
1 |
assertEquals(4, ann.annotations[3].value, 0.001); |
229 |
1 |
assertEquals(5, ann.annotations[4].value, 0.001); |
230 |
1 |
assertEquals(6, ann.annotations[5].value, 0.001); |
231 |
1 |
assertNull(ann.annotations[6]); |
232 |
1 |
assertNull(ann.annotations[7]); |
233 |
1 |
assertNull(ann.annotations[8]); |
234 |
|
|
235 |
|
|
236 |
|
|
237 |
|
|
238 |
1 |
assertNull(ann.getAnnotationForPosition(1)); |
239 |
1 |
assertNull(ann.getAnnotationForPosition(2)); |
240 |
1 |
assertNull(ann.getAnnotationForPosition(3)); |
241 |
1 |
assertEquals(4, ann.getAnnotationForPosition(4).value, 0.001); |
242 |
1 |
assertEquals(5, ann.getAnnotationForPosition(5).value, 0.001); |
243 |
1 |
assertEquals(6, ann.getAnnotationForPosition(6).value, 0.001); |
244 |
1 |
assertNull(ann.getAnnotationForPosition(7)); |
245 |
1 |
assertNull(ann.getAnnotationForPosition(8)); |
246 |
1 |
assertNull(ann.getAnnotationForPosition(9)); |
247 |
|
} |
248 |
|
|
249 |
|
|
250 |
|
|
251 |
|
|
252 |
|
@throws |
253 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
254 |
1 |
@Test(groups = { "Functional" })... |
255 |
|
public void testGetSequencesByName() throws IOException |
256 |
|
{ |
257 |
1 |
final String data = ">Seq1Name\nKQYL\n" + ">Seq2Name\nRFPW\n" |
258 |
|
+ ">Seq1Name\nABCD\n"; |
259 |
1 |
AlignmentI al = loadAlignment(data, FileFormat.Fasta); |
260 |
1 |
Map<String, List<SequenceI>> map = AlignmentUtils |
261 |
|
.getSequencesByName(al); |
262 |
1 |
assertEquals(2, map.keySet().size()); |
263 |
1 |
assertEquals(2, map.get("Seq1Name").size()); |
264 |
1 |
assertEquals("KQYL", map.get("Seq1Name").get(0).getSequenceAsString()); |
265 |
1 |
assertEquals("ABCD", map.get("Seq1Name").get(1).getSequenceAsString()); |
266 |
1 |
assertEquals(1, map.get("Seq2Name").size()); |
267 |
1 |
assertEquals("RFPW", map.get("Seq2Name").get(0).getSequenceAsString()); |
268 |
|
} |
269 |
|
|
270 |
|
|
271 |
|
|
272 |
|
|
273 |
|
@param |
274 |
|
@param |
275 |
|
|
276 |
|
@return |
277 |
|
@throws |
278 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
279 |
1 |
protected AlignmentI loadAlignment(final String data, FileFormatI format)... |
280 |
|
throws IOException |
281 |
|
{ |
282 |
1 |
AlignmentI a = new FormatAdapter().readFile(data, DataSourceType.PASTE, |
283 |
|
format); |
284 |
1 |
a.setDataset(null); |
285 |
1 |
return a; |
286 |
|
} |
287 |
|
|
288 |
|
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
|
293 |
|
@throws |
294 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (37) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
295 |
1 |
@Test(groups = { "Functional" })... |
296 |
|
public void testMapProteinAlignmentToCdna_noXrefs() throws IOException |
297 |
|
{ |
298 |
1 |
List<SequenceI> protseqs = new ArrayList<>(); |
299 |
1 |
protseqs.add(new Sequence("UNIPROT|V12345", "EIQ")); |
300 |
1 |
protseqs.add(new Sequence("UNIPROT|V12346", "EIQ")); |
301 |
1 |
protseqs.add(new Sequence("UNIPROT|V12347", "SAR")); |
302 |
1 |
AlignmentI protein = new Alignment(protseqs.toArray(new SequenceI[3])); |
303 |
1 |
protein.setDataset(null); |
304 |
|
|
305 |
1 |
List<SequenceI> dnaseqs = new ArrayList<>(); |
306 |
1 |
dnaseqs.add(new Sequence("EMBL|A11111", "TCAGCACGC")); |
307 |
1 |
dnaseqs.add(new Sequence("EMBL|A22222", "GAGATACAA")); |
308 |
1 |
dnaseqs.add(new Sequence("EMBL|A33333", "GAAATCCAG")); |
309 |
1 |
dnaseqs.add(new Sequence("EMBL|A44444", "GAAATTCAG")); |
310 |
1 |
AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[4])); |
311 |
1 |
cdna.setDataset(null); |
312 |
|
|
313 |
1 |
assertTrue(AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna)); |
314 |
|
|
315 |
|
|
316 |
1 |
assertEquals(3, protein.getCodonFrames().size()); |
317 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(0)).size()); |
318 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(1)).size()); |
319 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(2)).size()); |
320 |
|
|
321 |
|
|
322 |
1 |
AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0)) |
323 |
|
.get(0); |
324 |
1 |
assertEquals(1, acf.getdnaSeqs().length); |
325 |
1 |
assertEquals(cdna.getSequenceAt(1).getDatasetSequence(), |
326 |
|
acf.getdnaSeqs()[0]); |
327 |
1 |
Mapping[] protMappings = acf.getProtMappings(); |
328 |
1 |
assertEquals(1, protMappings.length); |
329 |
1 |
MapList mapList = protMappings[0].getMap(); |
330 |
1 |
assertEquals(3, mapList.getFromRatio()); |
331 |
1 |
assertEquals(1, mapList.getToRatio()); |
332 |
1 |
assertTrue( |
333 |
|
Arrays.equals(new int[] |
334 |
|
{ 1, 9 }, mapList.getFromRanges().get(0))); |
335 |
1 |
assertEquals(1, mapList.getFromRanges().size()); |
336 |
1 |
assertTrue( |
337 |
|
Arrays.equals(new int[] |
338 |
|
{ 1, 3 }, mapList.getToRanges().get(0))); |
339 |
1 |
assertEquals(1, mapList.getToRanges().size()); |
340 |
|
|
341 |
|
|
342 |
1 |
acf = protein.getCodonFrame(protein.getSequenceAt(1)).get(0); |
343 |
1 |
assertEquals(1, acf.getdnaSeqs().length); |
344 |
1 |
assertEquals(cdna.getSequenceAt(2).getDatasetSequence(), |
345 |
|
acf.getdnaSeqs()[0]); |
346 |
|
|
347 |
|
|
348 |
1 |
acf = protein.getCodonFrame(protein.getSequenceAt(2)).get(0); |
349 |
1 |
assertEquals(1, acf.getdnaSeqs().length); |
350 |
1 |
assertEquals(cdna.getSequenceAt(0).getDatasetSequence(), |
351 |
|
acf.getdnaSeqs()[0]); |
352 |
|
|
353 |
|
|
354 |
1 |
assertTrue(protein.getCodonFrame(cdna.getSequenceAt(3)).isEmpty()); |
355 |
|
} |
356 |
|
|
357 |
|
|
358 |
|
|
359 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
360 |
1 |
@Test(groups = { "Functional" })... |
361 |
|
public void testAlignSequenceAs_withMapping_noIntrons() |
362 |
|
{ |
363 |
1 |
MapList map = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1); |
364 |
|
|
365 |
|
|
366 |
|
|
367 |
|
|
368 |
1 |
checkAlignSequenceAs("GGGAAA", "-A-L-", false, false, map, |
369 |
|
"---GGG---AAA"); |
370 |
|
|
371 |
|
|
372 |
|
|
373 |
|
|
374 |
1 |
checkAlignSequenceAs("-G-G-G-A-A-A-", "-A-L-", false, false, map, |
375 |
|
"---GGG---AAA"); |
376 |
|
|
377 |
|
|
378 |
|
|
379 |
|
|
380 |
|
|
381 |
1 |
checkAlignSequenceAs("-G-G--G-A--A-A-", "-A-L-", true, false, map, |
382 |
|
"---G-G--G---A--A-A"); |
383 |
|
|
384 |
|
|
385 |
|
|
386 |
|
|
387 |
|
|
388 |
|
|
389 |
1 |
checkAlignSequenceAs("-G-GG--AA-A---", "-A-L-", true, true, map, |
390 |
|
"---G-GG---AA-A---"); |
391 |
|
|
392 |
|
|
393 |
|
|
394 |
|
|
395 |
|
|
396 |
|
|
397 |
1 |
checkAlignSequenceAs("-G-GG--AA-A-", "-A-L-", false, true, map, |
398 |
|
"---GGG---AAA---"); |
399 |
|
} |
400 |
|
|
401 |
|
|
402 |
|
|
403 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
404 |
1 |
@Test(groups = { "Functional" })... |
405 |
|
public void testAlignSequenceAs_withMapping_withIntrons() |
406 |
|
{ |
407 |
|
|
408 |
|
|
409 |
|
|
410 |
1 |
MapList map = new MapList(new int[] { 4, 6, 10, 12 }, |
411 |
|
new int[] |
412 |
|
{ 1, 2 }, 3, 1); |
413 |
|
|
414 |
|
|
415 |
|
|
416 |
|
|
417 |
1 |
checkAlignSequenceAs("GGGAAACCCTTTGGG", "--A-L-", false, false, map, |
418 |
|
"GGG---AAACCCTTTGGG"); |
419 |
|
|
420 |
|
|
421 |
|
|
422 |
|
|
423 |
1 |
checkAlignSequenceAs("-G-G-G--A--A---AC-CC-T-TT-GG-G-", "--A-L-", false, |
424 |
|
false, map, "GGG---AAACCCTTTGGG"); |
425 |
|
|
426 |
|
|
427 |
|
|
428 |
|
|
429 |
1 |
checkAlignSequenceAs("-G-G-G--A--A---A-C-CC-T-TT-GG-G-", "--A-L-", true, |
430 |
|
false, map, "GGG---A--A---ACCCT-TTGGG"); |
431 |
|
|
432 |
|
|
433 |
|
|
434 |
|
|
435 |
1 |
checkAlignSequenceAs("-G-G-G--A--A---A-C-CC-T-TT-GG-G-", "--A-L-", |
436 |
|
false, true, map, "-G-G-GAAAC-CCTTT-GG-G-"); |
437 |
|
|
438 |
|
|
439 |
|
|
440 |
|
|
441 |
1 |
checkAlignSequenceAs("-G-G-G--A--A---A-C-CC-T-TT-GG-G-", "--A-L-", true, |
442 |
|
true, map, "-G-G-G--A--A---A-C-CC-T-TT-GG-G-"); |
443 |
|
|
444 |
|
|
445 |
|
|
446 |
|
|
447 |
1 |
checkAlignSequenceAs("-G-G-G--A--A---A-C-CC-T-TT-GG-G-", "--A-L-", true, |
448 |
|
true, map, "-G-G-G--A--A---A-C-CC-T-TT-GG-G-"); |
449 |
|
} |
450 |
|
|
451 |
|
|
452 |
|
|
453 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
454 |
1 |
@Test(groups = { "Functional" })... |
455 |
|
public void testAlignSequenceAs_withMapping_withUnmappedProtein() |
456 |
|
{ |
457 |
|
|
458 |
|
|
459 |
|
|
460 |
1 |
final MapList map = new MapList(new int[] { 4, 6, 10, 12 }, |
461 |
|
new int[] |
462 |
|
{ 1, 1, 3, 3 }, 3, 1); |
463 |
|
|
464 |
|
|
465 |
|
|
466 |
|
|
467 |
1 |
checkAlignSequenceAs("gggAAAcccTTTggg", "-A-L-P-", false, false, map, |
468 |
|
"gggAAAccc------TTTggg"); |
469 |
|
} |
470 |
|
|
471 |
|
|
472 |
|
|
473 |
|
|
474 |
|
@param |
475 |
|
|
476 |
|
@param |
477 |
|
|
478 |
|
@param |
479 |
|
@param |
480 |
|
@param |
481 |
|
@param |
482 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
483 |
14 |
protected void checkAlignSequenceAs(final String alignee,... |
484 |
|
final String alignModel, final boolean preserveMappedGaps, |
485 |
|
final boolean preserveUnmappedGaps, MapList map, |
486 |
|
final String expected) |
487 |
|
{ |
488 |
14 |
SequenceI alignMe = new Sequence("Seq1", alignee); |
489 |
14 |
alignMe.createDatasetSequence(); |
490 |
14 |
SequenceI alignFrom = new Sequence("Seq2", alignModel); |
491 |
14 |
alignFrom.createDatasetSequence(); |
492 |
14 |
AlignedCodonFrame acf = new AlignedCodonFrame(); |
493 |
14 |
acf.addMap(alignMe.getDatasetSequence(), alignFrom.getDatasetSequence(), |
494 |
|
map); |
495 |
|
|
496 |
14 |
AlignmentUtils.alignSequenceAs(alignMe, alignFrom, acf, "---", '-', |
497 |
|
preserveMappedGaps, preserveUnmappedGaps); |
498 |
14 |
assertEquals(expected, alignMe.getSequenceAsString()); |
499 |
|
} |
500 |
|
|
501 |
|
|
502 |
|
|
503 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
504 |
1 |
@Test(groups = { "Functional" })... |
505 |
|
public void testAlignSequenceAs_keepIntronGapsOnly() |
506 |
|
{ |
507 |
|
|
508 |
|
|
509 |
|
|
510 |
|
|
511 |
1 |
MapList map = new MapList(new int[] { 7, 12 }, new int[] { 1, 2 }, 3, |
512 |
|
1); |
513 |
|
|
514 |
1 |
checkAlignSequenceAs("GG-G-AA-A-C-CC-T-TT", "AL", false, true, map, |
515 |
|
"GG-G-AA-ACCCTTT"); |
516 |
|
} |
517 |
|
|
518 |
|
|
519 |
|
|
520 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
521 |
1 |
@Test(groups = { "Functional" })... |
522 |
|
public void testAlignProteinAsDna() |
523 |
|
{ |
524 |
|
|
525 |
1 |
SequenceI dna1 = new Sequence("Seq1", "TGCCATTACCAG-"); |
526 |
|
|
527 |
1 |
SequenceI dna2 = new Sequence("Seq2", "T-GCCATTACCAG"); |
528 |
|
|
529 |
1 |
SequenceI dna3 = new Sequence("Seq3", "TGCCA-TTACCAG"); |
530 |
1 |
AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2, dna3 }); |
531 |
1 |
dna.setDataset(null); |
532 |
|
|
533 |
|
|
534 |
1 |
SequenceI prot1 = new Sequence("Seq1", "CHYQ"); |
535 |
1 |
SequenceI prot2 = new Sequence("Seq2", "CHYQ"); |
536 |
1 |
SequenceI prot3 = new Sequence("Seq3", "CHYQ"); |
537 |
1 |
SequenceI prot4 = new Sequence("Seq4", "R-QSV"); |
538 |
1 |
AlignmentI protein = new Alignment( |
539 |
|
new SequenceI[] |
540 |
|
{ prot1, prot2, prot3, prot4 }); |
541 |
1 |
protein.setDataset(null); |
542 |
|
|
543 |
1 |
MapList map = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, |
544 |
|
1); |
545 |
1 |
AlignedCodonFrame acf = new AlignedCodonFrame(); |
546 |
1 |
acf.addMap(dna1.getDatasetSequence(), prot1.getDatasetSequence(), map); |
547 |
1 |
acf.addMap(dna2.getDatasetSequence(), prot2.getDatasetSequence(), map); |
548 |
1 |
acf.addMap(dna3.getDatasetSequence(), prot3.getDatasetSequence(), map); |
549 |
1 |
ArrayList<AlignedCodonFrame> acfs = new ArrayList<>(); |
550 |
1 |
acfs.add(acf); |
551 |
1 |
protein.setCodonFrames(acfs); |
552 |
|
|
553 |
|
|
554 |
|
|
555 |
|
|
556 |
|
|
557 |
1 |
AlignmentUtils.alignProteinAsDna(protein, dna); |
558 |
1 |
assertEquals("C-H--Y-Q-", prot1.getSequenceAsString()); |
559 |
1 |
assertEquals("-C--H-Y-Q", prot2.getSequenceAsString()); |
560 |
1 |
assertEquals("C--H--Y-Q", prot3.getSequenceAsString()); |
561 |
1 |
assertEquals("R-QSV", prot4.getSequenceAsString()); |
562 |
|
} |
563 |
|
|
564 |
|
|
565 |
|
|
566 |
|
|
567 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
568 |
1 |
@Test(groups = { "Functional" })... |
569 |
|
public void testTranslatesAs() |
570 |
|
{ |
571 |
|
|
572 |
1 |
assertFalse(AlignmentUtils.translatesAs(null, 0, null)); |
573 |
1 |
assertFalse(AlignmentUtils.translatesAs(new char[] { 't' }, 0, null)); |
574 |
1 |
assertFalse(AlignmentUtils.translatesAs(null, 0, new char[] { 'a' })); |
575 |
|
|
576 |
|
|
577 |
1 |
assertTrue(AlignmentUtils.translatesAs("tttcccaaaggg".toCharArray(), 0, |
578 |
|
"FPKG".toCharArray())); |
579 |
|
|
580 |
1 |
assertTrue(AlignmentUtils.translatesAs("atgtttcccaaaggg".toCharArray(), |
581 |
|
3, "FPKG".toCharArray())); |
582 |
|
|
583 |
1 |
assertTrue(AlignmentUtils.translatesAs("tttcccaaagggtaa".toCharArray(), |
584 |
|
0, "FPKG".toCharArray())); |
585 |
|
|
586 |
1 |
assertTrue(AlignmentUtils.translatesAs("tttcccaaagggtaa".toCharArray(), |
587 |
|
0, "FPKG*".toCharArray())); |
588 |
|
|
589 |
1 |
assertTrue(AlignmentUtils.translatesAs("tttcccaaagggtag".toCharArray(), |
590 |
|
0, "FPKG".toCharArray())); |
591 |
|
|
592 |
1 |
assertTrue(AlignmentUtils.translatesAs("tttcccaaagggtga".toCharArray(), |
593 |
|
0, "FPKG".toCharArray())); |
594 |
|
|
595 |
1 |
assertTrue(AlignmentUtils.translatesAs( |
596 |
|
"atgtttcccaaagggtaa".toCharArray(), 3, "FPKG".toCharArray())); |
597 |
|
|
598 |
1 |
assertTrue(AlignmentUtils.translatesAs( |
599 |
|
"atgtttcccaaagggtaa".toCharArray(), 3, "FPKG*".toCharArray())); |
600 |
|
|
601 |
1 |
assertTrue(AlignmentUtils.translatesAs( |
602 |
|
"atgtttcccaaagggtag".toCharArray(), 3, "FPKG".toCharArray())); |
603 |
|
|
604 |
1 |
assertTrue(AlignmentUtils.translatesAs( |
605 |
|
"atgtttcccaaagggtga".toCharArray(), 3, "FPKG".toCharArray())); |
606 |
|
|
607 |
|
|
608 |
1 |
assertTrue(AlignmentUtils.translatesAs( |
609 |
|
"atgtttTAGcccaaaTAAgggtga".toCharArray(), 3, |
610 |
|
"F*PK*G".toCharArray())); |
611 |
|
|
612 |
|
|
613 |
1 |
assertFalse(AlignmentUtils.translatesAs("tttcccaaaggg".toCharArray(), 0, |
614 |
|
"FPMG".toCharArray())); |
615 |
|
|
616 |
|
|
617 |
1 |
assertFalse(AlignmentUtils.translatesAs("tttcccaaagg".toCharArray(), 0, |
618 |
|
"FPKG".toCharArray())); |
619 |
|
|
620 |
|
|
621 |
1 |
assertFalse(AlignmentUtils.translatesAs("tttcccaaaggg".toCharArray(), 0, |
622 |
|
"FPK".toCharArray())); |
623 |
|
|
624 |
|
|
625 |
1 |
assertFalse(AlignmentUtils.translatesAs("tttcccaaagggttt".toCharArray(), |
626 |
|
0, "FPKG".toCharArray())); |
627 |
|
|
628 |
|
|
629 |
1 |
assertFalse(AlignmentUtils.translatesAs( |
630 |
|
"tttcccaaagggttaga".toCharArray(), 0, "FPKG".toCharArray())); |
631 |
|
|
632 |
|
|
633 |
1 |
assertFalse(AlignmentUtils.translatesAs("tttcccaaaggg".toCharArray(), 0, |
634 |
|
"FPKGQ".toCharArray())); |
635 |
|
} |
636 |
|
|
637 |
|
|
638 |
|
|
639 |
|
|
640 |
|
|
641 |
|
@throws |
642 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (55) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
643 |
1 |
@Test(groups = { "Functional" })... |
644 |
|
public void testMapProteinAlignmentToCdna_withStartAndStopCodons() |
645 |
|
throws IOException |
646 |
|
{ |
647 |
1 |
List<SequenceI> protseqs = new ArrayList<>(); |
648 |
1 |
protseqs.add(new Sequence("UNIPROT|V12345", "EIQ")); |
649 |
1 |
protseqs.add(new Sequence("UNIPROT|V12346", "EIQ")); |
650 |
1 |
protseqs.add(new Sequence("UNIPROT|V12347", "SAR")); |
651 |
1 |
AlignmentI protein = new Alignment(protseqs.toArray(new SequenceI[3])); |
652 |
1 |
protein.setDataset(null); |
653 |
|
|
654 |
1 |
List<SequenceI> dnaseqs = new ArrayList<>(); |
655 |
|
|
656 |
1 |
dnaseqs.add(new Sequence("EMBL|A11111", "ATGTCAGCACGC")); |
657 |
|
|
658 |
1 |
dnaseqs.add(new Sequence("EMBL|A22222", "GAGATACAATAA")); |
659 |
|
|
660 |
1 |
dnaseqs.add(new Sequence("EMBL|A33333", "ATGGAAATCCAGTAG")); |
661 |
1 |
dnaseqs.add(new Sequence("EMBL|A44444", "GAAATTCAG")); |
662 |
1 |
AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[4])); |
663 |
1 |
cdna.setDataset(null); |
664 |
|
|
665 |
1 |
assertTrue(AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna)); |
666 |
|
|
667 |
|
|
668 |
1 |
assertEquals(3, protein.getCodonFrames().size()); |
669 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(0)).size()); |
670 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(1)).size()); |
671 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(2)).size()); |
672 |
|
|
673 |
|
|
674 |
1 |
AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0)) |
675 |
|
.get(0); |
676 |
1 |
assertEquals(1, acf.getdnaSeqs().length); |
677 |
1 |
assertEquals(cdna.getSequenceAt(1).getDatasetSequence(), |
678 |
|
acf.getdnaSeqs()[0]); |
679 |
1 |
Mapping[] protMappings = acf.getProtMappings(); |
680 |
1 |
assertEquals(1, protMappings.length); |
681 |
1 |
MapList mapList = protMappings[0].getMap(); |
682 |
1 |
assertEquals(3, mapList.getFromRatio()); |
683 |
1 |
assertEquals(1, mapList.getToRatio()); |
684 |
1 |
assertTrue( |
685 |
|
Arrays.equals(new int[] |
686 |
|
{ 1, 9 }, mapList.getFromRanges().get(0))); |
687 |
1 |
assertEquals(1, mapList.getFromRanges().size()); |
688 |
1 |
assertTrue( |
689 |
|
Arrays.equals(new int[] |
690 |
|
{ 1, 3 }, mapList.getToRanges().get(0))); |
691 |
1 |
assertEquals(1, mapList.getToRanges().size()); |
692 |
|
|
693 |
|
|
694 |
1 |
acf = protein.getCodonFrame(protein.getSequenceAt(1)).get(0); |
695 |
1 |
assertEquals(1, acf.getdnaSeqs().length); |
696 |
1 |
assertEquals(cdna.getSequenceAt(2).getDatasetSequence(), |
697 |
|
acf.getdnaSeqs()[0]); |
698 |
1 |
protMappings = acf.getProtMappings(); |
699 |
1 |
assertEquals(1, protMappings.length); |
700 |
1 |
mapList = protMappings[0].getMap(); |
701 |
1 |
assertEquals(3, mapList.getFromRatio()); |
702 |
1 |
assertEquals(1, mapList.getToRatio()); |
703 |
1 |
assertTrue( |
704 |
|
Arrays.equals(new int[] |
705 |
|
{ 4, 12 }, mapList.getFromRanges().get(0))); |
706 |
1 |
assertEquals(1, mapList.getFromRanges().size()); |
707 |
1 |
assertTrue( |
708 |
|
Arrays.equals(new int[] |
709 |
|
{ 1, 3 }, mapList.getToRanges().get(0))); |
710 |
1 |
assertEquals(1, mapList.getToRanges().size()); |
711 |
|
|
712 |
|
|
713 |
1 |
acf = protein.getCodonFrame(protein.getSequenceAt(2)).get(0); |
714 |
1 |
assertEquals(1, acf.getdnaSeqs().length); |
715 |
1 |
assertEquals(cdna.getSequenceAt(0).getDatasetSequence(), |
716 |
|
acf.getdnaSeqs()[0]); |
717 |
1 |
protMappings = acf.getProtMappings(); |
718 |
1 |
assertEquals(1, protMappings.length); |
719 |
1 |
mapList = protMappings[0].getMap(); |
720 |
1 |
assertEquals(3, mapList.getFromRatio()); |
721 |
1 |
assertEquals(1, mapList.getToRatio()); |
722 |
1 |
assertTrue( |
723 |
|
Arrays.equals(new int[] |
724 |
|
{ 4, 12 }, mapList.getFromRanges().get(0))); |
725 |
1 |
assertEquals(1, mapList.getFromRanges().size()); |
726 |
1 |
assertTrue( |
727 |
|
Arrays.equals(new int[] |
728 |
|
{ 1, 3 }, mapList.getToRanges().get(0))); |
729 |
1 |
assertEquals(1, mapList.getToRanges().size()); |
730 |
|
|
731 |
|
|
732 |
1 |
assertTrue(protein.getCodonFrame(cdna.getSequenceAt(3)).isEmpty()); |
733 |
|
} |
734 |
|
|
735 |
|
|
736 |
|
|
737 |
|
|
738 |
|
|
739 |
|
|
740 |
|
@throws |
741 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (37) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
742 |
1 |
@Test(groups = { "Functional" })... |
743 |
|
public void testMapProteinAlignmentToCdna_withXrefs() throws IOException |
744 |
|
{ |
745 |
1 |
List<SequenceI> protseqs = new ArrayList<>(); |
746 |
1 |
protseqs.add(new Sequence("UNIPROT|V12345", "EIQ")); |
747 |
1 |
protseqs.add(new Sequence("UNIPROT|V12346", "EIQ")); |
748 |
1 |
protseqs.add(new Sequence("UNIPROT|V12347", "SAR")); |
749 |
1 |
AlignmentI protein = new Alignment(protseqs.toArray(new SequenceI[3])); |
750 |
1 |
protein.setDataset(null); |
751 |
|
|
752 |
1 |
List<SequenceI> dnaseqs = new ArrayList<>(); |
753 |
1 |
dnaseqs.add(new Sequence("EMBL|A11111", "TCAGCACGC")); |
754 |
1 |
dnaseqs.add(new Sequence("EMBL|A22222", "ATGGAGATACAA")); |
755 |
1 |
dnaseqs.add(new Sequence("EMBL|A33333", "GAAATCCAG")); |
756 |
1 |
dnaseqs.add(new Sequence("EMBL|A44444", "GAAATTCAG")); |
757 |
1 |
dnaseqs.add(new Sequence("EMBL|A55555", "GAGATTCAG")); |
758 |
1 |
AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[5])); |
759 |
1 |
cdna.setDataset(null); |
760 |
|
|
761 |
|
|
762 |
1 |
dnaseqs.get(1).addDBRef(new DBRefEntry("UNIPROT", "1", "V12345")); |
763 |
|
|
764 |
1 |
protseqs.get(0).addDBRef(new DBRefEntry("EMBL", "1", "A44444")); |
765 |
|
|
766 |
1 |
dnaseqs.get(2).addDBRef(new DBRefEntry("UNIPROT", "1", "V12347")); |
767 |
|
|
768 |
|
|
769 |
|
|
770 |
|
|
771 |
|
|
772 |
1 |
assertTrue(AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna)); |
773 |
|
|
774 |
|
|
775 |
1 |
assertEquals(3, protein.getCodonFrames().size()); |
776 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(0)).size()); |
777 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(1)).size()); |
778 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(2)).size()); |
779 |
|
|
780 |
|
|
781 |
1 |
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(0)).size()); |
782 |
1 |
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(1)).size()); |
783 |
1 |
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(2)).size()); |
784 |
1 |
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(3)).size()); |
785 |
|
|
786 |
|
|
787 |
1 |
AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0)) |
788 |
|
.get(0); |
789 |
1 |
assertEquals(2, acf.getdnaSeqs().length); |
790 |
1 |
assertEquals(cdna.getSequenceAt(1).getDatasetSequence(), |
791 |
|
acf.getdnaSeqs()[0]); |
792 |
1 |
assertEquals(cdna.getSequenceAt(3).getDatasetSequence(), |
793 |
|
acf.getdnaSeqs()[1]); |
794 |
|
|
795 |
|
|
796 |
1 |
acf = protein.getCodonFrame(protein.getSequenceAt(1)).get(0); |
797 |
1 |
assertEquals(1, acf.getdnaSeqs().length); |
798 |
1 |
assertEquals(cdna.getSequenceAt(2).getDatasetSequence(), |
799 |
|
acf.getdnaSeqs()[0]); |
800 |
|
|
801 |
|
|
802 |
1 |
acf = protein.getCodonFrame(protein.getSequenceAt(2)).get(0); |
803 |
1 |
assertEquals(1, acf.getdnaSeqs().length); |
804 |
1 |
assertEquals(cdna.getSequenceAt(0).getDatasetSequence(), |
805 |
|
acf.getdnaSeqs()[0]); |
806 |
|
|
807 |
|
|
808 |
1 |
assertTrue(protein.getCodonFrame(cdna.getSequenceAt(4)).isEmpty()); |
809 |
|
} |
810 |
|
|
811 |
|
|
812 |
|
|
813 |
|
|
814 |
|
|
815 |
|
|
816 |
|
@throws |
817 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (23) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
818 |
1 |
@Test(groups = { "Functional" })... |
819 |
|
public void testMapProteinAlignmentToCdna_prioritiseXrefs() |
820 |
|
throws IOException |
821 |
|
{ |
822 |
1 |
List<SequenceI> protseqs = new ArrayList<>(); |
823 |
1 |
protseqs.add(new Sequence("UNIPROT|V12345", "EIQ")); |
824 |
1 |
protseqs.add(new Sequence("UNIPROT|V12346", "EIQ")); |
825 |
1 |
AlignmentI protein = new Alignment( |
826 |
|
protseqs.toArray(new SequenceI[protseqs.size()])); |
827 |
1 |
protein.setDataset(null); |
828 |
|
|
829 |
1 |
List<SequenceI> dnaseqs = new ArrayList<>(); |
830 |
1 |
dnaseqs.add(new Sequence("EMBL|A11111", "GAAATCCAG")); |
831 |
1 |
dnaseqs.add(new Sequence("EMBL|A22222", "GAAATTCAG")); |
832 |
1 |
AlignmentI cdna = new Alignment( |
833 |
|
dnaseqs.toArray(new SequenceI[dnaseqs.size()])); |
834 |
1 |
cdna.setDataset(null); |
835 |
|
|
836 |
|
|
837 |
|
|
838 |
1 |
dnaseqs.get(1).addDBRef(new DBRefEntry("UNIPROT", "1", "V12345")); |
839 |
|
|
840 |
1 |
assertTrue(AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna)); |
841 |
|
|
842 |
|
|
843 |
1 |
assertEquals(2, protein.getCodonFrames().size()); |
844 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(0)).size()); |
845 |
1 |
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(1)).size()); |
846 |
|
|
847 |
|
|
848 |
1 |
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(0)).size()); |
849 |
1 |
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(1)).size()); |
850 |
|
|
851 |
|
|
852 |
1 |
AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0)) |
853 |
|
.get(0); |
854 |
1 |
assertEquals(1, acf.getdnaSeqs().length); |
855 |
1 |
assertEquals(cdna.getSequenceAt(1).getDatasetSequence(), |
856 |
|
acf.getdnaSeqs()[0]); |
857 |
|
|
858 |
|
|
859 |
1 |
acf = protein.getCodonFrame(protein.getSequenceAt(1)).get(0); |
860 |
1 |
assertEquals(1, acf.getdnaSeqs().length); |
861 |
1 |
assertEquals(cdna.getSequenceAt(0).getDatasetSequence(), |
862 |
|
acf.getdnaSeqs()[0]); |
863 |
|
} |
864 |
|
|
865 |
|
|
866 |
|
|
867 |
|
|
868 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (71) |
Complexity: 1 |
Complexity Density: 0.01 |
1PASS
|
|
869 |
1 |
@Test(groups = { "Functional" })... |
870 |
|
public void testShowOrHideSequenceAnnotations() |
871 |
|
{ |
872 |
1 |
SequenceI seq1 = new Sequence("Seq1", "AAA"); |
873 |
1 |
SequenceI seq2 = new Sequence("Seq2", "BBB"); |
874 |
1 |
SequenceI seq3 = new Sequence("Seq3", "CCC"); |
875 |
1 |
Annotation[] anns = new Annotation[] { new Annotation(2f) }; |
876 |
1 |
AlignmentAnnotation ann1 = new AlignmentAnnotation("Structure", "ann1", |
877 |
|
anns); |
878 |
1 |
ann1.setSequenceRef(seq1); |
879 |
1 |
AlignmentAnnotation ann2 = new AlignmentAnnotation("Structure", "ann2", |
880 |
|
anns); |
881 |
1 |
ann2.setSequenceRef(seq2); |
882 |
1 |
AlignmentAnnotation ann3 = new AlignmentAnnotation("Structure", "ann3", |
883 |
|
anns); |
884 |
1 |
AlignmentAnnotation ann4 = new AlignmentAnnotation("Temp", "ann4", |
885 |
|
anns); |
886 |
1 |
ann4.setSequenceRef(seq1); |
887 |
1 |
AlignmentAnnotation ann5 = new AlignmentAnnotation("Temp", "ann5", |
888 |
|
anns); |
889 |
1 |
ann5.setSequenceRef(seq2); |
890 |
1 |
AlignmentAnnotation ann6 = new AlignmentAnnotation("Temp", "ann6", |
891 |
|
anns); |
892 |
1 |
AlignmentI al = new Alignment(new SequenceI[] { seq1, seq2, seq3 }); |
893 |
1 |
al.addAnnotation(ann1); |
894 |
1 |
al.addAnnotation(ann2); |
895 |
1 |
al.addAnnotation(ann3); |
896 |
1 |
al.addAnnotation(ann4); |
897 |
1 |
al.addAnnotation(ann5); |
898 |
1 |
al.addAnnotation(ann6); |
899 |
1 |
List<String> types = new ArrayList<>(); |
900 |
1 |
List<SequenceI> scope = new ArrayList<>(); |
901 |
|
|
902 |
|
|
903 |
|
|
904 |
|
|
905 |
1 |
types.add("Structure"); |
906 |
1 |
AlignmentUtils.showOrHideSequenceAnnotations(al, types, null, false, |
907 |
|
false); |
908 |
1 |
assertFalse(ann1.visible); |
909 |
1 |
assertFalse(ann2.visible); |
910 |
1 |
assertTrue(ann3.visible); |
911 |
1 |
assertTrue(ann4.visible); |
912 |
1 |
assertTrue(ann5.visible); |
913 |
1 |
assertTrue(ann6.visible); |
914 |
|
|
915 |
|
|
916 |
|
|
917 |
|
|
918 |
1 |
types.clear(); |
919 |
1 |
types.add("Temp"); |
920 |
1 |
scope.add(seq1); |
921 |
1 |
scope.add(seq3); |
922 |
1 |
AlignmentUtils.showOrHideSequenceAnnotations(al, types, scope, false, |
923 |
|
false); |
924 |
1 |
assertFalse(ann1.visible); |
925 |
1 |
assertFalse(ann2.visible); |
926 |
1 |
assertTrue(ann3.visible); |
927 |
1 |
assertFalse(ann4.visible); |
928 |
1 |
assertTrue(ann5.visible); |
929 |
1 |
assertTrue(ann6.visible); |
930 |
|
|
931 |
|
|
932 |
|
|
933 |
|
|
934 |
1 |
types.clear(); |
935 |
1 |
types.add("Temp"); |
936 |
1 |
scope.add(seq1); |
937 |
1 |
scope.add(seq3); |
938 |
1 |
AlignmentUtils.showOrHideSequenceAnnotations(al, types, null, false, |
939 |
|
false); |
940 |
1 |
assertFalse(ann1.visible); |
941 |
1 |
assertFalse(ann2.visible); |
942 |
1 |
assertTrue(ann3.visible); |
943 |
1 |
assertFalse(ann4.visible); |
944 |
1 |
assertFalse(ann5.visible); |
945 |
1 |
assertTrue(ann6.visible); |
946 |
|
|
947 |
|
|
948 |
|
|
949 |
|
|
950 |
1 |
types.clear(); |
951 |
1 |
scope.clear(); |
952 |
1 |
scope.add(seq1); |
953 |
1 |
scope.add(seq3); |
954 |
1 |
AlignmentUtils.showOrHideSequenceAnnotations(al, types, scope, true, |
955 |
|
true); |
956 |
1 |
assertTrue(ann1.visible); |
957 |
1 |
assertFalse(ann2.visible); |
958 |
1 |
assertTrue(ann3.visible); |
959 |
1 |
assertTrue(ann4.visible); |
960 |
1 |
assertFalse(ann5.visible); |
961 |
1 |
assertTrue(ann6.visible); |
962 |
|
|
963 |
|
|
964 |
|
|
965 |
|
|
966 |
1 |
AlignmentUtils.showOrHideSequenceAnnotations(al, types, null, true, |
967 |
|
false); |
968 |
1 |
assertFalse(ann1.visible); |
969 |
1 |
assertFalse(ann2.visible); |
970 |
1 |
assertTrue(ann3.visible); |
971 |
1 |
assertFalse(ann4.visible); |
972 |
1 |
assertFalse(ann5.visible); |
973 |
1 |
assertTrue(ann6.visible); |
974 |
|
} |
975 |
|
|
976 |
|
|
977 |
|
|
978 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
979 |
1 |
@Test(groups = { "Functional" })... |
980 |
|
public void testHasCrossRef() |
981 |
|
{ |
982 |
1 |
assertFalse(AlignmentUtils.hasCrossRef(null, null)); |
983 |
1 |
SequenceI seq1 = new Sequence("EMBL|A12345", "ABCDEF"); |
984 |
1 |
assertFalse(AlignmentUtils.hasCrossRef(seq1, null)); |
985 |
1 |
assertFalse(AlignmentUtils.hasCrossRef(null, seq1)); |
986 |
1 |
SequenceI seq2 = new Sequence("UNIPROT|V20192", "ABCDEF"); |
987 |
1 |
assertFalse(AlignmentUtils.hasCrossRef(seq1, seq2)); |
988 |
|
|
989 |
|
|
990 |
1 |
seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "v20193")); |
991 |
1 |
assertFalse(AlignmentUtils.hasCrossRef(seq1, seq2)); |
992 |
|
|
993 |
|
|
994 |
1 |
seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "v20192")); |
995 |
1 |
assertTrue(AlignmentUtils.hasCrossRef(seq1, seq2)); |
996 |
|
|
997 |
|
|
998 |
1 |
seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "V20192")); |
999 |
1 |
assertTrue(AlignmentUtils.hasCrossRef(seq1, seq2)); |
1000 |
|
|
1001 |
1 |
assertFalse(AlignmentUtils.hasCrossRef(seq2, seq1)); |
1002 |
|
} |
1003 |
|
|
1004 |
|
|
1005 |
|
|
1006 |
|
|
1007 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
1008 |
1 |
@Test(groups = { "Functional" })... |
1009 |
|
public void testHaveCrossRef() |
1010 |
|
{ |
1011 |
1 |
assertFalse(AlignmentUtils.hasCrossRef(null, null)); |
1012 |
1 |
SequenceI seq1 = new Sequence("EMBL|A12345", "ABCDEF"); |
1013 |
1 |
assertFalse(AlignmentUtils.haveCrossRef(seq1, null)); |
1014 |
1 |
assertFalse(AlignmentUtils.haveCrossRef(null, seq1)); |
1015 |
1 |
SequenceI seq2 = new Sequence("UNIPROT|V20192", "ABCDEF"); |
1016 |
1 |
assertFalse(AlignmentUtils.haveCrossRef(seq1, seq2)); |
1017 |
|
|
1018 |
1 |
seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "V20192")); |
1019 |
1 |
assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2)); |
1020 |
|
|
1021 |
1 |
assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1)); |
1022 |
|
|
1023 |
|
|
1024 |
1 |
seq1.setDBRefs(null); |
1025 |
1 |
seq2.addDBRef(new DBRefEntry("EMBL", "1", "A12345")); |
1026 |
1 |
assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2)); |
1027 |
1 |
assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1)); |
1028 |
|
|
1029 |
|
|
1030 |
1 |
seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "V20192")); |
1031 |
1 |
assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2)); |
1032 |
1 |
assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1)); |
1033 |
|
} |
1034 |
|
|
1035 |
|
|
1036 |
|
|
1037 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (124) |
Complexity: 1 |
Complexity Density: 0.01 |
1PASS
|
|
1038 |
1 |
@Test(groups = { "Functional" })... |
1039 |
|
public void testMakeCdsAlignment() |
1040 |
|
{ |
1041 |
|
|
1042 |
|
|
1043 |
|
|
1044 |
|
|
1045 |
|
|
1046 |
1 |
SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa"); |
1047 |
1 |
SequenceI dna2 = new Sequence("dna2", "GGGcccTTTaaaCCC"); |
1048 |
1 |
SequenceI pep1 = new Sequence("pep1", "GF"); |
1049 |
1 |
SequenceI pep2 = new Sequence("pep2", "GFP"); |
1050 |
1 |
pep1.addDBRef(new DBRefEntry("UNIPROT", "0", "pep1")); |
1051 |
1 |
pep2.addDBRef(new DBRefEntry("UNIPROT", "0", "pep2")); |
1052 |
1 |
dna1.createDatasetSequence(); |
1053 |
1 |
dna2.createDatasetSequence(); |
1054 |
1 |
pep1.createDatasetSequence(); |
1055 |
1 |
pep2.createDatasetSequence(); |
1056 |
1 |
AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2 }); |
1057 |
1 |
dna.setDataset(null); |
1058 |
|
|
1059 |
|
|
1060 |
|
|
1061 |
|
|
1062 |
|
|
1063 |
1 |
dna2.addSequenceFeature( |
1064 |
|
new SequenceFeature("variant", "hgmd", 8, 8, 0f, null)); |
1065 |
|
|
1066 |
|
|
1067 |
|
|
1068 |
|
|
1069 |
|
|
1070 |
1 |
DBRefEntry dbref = new DBRefEntry("ENSEMBL", "0", "dna1"); |
1071 |
1 |
dna1.getDatasetSequence().addDBRef(dbref); |
1072 |
1 |
org.testng.Assert.assertEquals(dbref, dna1.getPrimaryDBRefs().get(0)); |
1073 |
1 |
dbref = new DBRefEntry("ENSEMBL", "0", "dna2"); |
1074 |
1 |
dna2.getDatasetSequence().addDBRef(dbref); |
1075 |
1 |
org.testng.Assert.assertEquals(dbref, dna2.getPrimaryDBRefs().get(0)); |
1076 |
|
|
1077 |
|
|
1078 |
|
|
1079 |
|
|
1080 |
|
|
1081 |
1 |
MapList mapfordna1 = new MapList(new int[] { 4, 6, 10, 12 }, |
1082 |
|
new int[] |
1083 |
|
{ 1, 2 }, 3, 1); |
1084 |
1 |
AlignedCodonFrame acf = new AlignedCodonFrame(); |
1085 |
1 |
acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), |
1086 |
|
mapfordna1); |
1087 |
1 |
dna.addCodonFrame(acf); |
1088 |
1 |
MapList mapfordna2 = new MapList(new int[] { 1, 3, 7, 9, 13, 15 }, |
1089 |
|
new int[] |
1090 |
|
{ 1, 3 }, 3, 1); |
1091 |
1 |
acf = new AlignedCodonFrame(); |
1092 |
1 |
acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), |
1093 |
|
mapfordna2); |
1094 |
1 |
dna.addCodonFrame(acf); |
1095 |
|
|
1096 |
|
|
1097 |
|
|
1098 |
|
|
1099 |
|
|
1100 |
|
|
1101 |
1 |
DBRefEntry dna1xref = new DBRefEntry("UNIPROT", "ENSEMBL", "pep1", |
1102 |
|
new Mapping(mapfordna1)); |
1103 |
1 |
dna1.addDBRef(dna1xref); |
1104 |
1 |
assertEquals(2, dna1.getDBRefs().size()); |
1105 |
1 |
DBRefEntry dna2xref = new DBRefEntry("UNIPROT", "ENSEMBL", "pep2", |
1106 |
|
new Mapping(mapfordna2)); |
1107 |
1 |
dna2.addDBRef(dna2xref); |
1108 |
1 |
assertEquals(2, dna2.getDBRefs().size()); |
1109 |
|
|
1110 |
|
|
1111 |
|
|
1112 |
|
|
1113 |
1 |
AlignmentI cds = AlignmentUtils |
1114 |
|
.makeCdsAlignment(new SequenceI[] |
1115 |
|
{ dna1, dna2 }, dna.getDataset(), null); |
1116 |
|
|
1117 |
|
|
1118 |
|
|
1119 |
|
|
1120 |
1 |
assertEquals(2, cds.getSequences().size()); |
1121 |
1 |
assertEquals("GGGTTT", cds.getSequenceAt(0).getSequenceAsString()); |
1122 |
1 |
assertEquals("GGGTTTCCC", cds.getSequenceAt(1).getSequenceAsString()); |
1123 |
|
|
1124 |
|
|
1125 |
|
|
1126 |
|
|
1127 |
1 |
assertSame(dna.getDataset(), cds.getDataset()); |
1128 |
1 |
SequenceI cds1Dss = cds.getSequenceAt(0).getDatasetSequence(); |
1129 |
1 |
SequenceI cds2Dss = cds.getSequenceAt(1).getDatasetSequence(); |
1130 |
1 |
assertTrue(dna.getDataset().getSequences().contains(cds1Dss)); |
1131 |
1 |
assertTrue(dna.getDataset().getSequences().contains(cds2Dss)); |
1132 |
|
|
1133 |
|
|
1134 |
|
|
1135 |
|
|
1136 |
1 |
assertNotNull(cds1Dss.getDBRefs()); |
1137 |
1 |
assertEquals(2, cds1Dss.getDBRefs().size()); |
1138 |
1 |
dbref = cds1Dss.getDBRefs().get(0); |
1139 |
1 |
assertEquals(dna1xref.getSource(), dbref.getSource()); |
1140 |
|
|
1141 |
1 |
assertEquals(dna1xref.getVersion(), dbref.getVersion()); |
1142 |
1 |
assertEquals(dna1xref.getAccessionId(), dbref.getAccessionId()); |
1143 |
1 |
assertNotNull(dbref.getMap()); |
1144 |
1 |
assertSame(pep1.getDatasetSequence(), dbref.getMap().getTo()); |
1145 |
1 |
MapList cdsMapping = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, |
1146 |
|
3, 1); |
1147 |
1 |
assertEquals(cdsMapping, dbref.getMap().getMap()); |
1148 |
|
|
1149 |
|
|
1150 |
|
|
1151 |
|
|
1152 |
1 |
assertNotNull(pep1.getDBRefs()); |
1153 |
|
|
1154 |
1 |
assertEquals(2, pep1.getDBRefs().size()); |
1155 |
1 |
dbref = pep1.getDBRefs().get(1); |
1156 |
1 |
assertEquals("ENSEMBL", dbref.getSource()); |
1157 |
1 |
assertEquals("0", dbref.getVersion()); |
1158 |
1 |
assertEquals("CDS|dna1", dbref.getAccessionId()); |
1159 |
1 |
assertNotNull(dbref.getMap()); |
1160 |
1 |
assertSame(cds1Dss, dbref.getMap().getTo()); |
1161 |
1 |
assertEquals(cdsMapping.getInverse(), dbref.getMap().getMap()); |
1162 |
|
|
1163 |
|
|
1164 |
|
|
1165 |
|
|
1166 |
1 |
assertEquals(3, dna1.getDBRefs().size()); |
1167 |
1 |
DBRefEntry dbRefEntry = dna1.getDBRefs().get(2); |
1168 |
1 |
assertSame(cds1Dss, dbRefEntry.getMap().getTo()); |
1169 |
1 |
MapList dnaToCdsMapping = new MapList(new int[] { 4, 6, 10, 12 }, |
1170 |
|
new int[] |
1171 |
|
{ 1, 6 }, 1, 1); |
1172 |
1 |
assertEquals(dnaToCdsMapping, dbRefEntry.getMap().getMap()); |
1173 |
1 |
assertEquals(3, dna2.getDBRefs().size()); |
1174 |
1 |
dbRefEntry = dna2.getDBRefs().get(2); |
1175 |
1 |
assertSame(cds2Dss, dbRefEntry.getMap().getTo()); |
1176 |
1 |
dnaToCdsMapping = new MapList(new int[] { 1, 3, 7, 9, 13, 15 }, |
1177 |
|
new int[] |
1178 |
|
{ 1, 9 }, 1, 1); |
1179 |
1 |
assertEquals(dnaToCdsMapping, dbRefEntry.getMap().getMap()); |
1180 |
|
|
1181 |
|
|
1182 |
|
|
1183 |
|
|
1184 |
1 |
assertEquals(2, cds1Dss.getDBRefs().size()); |
1185 |
1 |
dbRefEntry = cds1Dss.getDBRefs().get(1); |
1186 |
1 |
assertSame(dna1.getDatasetSequence(), dbRefEntry.getMap().getTo()); |
1187 |
1 |
MapList cdsToDnaMapping = new MapList(new int[] { 1, 6 }, |
1188 |
|
new int[] |
1189 |
|
{ 4, 6, 10, 12 }, 1, 1); |
1190 |
1 |
assertEquals(cdsToDnaMapping, dbRefEntry.getMap().getMap()); |
1191 |
1 |
assertEquals(2, cds2Dss.getDBRefs().size()); |
1192 |
1 |
dbRefEntry = cds2Dss.getDBRefs().get(1); |
1193 |
1 |
assertSame(dna2.getDatasetSequence(), dbRefEntry.getMap().getTo()); |
1194 |
1 |
cdsToDnaMapping = new MapList(new int[] { 1, 9 }, |
1195 |
|
new int[] |
1196 |
|
{ 1, 3, 7, 9, 13, 15 }, 1, 1); |
1197 |
1 |
assertEquals(cdsToDnaMapping, dbRefEntry.getMap().getMap()); |
1198 |
|
|
1199 |
|
|
1200 |
|
|
1201 |
|
|
1202 |
|
|
1203 |
|
|
1204 |
1 |
List<AlignedCodonFrame> cdsMappings = cds.getDataset().getCodonFrames(); |
1205 |
1 |
assertEquals(6, cdsMappings.size()); |
1206 |
|
|
1207 |
|
|
1208 |
|
|
1209 |
|
|
1210 |
|
|
1211 |
|
|
1212 |
|
|
1213 |
|
|
1214 |
|
|
1215 |
|
|
1216 |
|
|
1217 |
|
|
1218 |
|
|
1219 |
|
|
1220 |
1 |
List<AlignedCodonFrame> pep1Mappings = MappingUtils |
1221 |
|
.findMappingsForSequence(pep1, cdsMappings); |
1222 |
1 |
assertEquals(2, pep1Mappings.size()); |
1223 |
1 |
List<AlignedCodonFrame> mappings = MappingUtils |
1224 |
|
.findMappingsForSequence(cds.getSequenceAt(0), pep1Mappings); |
1225 |
1 |
assertEquals(1, mappings.size()); |
1226 |
|
|
1227 |
|
|
1228 |
1 |
SearchResultsI sr = MappingUtils.buildSearchResults(pep1, 1, mappings); |
1229 |
1 |
assertEquals(1, sr.getResults().size()); |
1230 |
1 |
SearchResultMatchI m = sr.getResults().get(0); |
1231 |
1 |
assertSame(cds1Dss, m.getSequence()); |
1232 |
1 |
assertEquals(1, m.getStart()); |
1233 |
1 |
assertEquals(3, m.getEnd()); |
1234 |
|
|
1235 |
1 |
sr = MappingUtils.buildSearchResults(pep1, 2, mappings); |
1236 |
1 |
m = sr.getResults().get(0); |
1237 |
1 |
assertSame(cds1Dss, m.getSequence()); |
1238 |
1 |
assertEquals(4, m.getStart()); |
1239 |
1 |
assertEquals(6, m.getEnd()); |
1240 |
|
|
1241 |
|
|
1242 |
|
|
1243 |
|
|
1244 |
|
|
1245 |
1 |
List<AlignedCodonFrame> pep2Mappings = MappingUtils |
1246 |
|
.findMappingsForSequence(pep2, cdsMappings); |
1247 |
1 |
assertEquals(2, pep2Mappings.size()); |
1248 |
1 |
mappings = MappingUtils.findMappingsForSequence(cds.getSequenceAt(1), |
1249 |
|
pep2Mappings); |
1250 |
1 |
assertEquals(1, mappings.size()); |
1251 |
|
|
1252 |
1 |
sr = MappingUtils.buildSearchResults(pep2, 1, mappings); |
1253 |
1 |
assertEquals(1, sr.getResults().size()); |
1254 |
1 |
m = sr.getResults().get(0); |
1255 |
1 |
assertSame(cds2Dss, m.getSequence()); |
1256 |
1 |
assertEquals(1, m.getStart()); |
1257 |
1 |
assertEquals(3, m.getEnd()); |
1258 |
|
|
1259 |
1 |
sr = MappingUtils.buildSearchResults(pep2, 2, mappings); |
1260 |
1 |
m = sr.getResults().get(0); |
1261 |
1 |
assertSame(cds2Dss, m.getSequence()); |
1262 |
1 |
assertEquals(4, m.getStart()); |
1263 |
1 |
assertEquals(6, m.getEnd()); |
1264 |
|
|
1265 |
1 |
sr = MappingUtils.buildSearchResults(pep2, 3, mappings); |
1266 |
1 |
m = sr.getResults().get(0); |
1267 |
1 |
assertSame(cds2Dss, m.getSequence()); |
1268 |
1 |
assertEquals(7, m.getStart()); |
1269 |
1 |
assertEquals(9, m.getEnd()); |
1270 |
|
|
1271 |
|
|
1272 |
|
|
1273 |
|
|
1274 |
1 |
List<SequenceFeature> sfs = cds2Dss.getSequenceFeatures(); |
1275 |
1 |
assertNotNull(sfs); |
1276 |
1 |
assertEquals(1, sfs.size()); |
1277 |
1 |
assertEquals("variant", sfs.get(0).type); |
1278 |
1 |
assertEquals(5, sfs.get(0).begin); |
1279 |
1 |
assertEquals(5, sfs.get(0).end); |
1280 |
|
} |
1281 |
|
|
1282 |
|
|
1283 |
|
|
1284 |
|
|
1285 |
|
|
1286 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (68) |
Complexity: 1 |
Complexity Density: 0.01 |
1PASS
|
|
1287 |
1 |
@Test(groups = { "Functional" })... |
1288 |
|
public void testMakeCdsAlignment_multipleProteins() |
1289 |
|
{ |
1290 |
1 |
SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa"); |
1291 |
1 |
SequenceI pep1 = new Sequence("pep1", "GF"); |
1292 |
1 |
SequenceI pep2 = new Sequence("pep2", "KP"); |
1293 |
1 |
SequenceI pep3 = new Sequence("pep3", "KF"); |
1294 |
1 |
dna1.createDatasetSequence(); |
1295 |
1 |
pep1.createDatasetSequence(); |
1296 |
1 |
pep2.createDatasetSequence(); |
1297 |
1 |
pep3.createDatasetSequence(); |
1298 |
1 |
pep1.getDatasetSequence() |
1299 |
|
.addDBRef(new DBRefEntry("EMBLCDS", "2", "A12345")); |
1300 |
1 |
pep2.getDatasetSequence() |
1301 |
|
.addDBRef(new DBRefEntry("EMBLCDS", "3", "A12346")); |
1302 |
1 |
pep3.getDatasetSequence() |
1303 |
|
.addDBRef(new DBRefEntry("EMBLCDS", "4", "A12347")); |
1304 |
|
|
1305 |
|
|
1306 |
|
|
1307 |
|
|
1308 |
1 |
AlignmentI dna = new Alignment(new SequenceI[] { dna1 }); |
1309 |
1 |
dna.setDataset(null); |
1310 |
|
|
1311 |
|
|
1312 |
|
|
1313 |
|
|
1314 |
|
|
1315 |
1 |
MapList map = new MapList(new int[] { 4, 6, 10, 12 }, |
1316 |
|
new int[] |
1317 |
|
{ 1, 2 }, 3, 1); |
1318 |
1 |
AlignedCodonFrame acf = new AlignedCodonFrame(); |
1319 |
1 |
acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map); |
1320 |
1 |
dna.addCodonFrame(acf); |
1321 |
|
|
1322 |
|
|
1323 |
1 |
map = new MapList(new int[] { 1, 3, 7, 9 }, new int[] { 1, 2 }, 3, 1); |
1324 |
1 |
acf = new AlignedCodonFrame(); |
1325 |
1 |
acf.addMap(dna1.getDatasetSequence(), pep2.getDatasetSequence(), map); |
1326 |
1 |
dna.addCodonFrame(acf); |
1327 |
|
|
1328 |
|
|
1329 |
1 |
map = new MapList(new int[] { 1, 3, 10, 12 }, new int[] { 1, 2 }, 3, 1); |
1330 |
1 |
acf = new AlignedCodonFrame(); |
1331 |
1 |
acf.addMap(dna1.getDatasetSequence(), pep3.getDatasetSequence(), map); |
1332 |
1 |
dna.addCodonFrame(acf); |
1333 |
|
|
1334 |
|
|
1335 |
|
|
1336 |
|
|
1337 |
1 |
AlignmentI cdsal = AlignmentUtils |
1338 |
|
.makeCdsAlignment(new SequenceI[] |
1339 |
|
{ dna1 }, dna.getDataset(), null); |
1340 |
|
|
1341 |
|
|
1342 |
|
|
1343 |
|
|
1344 |
1 |
List<SequenceI> cds = cdsal.getSequences(); |
1345 |
1 |
assertEquals(3, cds.size()); |
1346 |
|
|
1347 |
|
|
1348 |
|
|
1349 |
|
|
1350 |
1 |
assertSame(cdsal.getDataset(), dna.getDataset()); |
1351 |
1 |
assertTrue(dna.getDataset().getSequences() |
1352 |
|
.contains(cds.get(0).getDatasetSequence())); |
1353 |
1 |
assertTrue(dna.getDataset().getSequences() |
1354 |
|
.contains(cds.get(1).getDatasetSequence())); |
1355 |
1 |
assertTrue(dna.getDataset().getSequences() |
1356 |
|
.contains(cds.get(2).getDatasetSequence())); |
1357 |
|
|
1358 |
|
|
1359 |
|
|
1360 |
|
|
1361 |
1 |
SequenceI cdsSeq = cds.get(0); |
1362 |
1 |
assertEquals("GGGTTT", cdsSeq.getSequenceAsString()); |
1363 |
|
|
1364 |
1 |
assertEquals("CDS|dna1", cdsSeq.getName()); |
1365 |
|
|
1366 |
|
|
1367 |
|
|
1368 |
|
|
1369 |
|
|
1370 |
|
|
1371 |
1 |
cdsSeq = cds.get(1); |
1372 |
1 |
assertEquals("aaaccc", cdsSeq.getSequenceAsString()); |
1373 |
|
|
1374 |
1 |
assertEquals("CDS|dna1", cdsSeq.getName()); |
1375 |
|
|
1376 |
|
|
1377 |
|
|
1378 |
|
|
1379 |
|
|
1380 |
|
|
1381 |
1 |
cdsSeq = cds.get(2); |
1382 |
1 |
assertEquals("aaaTTT", cdsSeq.getSequenceAsString()); |
1383 |
|
|
1384 |
1 |
assertEquals("CDS|dna1", cdsSeq.getName()); |
1385 |
|
|
1386 |
|
|
1387 |
|
|
1388 |
|
|
1389 |
|
|
1390 |
|
|
1391 |
|
|
1392 |
|
|
1393 |
|
|
1394 |
|
|
1395 |
1 |
List<AlignedCodonFrame> newMappings = cdsal.getCodonFrames(); |
1396 |
|
|
1397 |
|
|
1398 |
|
|
1399 |
|
|
1400 |
1 |
List<AlignedCodonFrame> dnaMappings = MappingUtils |
1401 |
|
.findMappingsForSequence(dna1, newMappings); |
1402 |
1 |
assertEquals(6, dnaMappings.size()); |
1403 |
|
|
1404 |
|
|
1405 |
|
|
1406 |
|
|
1407 |
1 |
List<AlignedCodonFrame> mappings = MappingUtils |
1408 |
|
.findMappingsForSequence(pep1, dnaMappings); |
1409 |
1 |
assertEquals(1, mappings.size()); |
1410 |
1 |
assertEquals(1, mappings.get(0).getMappings().size()); |
1411 |
1 |
assertSame(pep1.getDatasetSequence(), |
1412 |
|
mappings.get(0).getMappings().get(0).getMapping().getTo()); |
1413 |
|
|
1414 |
|
|
1415 |
|
|
1416 |
|
|
1417 |
1 |
List<AlignedCodonFrame> dnaToCds1Mappings = MappingUtils |
1418 |
|
.findMappingsForSequence(cds.get(0), dnaMappings); |
1419 |
1 |
Mapping mapping = dnaToCds1Mappings.get(0).getMappings().get(0) |
1420 |
|
.getMapping(); |
1421 |
1 |
assertSame(cds.get(0).getDatasetSequence(), mapping.getTo()); |
1422 |
1 |
assertEquals("G(1) in CDS should map to G(4) in DNA", 4, |
1423 |
|
mapping.getMap().getToPosition(1)); |
1424 |
|
|
1425 |
|
|
1426 |
|
|
1427 |
|
|
1428 |
1 |
mappings = MappingUtils.findMappingsForSequence(pep2, dnaMappings); |
1429 |
1 |
assertEquals(1, mappings.size()); |
1430 |
1 |
assertEquals(1, mappings.get(0).getMappings().size()); |
1431 |
1 |
assertSame(pep2.getDatasetSequence(), |
1432 |
|
mappings.get(0).getMappings().get(0).getMapping().getTo()); |
1433 |
|
|
1434 |
|
|
1435 |
|
|
1436 |
|
|
1437 |
1 |
List<AlignedCodonFrame> dnaToCds2Mappings = MappingUtils |
1438 |
|
.findMappingsForSequence(cds.get(1), dnaMappings); |
1439 |
1 |
mapping = dnaToCds2Mappings.get(0).getMappings().get(0).getMapping(); |
1440 |
1 |
assertSame(cds.get(1).getDatasetSequence(), mapping.getTo()); |
1441 |
1 |
assertEquals("c(4) in CDS should map to c(7) in DNA", 7, |
1442 |
|
mapping.getMap().getToPosition(4)); |
1443 |
|
|
1444 |
|
|
1445 |
|
|
1446 |
|
|
1447 |
1 |
mappings = MappingUtils.findMappingsForSequence(pep3, dnaMappings); |
1448 |
1 |
assertEquals(1, mappings.size()); |
1449 |
1 |
assertEquals(1, mappings.get(0).getMappings().size()); |
1450 |
1 |
assertSame(pep3.getDatasetSequence(), |
1451 |
|
mappings.get(0).getMappings().get(0).getMapping().getTo()); |
1452 |
|
|
1453 |
|
|
1454 |
|
|
1455 |
|
|
1456 |
1 |
List<AlignedCodonFrame> dnaToCds3Mappings = MappingUtils |
1457 |
|
.findMappingsForSequence(cds.get(2), dnaMappings); |
1458 |
1 |
mapping = dnaToCds3Mappings.get(0).getMappings().get(0).getMapping(); |
1459 |
1 |
assertSame(cds.get(2).getDatasetSequence(), mapping.getTo()); |
1460 |
1 |
assertEquals("T(4) in CDS should map to T(10) in DNA", 10, |
1461 |
|
mapping.getMap().getToPosition(4)); |
1462 |
|
} |
1463 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
1464 |
1 |
@Test(groups = { "Functional" })... |
1465 |
|
public void testIsMappable() |
1466 |
|
{ |
1467 |
1 |
SequenceI dna1 = new Sequence("dna1", "cgCAGtgGT"); |
1468 |
1 |
SequenceI aa1 = new Sequence("aa1", "RSG"); |
1469 |
1 |
SequenceI td1 = new Sequence("aa1", "QRV"); |
1470 |
1 |
SequenceI td2 = new Sequence("aa2", "QRV"); |
1471 |
1 |
AlignmentI al1 = new Alignment(new SequenceI[] { dna1 }); |
1472 |
1 |
AlignmentI al2 = new Alignment(new SequenceI[] { aa1 }); |
1473 |
1 |
AlignmentI al3 = new Alignment(new SequenceI[] { td1 }); |
1474 |
1 |
AlignmentI al4 = new Alignment(new SequenceI[] { td2 }); |
1475 |
|
|
1476 |
1 |
assertFalse(AlignmentUtils.isMappable(null, null)); |
1477 |
1 |
assertFalse(AlignmentUtils.isMappable(al1, null)); |
1478 |
1 |
assertFalse(AlignmentUtils.isMappable(null, al1)); |
1479 |
1 |
assertFalse(AlignmentUtils.isMappable(al1, al1)); |
1480 |
1 |
assertFalse(AlignmentUtils.isMappable(al2, al2)); |
1481 |
|
|
1482 |
|
|
1483 |
1 |
assertTrue(AlignmentUtils.isMappable(al1, al2)); |
1484 |
1 |
assertTrue(AlignmentUtils.isMappable(al2, al1)); |
1485 |
|
|
1486 |
|
|
1487 |
|
|
1488 |
1 |
assertFalse(AlignmentUtils.isMappable(al1, al3)); |
1489 |
1 |
assertFalse(AlignmentUtils.isMappable(al2, al4)); |
1490 |
1 |
assertFalse(AlignmentUtils.isMappable(al3, al4)); |
1491 |
|
|
1492 |
|
|
1493 |
1 |
assertTrue(AlignmentUtils.isMappable(al2, al3)); |
1494 |
1 |
assertTrue(AlignmentUtils.isMappable(al3, al2)); |
1495 |
|
} |
1496 |
|
|
1497 |
|
|
1498 |
|
|
1499 |
|
|
1500 |
|
|
1501 |
|
@throws |
1502 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
1503 |
1 |
@Test(groups = { "Functional" })... |
1504 |
|
public void testMapCdnaToProtein_forSubsequence() throws IOException |
1505 |
|
{ |
1506 |
1 |
SequenceI prot = new Sequence("UNIPROT|V12345", "E-I--Q", 10, 12); |
1507 |
1 |
prot.createDatasetSequence(); |
1508 |
|
|
1509 |
1 |
SequenceI dna = new Sequence("EMBL|A33333", "GAA--AT-C-CAG", 40, 48); |
1510 |
1 |
dna.createDatasetSequence(); |
1511 |
|
|
1512 |
1 |
MapList map = AlignmentUtils.mapCdnaToProtein(prot, dna); |
1513 |
1 |
assertEquals(10, map.getToLowest()); |
1514 |
1 |
assertEquals(12, map.getToHighest()); |
1515 |
1 |
assertEquals(40, map.getFromLowest()); |
1516 |
1 |
assertEquals(48, map.getFromHighest()); |
1517 |
|
} |
1518 |
|
|
1519 |
|
|
1520 |
|
|
1521 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
1522 |
1 |
@Test(groups = { "Functional" })... |
1523 |
|
public void testAlignSequenceAs_mappedProteinProtein() |
1524 |
|
{ |
1525 |
|
|
1526 |
1 |
SequenceI alignMe = new Sequence("Match", "MGAASEV"); |
1527 |
1 |
alignMe.createDatasetSequence(); |
1528 |
1 |
SequenceI alignFrom = new Sequence("Query", "LQTGYMGAASEVMFSPTRR"); |
1529 |
1 |
alignFrom.createDatasetSequence(); |
1530 |
|
|
1531 |
1 |
AlignedCodonFrame acf = new AlignedCodonFrame(); |
1532 |
|
|
1533 |
1 |
MapList map = new MapList(new int[] { 6, 12 }, new int[] { 1, 7 }, 1, |
1534 |
|
1); |
1535 |
1 |
acf.addMap(alignFrom.getDatasetSequence(), alignMe.getDatasetSequence(), |
1536 |
|
map); |
1537 |
|
|
1538 |
1 |
AlignmentUtils.alignSequenceAs(alignMe, alignFrom, acf, "-", '-', true, |
1539 |
|
true); |
1540 |
1 |
assertEquals("-----MGAASEV-------", alignMe.getSequenceAsString()); |
1541 |
|
} |
1542 |
|
|
1543 |
|
|
1544 |
|
|
1545 |
|
|
1546 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
1547 |
1 |
@Test(groups = { "Functional" })... |
1548 |
|
public void testAlignSequenceAs_withTrailingPeptide() |
1549 |
|
{ |
1550 |
|
|
1551 |
1 |
MapList map = new MapList(new int[] { 1, 9 }, new int[] { 1, 3 }, 3, 1); |
1552 |
|
|
1553 |
1 |
checkAlignSequenceAs("AAACCCTTT", "K-PFG", true, true, map, |
1554 |
|
"AAA---CCCTTT---"); |
1555 |
|
} |
1556 |
|
|
1557 |
|
|
1558 |
|
|
1559 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (43) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
1560 |
1 |
@Test(groups = { "Functional" })... |
1561 |
|
public void testTransferFeatures() |
1562 |
|
{ |
1563 |
1 |
SequenceI dna = new Sequence("dna/20-34", "acgTAGcaaGCCcgt"); |
1564 |
1 |
SequenceI cds = new Sequence("cds/10-15", "TAGGCC"); |
1565 |
|
|
1566 |
|
|
1567 |
1 |
dna.addSequenceFeature( |
1568 |
|
new SequenceFeature("type1", "desc1", 1, 2, 1f, null)); |
1569 |
|
|
1570 |
1 |
dna.addSequenceFeature( |
1571 |
|
new SequenceFeature("type2", "desc2", 3, 4, 2f, null)); |
1572 |
|
|
1573 |
1 |
dna.addSequenceFeature( |
1574 |
|
new SequenceFeature("type3", "desc3", 4, 6, 3f, null)); |
1575 |
|
|
1576 |
1 |
dna.addSequenceFeature( |
1577 |
|
new SequenceFeature("type4", "desc4", 5, 11, 4f, null)); |
1578 |
|
|
1579 |
1 |
dna.addSequenceFeature( |
1580 |
|
new SequenceFeature("type5", "desc5", 4, 12, 5f, null)); |
1581 |
|
|
1582 |
1 |
dna.addSequenceFeature( |
1583 |
|
new SequenceFeature("type6", "desc6", 7, 9, 6f, null)); |
1584 |
|
|
1585 |
1 |
dna.addSequenceFeature( |
1586 |
|
new SequenceFeature("type7", "desc7", 13, 15, 7f, null)); |
1587 |
|
|
1588 |
1 |
dna.addSequenceFeature( |
1589 |
|
new SequenceFeature("type8", "desc8", 12, 12, 8f, null)); |
1590 |
|
|
1591 |
1 |
dna.addSequenceFeature( |
1592 |
|
new SequenceFeature("type9", "desc9", 12, 13, 9f, null)); |
1593 |
|
|
1594 |
1 |
MapList map = new MapList(new int[] { 4, 6, 10, 12 }, |
1595 |
|
new int[] |
1596 |
|
{ 1, 6 }, 1, 1); |
1597 |
|
|
1598 |
|
|
1599 |
|
|
1600 |
|
|
1601 |
|
|
1602 |
1 |
AlignmentUtils.transferFeatures(dna, cds, map, null); |
1603 |
1 |
List<SequenceFeature> sfs = cds.getSequenceFeatures(); |
1604 |
1 |
assertEquals(6, sfs.size()); |
1605 |
|
|
1606 |
1 |
SequenceFeature sf = sfs.get(0); |
1607 |
1 |
assertEquals("type2", sf.getType()); |
1608 |
1 |
assertEquals("desc2", sf.getDescription()); |
1609 |
1 |
assertEquals(2f, sf.getScore()); |
1610 |
1 |
assertEquals(1, sf.getBegin()); |
1611 |
1 |
assertEquals(1, sf.getEnd()); |
1612 |
|
|
1613 |
1 |
sf = sfs.get(1); |
1614 |
1 |
assertEquals("type3", sf.getType()); |
1615 |
1 |
assertEquals("desc3", sf.getDescription()); |
1616 |
1 |
assertEquals(3f, sf.getScore()); |
1617 |
1 |
assertEquals(1, sf.getBegin()); |
1618 |
1 |
assertEquals(3, sf.getEnd()); |
1619 |
|
|
1620 |
1 |
sf = sfs.get(2); |
1621 |
1 |
assertEquals("type4", sf.getType()); |
1622 |
1 |
assertEquals(2, sf.getBegin()); |
1623 |
1 |
assertEquals(5, sf.getEnd()); |
1624 |
|
|
1625 |
1 |
sf = sfs.get(3); |
1626 |
1 |
assertEquals("type5", sf.getType()); |
1627 |
1 |
assertEquals(1, sf.getBegin()); |
1628 |
1 |
assertEquals(6, sf.getEnd()); |
1629 |
|
|
1630 |
1 |
sf = sfs.get(4); |
1631 |
1 |
assertEquals("type8", sf.getType()); |
1632 |
1 |
assertEquals(6, sf.getBegin()); |
1633 |
1 |
assertEquals(6, sf.getEnd()); |
1634 |
|
|
1635 |
1 |
sf = sfs.get(5); |
1636 |
1 |
assertEquals("type9", sf.getType()); |
1637 |
1 |
assertEquals(6, sf.getBegin()); |
1638 |
1 |
assertEquals(6, sf.getEnd()); |
1639 |
|
} |
1640 |
|
|
1641 |
|
|
1642 |
|
|
1643 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
1644 |
1 |
@Test(groups = { "Functional" })... |
1645 |
|
public void testTransferFeatures_withOmit() |
1646 |
|
{ |
1647 |
1 |
SequenceI dna = new Sequence("dna/20-34", "acgTAGcaaGCCcgt"); |
1648 |
1 |
SequenceI cds = new Sequence("cds/10-15", "TAGGCC"); |
1649 |
|
|
1650 |
1 |
MapList map = new MapList(new int[] { 4, 6, 10, 12 }, |
1651 |
|
new int[] |
1652 |
|
{ 1, 6 }, 1, 1); |
1653 |
|
|
1654 |
|
|
1655 |
1 |
dna.addSequenceFeature( |
1656 |
|
new SequenceFeature("type4", "desc4", 5, 11, 4f, null)); |
1657 |
|
|
1658 |
1 |
dna.addSequenceFeature( |
1659 |
|
new SequenceFeature("type5", "desc5", 4, 12, 5f, null)); |
1660 |
|
|
1661 |
1 |
dna.addSequenceFeature( |
1662 |
|
new SequenceFeature("type8", "desc8", 12, 12, 8f, null)); |
1663 |
|
|
1664 |
|
|
1665 |
1 |
AlignmentUtils.transferFeatures(dna, cds, map, null, "type4", "type8"); |
1666 |
1 |
List<SequenceFeature> sfs = cds.getSequenceFeatures(); |
1667 |
1 |
assertEquals(1, sfs.size()); |
1668 |
|
|
1669 |
1 |
SequenceFeature sf = sfs.get(0); |
1670 |
1 |
assertEquals("type5", sf.getType()); |
1671 |
1 |
assertEquals(1, sf.getBegin()); |
1672 |
1 |
assertEquals(6, sf.getEnd()); |
1673 |
|
} |
1674 |
|
|
1675 |
|
|
1676 |
|
|
1677 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
1678 |
1 |
@Test(groups = { "Functional" })... |
1679 |
|
public void testTransferFeatures_withSelect() |
1680 |
|
{ |
1681 |
1 |
SequenceI dna = new Sequence("dna/20-34", "acgTAGcaaGCCcgt"); |
1682 |
1 |
SequenceI cds = new Sequence("cds/10-15", "TAGGCC"); |
1683 |
|
|
1684 |
1 |
MapList map = new MapList(new int[] { 4, 6, 10, 12 }, |
1685 |
|
new int[] |
1686 |
|
{ 1, 6 }, 1, 1); |
1687 |
|
|
1688 |
|
|
1689 |
1 |
dna.addSequenceFeature( |
1690 |
|
new SequenceFeature("type4", "desc4", 5, 11, 4f, null)); |
1691 |
|
|
1692 |
1 |
dna.addSequenceFeature( |
1693 |
|
new SequenceFeature("type5", "desc5", 4, 12, 5f, null)); |
1694 |
|
|
1695 |
1 |
dna.addSequenceFeature( |
1696 |
|
new SequenceFeature("type8", "desc8", 12, 12, 8f, null)); |
1697 |
|
|
1698 |
|
|
1699 |
1 |
AlignmentUtils.transferFeatures(dna, cds, map, "type5"); |
1700 |
1 |
List<SequenceFeature> sfs = cds.getSequenceFeatures(); |
1701 |
1 |
assertEquals(1, sfs.size()); |
1702 |
|
|
1703 |
1 |
SequenceFeature sf = sfs.get(0); |
1704 |
1 |
assertEquals("type5", sf.getType()); |
1705 |
1 |
assertEquals(1, sf.getBegin()); |
1706 |
1 |
assertEquals(6, sf.getEnd()); |
1707 |
|
} |
1708 |
|
|
1709 |
|
|
1710 |
|
|
1711 |
|
|
1712 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (70) |
Complexity: 1 |
Complexity Density: 0.01 |
1PASS
|
|
1713 |
1 |
@Test(groups = { "Functional" })... |
1714 |
|
public void testMakeCdsAlignment_alternativeTranscripts() |
1715 |
|
{ |
1716 |
1 |
SequenceI dna1 = new Sequence("dna1", "aaaGGGCC-----CTTTaaaGGG"); |
1717 |
|
|
1718 |
1 |
SequenceI dna2 = new Sequence("dna2", "aaaGGGCC-----cttTaaaGGG"); |
1719 |
|
|
1720 |
1 |
SequenceI dna3 = new Sequence("dna3", "aaaGGGCCCCCGGGcttTaaaGGG"); |
1721 |
1 |
SequenceI pep1 = new Sequence("pep1", "GPFG"); |
1722 |
1 |
SequenceI pep2 = new Sequence("pep2", "GPG"); |
1723 |
1 |
dna1.createDatasetSequence(); |
1724 |
1 |
dna2.createDatasetSequence(); |
1725 |
1 |
dna3.createDatasetSequence(); |
1726 |
1 |
pep1.createDatasetSequence(); |
1727 |
1 |
pep2.createDatasetSequence(); |
1728 |
|
|
1729 |
1 |
AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2, dna3 }); |
1730 |
1 |
dna.setDataset(null); |
1731 |
|
|
1732 |
1 |
MapList map = new MapList(new int[] { 4, 12, 16, 18 }, |
1733 |
|
new int[] |
1734 |
|
{ 1, 4 }, 3, 1); |
1735 |
1 |
AlignedCodonFrame acf = new AlignedCodonFrame(); |
1736 |
1 |
acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map); |
1737 |
1 |
dna.addCodonFrame(acf); |
1738 |
1 |
map = new MapList(new int[] { 4, 8, 12, 12, 16, 18 }, |
1739 |
|
new int[] |
1740 |
|
{ 1, 3 }, 3, 1); |
1741 |
1 |
acf = new AlignedCodonFrame(); |
1742 |
1 |
acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), map); |
1743 |
1 |
dna.addCodonFrame(acf); |
1744 |
|
|
1745 |
1 |
AlignmentI cds = AlignmentUtils |
1746 |
|
.makeCdsAlignment(new SequenceI[] |
1747 |
|
{ dna1, dna2, dna3 }, dna.getDataset(), null); |
1748 |
1 |
List<SequenceI> cdsSeqs = cds.getSequences(); |
1749 |
1 |
assertEquals(2, cdsSeqs.size()); |
1750 |
1 |
assertEquals("GGGCCCTTTGGG", cdsSeqs.get(0).getSequenceAsString()); |
1751 |
1 |
assertEquals("GGGCCTGGG", cdsSeqs.get(1).getSequenceAsString()); |
1752 |
|
|
1753 |
|
|
1754 |
|
|
1755 |
|
|
1756 |
1 |
assertSame(dna.getDataset(), cds.getDataset()); |
1757 |
1 |
assertTrue(dna.getDataset().getSequences() |
1758 |
|
.contains(cdsSeqs.get(0).getDatasetSequence())); |
1759 |
1 |
assertTrue(dna.getDataset().getSequences() |
1760 |
|
.contains(cdsSeqs.get(1).getDatasetSequence())); |
1761 |
|
|
1762 |
|
|
1763 |
|
|
1764 |
|
|
1765 |
|
|
1766 |
1 |
List<AlignedCodonFrame> mappings = cds.getCodonFrames(); |
1767 |
1 |
assertEquals(6, mappings.size()); |
1768 |
|
|
1769 |
|
|
1770 |
|
|
1771 |
|
|
1772 |
1 |
List<AlignedCodonFrame> pep1Mappings = MappingUtils |
1773 |
|
.findMappingsForSequence(pep1, mappings); |
1774 |
1 |
assertEquals(2, pep1Mappings.size()); |
1775 |
|
|
1776 |
|
|
1777 |
|
|
1778 |
|
|
1779 |
|
|
1780 |
1 |
List<AlignedCodonFrame> pep1CdsMappings = MappingUtils |
1781 |
|
.findMappingsForSequence(cds.getSequenceAt(0), pep1Mappings); |
1782 |
1 |
assertEquals(1, pep1CdsMappings.size()); |
1783 |
1 |
SearchResultsI sr = MappingUtils.buildSearchResults(pep1, 1, |
1784 |
|
pep1CdsMappings); |
1785 |
1 |
assertEquals(1, sr.getResults().size()); |
1786 |
1 |
SearchResultMatchI m = sr.getResults().get(0); |
1787 |
1 |
assertEquals(cds.getSequenceAt(0).getDatasetSequence(), |
1788 |
|
m.getSequence()); |
1789 |
1 |
assertEquals(1, m.getStart()); |
1790 |
1 |
assertEquals(3, m.getEnd()); |
1791 |
1 |
sr = MappingUtils.buildSearchResults(pep1, 2, pep1CdsMappings); |
1792 |
1 |
m = sr.getResults().get(0); |
1793 |
1 |
assertEquals(4, m.getStart()); |
1794 |
1 |
assertEquals(6, m.getEnd()); |
1795 |
1 |
sr = MappingUtils.buildSearchResults(pep1, 3, pep1CdsMappings); |
1796 |
1 |
m = sr.getResults().get(0); |
1797 |
1 |
assertEquals(7, m.getStart()); |
1798 |
1 |
assertEquals(9, m.getEnd()); |
1799 |
1 |
sr = MappingUtils.buildSearchResults(pep1, 4, pep1CdsMappings); |
1800 |
1 |
m = sr.getResults().get(0); |
1801 |
1 |
assertEquals(10, m.getStart()); |
1802 |
1 |
assertEquals(12, m.getEnd()); |
1803 |
|
|
1804 |
|
|
1805 |
|
|
1806 |
|
|
1807 |
|
|
1808 |
1 |
List<AlignedCodonFrame> pep2Mappings = MappingUtils |
1809 |
|
.findMappingsForSequence(pep2, mappings); |
1810 |
1 |
assertEquals(2, pep2Mappings.size()); |
1811 |
1 |
List<AlignedCodonFrame> pep2CdsMappings = MappingUtils |
1812 |
|
.findMappingsForSequence(cds.getSequenceAt(1), pep2Mappings); |
1813 |
1 |
assertEquals(1, pep2CdsMappings.size()); |
1814 |
1 |
sr = MappingUtils.buildSearchResults(pep2, 1, pep2CdsMappings); |
1815 |
1 |
assertEquals(1, sr.getResults().size()); |
1816 |
1 |
m = sr.getResults().get(0); |
1817 |
1 |
assertEquals(cds.getSequenceAt(1).getDatasetSequence(), |
1818 |
|
m.getSequence()); |
1819 |
1 |
assertEquals(1, m.getStart()); |
1820 |
1 |
assertEquals(3, m.getEnd()); |
1821 |
1 |
sr = MappingUtils.buildSearchResults(pep2, 2, pep2CdsMappings); |
1822 |
1 |
m = sr.getResults().get(0); |
1823 |
1 |
assertEquals(4, m.getStart()); |
1824 |
1 |
assertEquals(6, m.getEnd()); |
1825 |
1 |
sr = MappingUtils.buildSearchResults(pep2, 3, pep2CdsMappings); |
1826 |
1 |
m = sr.getResults().get(0); |
1827 |
1 |
assertEquals(7, m.getStart()); |
1828 |
1 |
assertEquals(9, m.getEnd()); |
1829 |
|
} |
1830 |
|
|
1831 |
|
|
1832 |
|
|
1833 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
1834 |
1 |
@Test(groups = { "Functional" })... |
1835 |
|
public void testAlignProteinAsDna_incompleteStartCodon() |
1836 |
|
{ |
1837 |
|
|
1838 |
1 |
SequenceI dna1 = new Sequence("Seq1", "ccAAA-TTT-GGG-"); |
1839 |
|
|
1840 |
1 |
SequenceI dna2 = new Sequence("Seq2", "ccaAA-ttT-GGG-"); |
1841 |
|
|
1842 |
1 |
SequenceI dna3 = new Sequence("Seq3", "ccaaa-ttt-GGG-"); |
1843 |
1 |
AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2, dna3 }); |
1844 |
1 |
dna.setDataset(null); |
1845 |
|
|
1846 |
|
|
1847 |
1 |
SequenceI prot1 = new Sequence("Seq1", "XKFG"); |
1848 |
1 |
SequenceI prot2 = new Sequence("Seq2", "NG"); |
1849 |
1 |
SequenceI prot3 = new Sequence("Seq3", "XG"); |
1850 |
1 |
AlignmentI protein = new Alignment( |
1851 |
|
new SequenceI[] |
1852 |
|
{ prot1, prot2, prot3 }); |
1853 |
1 |
protein.setDataset(null); |
1854 |
|
|
1855 |
|
|
1856 |
1 |
MapList map = new MapList(new int[] { 3, 11 }, new int[] { 2, 4 }, 3, |
1857 |
|
1); |
1858 |
1 |
AlignedCodonFrame acf = new AlignedCodonFrame(); |
1859 |
1 |
acf.addMap(dna1.getDatasetSequence(), prot1.getDatasetSequence(), map); |
1860 |
|
|
1861 |
|
|
1862 |
1 |
map = new MapList(new int[] { 4, 5, 8, 11 }, new int[] { 1, 2 }, 3, 1); |
1863 |
1 |
acf.addMap(dna2.getDatasetSequence(), prot2.getDatasetSequence(), map); |
1864 |
|
|
1865 |
|
|
1866 |
1 |
map = new MapList(new int[] { 9, 11 }, new int[] { 2, 2 }, 3, 1); |
1867 |
1 |
acf.addMap(dna3.getDatasetSequence(), prot3.getDatasetSequence(), map); |
1868 |
|
|
1869 |
1 |
ArrayList<AlignedCodonFrame> acfs = new ArrayList<>(); |
1870 |
1 |
acfs.add(acf); |
1871 |
1 |
protein.setCodonFrames(acfs); |
1872 |
|
|
1873 |
|
|
1874 |
|
|
1875 |
|
|
1876 |
|
|
1877 |
|
|
1878 |
1 |
AlignmentUtils.alignProteinAsDna(protein, dna); |
1879 |
1 |
assertEquals("XK-FG", prot1.getSequenceAsString()); |
1880 |
1 |
assertEquals("--N-G", prot2.getSequenceAsString()); |
1881 |
1 |
assertEquals("---XG", prot3.getSequenceAsString()); |
1882 |
|
} |
1883 |
|
|
1884 |
|
|
1885 |
|
|
1886 |
|
|
1887 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
1888 |
1 |
@Test(groups = "Functional")... |
1889 |
|
public void testFindCdsPositions_fivePrimeIncomplete() |
1890 |
|
{ |
1891 |
1 |
SequenceI dnaSeq = new Sequence("dna", "aaagGGCCCaaaTTTttt"); |
1892 |
1 |
dnaSeq.createDatasetSequence(); |
1893 |
1 |
SequenceI ds = dnaSeq.getDatasetSequence(); |
1894 |
|
|
1895 |
|
|
1896 |
1 |
SequenceFeature sf = new SequenceFeature("CDS", "", 5, 9, 0f, null); |
1897 |
1 |
sf.setPhase("2"); |
1898 |
1 |
ds.addSequenceFeature(sf); |
1899 |
|
|
1900 |
1 |
sf = new SequenceFeature("CDS_predicted", "", 13, 15, 0f, null); |
1901 |
1 |
ds.addSequenceFeature(sf); |
1902 |
|
|
1903 |
1 |
List<int[]> ranges = AlignmentUtils.findCdsPositions(dnaSeq); |
1904 |
|
|
1905 |
|
|
1906 |
|
|
1907 |
|
|
1908 |
1 |
assertEquals(6, MappingUtils.getLength(ranges)); |
1909 |
1 |
assertEquals(2, ranges.size()); |
1910 |
1 |
assertEquals(7, ranges.get(0)[0]); |
1911 |
1 |
assertEquals(9, ranges.get(0)[1]); |
1912 |
1 |
assertEquals(13, ranges.get(1)[0]); |
1913 |
1 |
assertEquals(15, ranges.get(1)[1]); |
1914 |
|
} |
1915 |
|
|
1916 |
|
|
1917 |
|
|
1918 |
|
|
1919 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
1920 |
1 |
@Test(groups = "Functional")... |
1921 |
|
public void testFindCdsPositions() |
1922 |
|
{ |
1923 |
1 |
SequenceI dnaSeq = new Sequence("dna", "aaaGGGcccAAATTTttt"); |
1924 |
1 |
dnaSeq.createDatasetSequence(); |
1925 |
1 |
SequenceI ds = dnaSeq.getDatasetSequence(); |
1926 |
|
|
1927 |
|
|
1928 |
1 |
SequenceFeature sf = new SequenceFeature("CDS_predicted", "", 10, 12, |
1929 |
|
0f, null); |
1930 |
1 |
sf.setStrand("+"); |
1931 |
1 |
ds.addSequenceFeature(sf); |
1932 |
|
|
1933 |
1 |
sf = new SequenceFeature("CDS", "", 4, 6, 0f, null); |
1934 |
1 |
sf.setStrand("+"); |
1935 |
1 |
ds.addSequenceFeature(sf); |
1936 |
|
|
1937 |
1 |
sf = new SequenceFeature("exon", "", 7, 9, 0f, null); |
1938 |
1 |
ds.addSequenceFeature(sf); |
1939 |
|
|
1940 |
1 |
List<int[]> ranges = AlignmentUtils.findCdsPositions(dnaSeq); |
1941 |
|
|
1942 |
|
|
1943 |
|
|
1944 |
|
|
1945 |
|
|
1946 |
1 |
assertEquals(6, MappingUtils.getLength(ranges)); |
1947 |
1 |
assertEquals(2, ranges.size()); |
1948 |
1 |
assertEquals(4, ranges.get(0)[0]); |
1949 |
1 |
assertEquals(6, ranges.get(0)[1]); |
1950 |
1 |
assertEquals(10, ranges.get(1)[0]); |
1951 |
1 |
assertEquals(12, ranges.get(1)[1]); |
1952 |
|
} |
1953 |
|
|
1954 |
|
|
1955 |
|
|
1956 |
|
|
1957 |
|
|
1958 |
|
|
1959 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
1960 |
0 |
@Test(groups = "Functional", enabled = false)... |
1961 |
|
public void testFindCdsPositions_reverseStrand() |
1962 |
|
{ |
1963 |
0 |
SequenceI dnaSeq = new Sequence("dna", "aaaGGGcccAAATTTttt"); |
1964 |
0 |
dnaSeq.createDatasetSequence(); |
1965 |
0 |
SequenceI ds = dnaSeq.getDatasetSequence(); |
1966 |
|
|
1967 |
|
|
1968 |
0 |
SequenceFeature sf = new SequenceFeature("CDS", "", 4, 6, 0f, null); |
1969 |
0 |
sf.setStrand("-"); |
1970 |
0 |
ds.addSequenceFeature(sf); |
1971 |
|
|
1972 |
0 |
sf = new SequenceFeature("exon", "", 7, 9, 0f, null); |
1973 |
0 |
ds.addSequenceFeature(sf); |
1974 |
|
|
1975 |
0 |
sf = new SequenceFeature("CDS_predicted", "", 10, 12, 0f, null); |
1976 |
0 |
sf.setStrand("-"); |
1977 |
0 |
ds.addSequenceFeature(sf); |
1978 |
|
|
1979 |
0 |
List<int[]> ranges = AlignmentUtils.findCdsPositions(dnaSeq); |
1980 |
|
|
1981 |
|
|
1982 |
|
|
1983 |
0 |
assertEquals(6, MappingUtils.getLength(ranges)); |
1984 |
0 |
assertEquals(2, ranges.size()); |
1985 |
0 |
assertEquals(12, ranges.get(0)[0]); |
1986 |
0 |
assertEquals(10, ranges.get(0)[1]); |
1987 |
0 |
assertEquals(6, ranges.get(1)[0]); |
1988 |
0 |
assertEquals(4, ranges.get(1)[1]); |
1989 |
|
} |
1990 |
|
|
1991 |
|
|
1992 |
|
|
1993 |
|
|
1994 |
|
|
1995 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
1996 |
0 |
@Test(groups = "Functional", enabled = false)... |
1997 |
|
|
1998 |
|
|
1999 |
|
public void testFindCdsPositions_reverseStrandThreePrimeIncomplete() |
2000 |
|
{ |
2001 |
0 |
SequenceI dnaSeq = new Sequence("dna", "aaagGGCCCaaaTTTttt"); |
2002 |
0 |
dnaSeq.createDatasetSequence(); |
2003 |
0 |
SequenceI ds = dnaSeq.getDatasetSequence(); |
2004 |
|
|
2005 |
|
|
2006 |
0 |
SequenceFeature sf = new SequenceFeature("CDS", "", 5, 9, 0f, null); |
2007 |
0 |
sf.setStrand("-"); |
2008 |
0 |
ds.addSequenceFeature(sf); |
2009 |
|
|
2010 |
0 |
sf = new SequenceFeature("CDS_predicted", "", 13, 15, 0f, null); |
2011 |
0 |
sf.setStrand("-"); |
2012 |
0 |
sf.setPhase("2"); |
2013 |
0 |
ds.addSequenceFeature(sf); |
2014 |
|
|
2015 |
0 |
List<int[]> ranges = AlignmentUtils.findCdsPositions(dnaSeq); |
2016 |
|
|
2017 |
|
|
2018 |
|
|
2019 |
|
|
2020 |
|
|
2021 |
0 |
assertEquals(6, MappingUtils.getLength(ranges)); |
2022 |
0 |
assertEquals(2, ranges.size()); |
2023 |
0 |
assertEquals(13, ranges.get(0)[0]); |
2024 |
0 |
assertEquals(13, ranges.get(0)[1]); |
2025 |
0 |
assertEquals(9, ranges.get(1)[0]); |
2026 |
0 |
assertEquals(5, ranges.get(1)[1]); |
2027 |
|
} |
2028 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
2029 |
1 |
@Test(groups = "Functional")... |
2030 |
|
public void testAlignAs_alternateTranscriptsUngapped() |
2031 |
|
{ |
2032 |
1 |
SequenceI dna1 = new Sequence("dna1", "cccGGGTTTaaa"); |
2033 |
1 |
SequenceI dna2 = new Sequence("dna2", "CCCgggtttAAA"); |
2034 |
1 |
AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2 }); |
2035 |
1 |
((Alignment) dna).createDatasetAlignment(); |
2036 |
1 |
SequenceI cds1 = new Sequence("cds1", "GGGTTT"); |
2037 |
1 |
SequenceI cds2 = new Sequence("cds2", "CCCAAA"); |
2038 |
1 |
AlignmentI cds = new Alignment(new SequenceI[] { cds1, cds2 }); |
2039 |
1 |
((Alignment) cds).createDatasetAlignment(); |
2040 |
|
|
2041 |
1 |
AlignedCodonFrame acf = new AlignedCodonFrame(); |
2042 |
1 |
MapList map = new MapList(new int[] { 4, 9 }, new int[] { 1, 6 }, 1, 1); |
2043 |
1 |
acf.addMap(dna1.getDatasetSequence(), cds1.getDatasetSequence(), map); |
2044 |
1 |
map = new MapList(new int[] { 1, 3, 10, 12 }, new int[] { 1, 6 }, 1, 1); |
2045 |
1 |
acf.addMap(dna2.getDatasetSequence(), cds2.getDatasetSequence(), map); |
2046 |
|
|
2047 |
|
|
2048 |
|
|
2049 |
|
|
2050 |
|
|
2051 |
|
|
2052 |
|
|
2053 |
|
|
2054 |
|
|
2055 |
1 |
dna.addCodonFrame(acf); |
2056 |
1 |
AlignmentUtils.alignAs(cds, dna); |
2057 |
1 |
assertEquals("---GGGTTT", cds.getSequenceAt(0).getSequenceAsString()); |
2058 |
1 |
assertEquals("CCC------AAA", |
2059 |
|
cds.getSequenceAt(1).getSequenceAsString()); |
2060 |
|
} |
2061 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
2062 |
1 |
@Test(groups = { "Functional" })... |
2063 |
|
public void testAddMappedPositions() |
2064 |
|
{ |
2065 |
1 |
SequenceI from = new Sequence("dna", "ggAA-ATcc-TT-g"); |
2066 |
1 |
SequenceI seq1 = new Sequence("cds", "AAATTT"); |
2067 |
1 |
from.createDatasetSequence(); |
2068 |
1 |
seq1.createDatasetSequence(); |
2069 |
1 |
Mapping mapping = new Mapping(seq1, |
2070 |
|
new MapList(new int[] |
2071 |
|
{ 3, 6, 9, 10 }, new int[] { 1, 6 }, 1, 1)); |
2072 |
1 |
Map<Integer, Map<SequenceI, Character>> map = new TreeMap<>(); |
2073 |
1 |
AlignmentUtils.addMappedPositions(seq1, from, mapping, map); |
2074 |
|
|
2075 |
|
|
2076 |
|
|
2077 |
|
|
2078 |
1 |
assertEquals(6, map.size()); |
2079 |
1 |
assertEquals('A', map.get(3).get(seq1).charValue()); |
2080 |
1 |
assertEquals('A', map.get(4).get(seq1).charValue()); |
2081 |
1 |
assertEquals('A', map.get(6).get(seq1).charValue()); |
2082 |
1 |
assertEquals('T', map.get(7).get(seq1).charValue()); |
2083 |
1 |
assertEquals('T', map.get(11).get(seq1).charValue()); |
2084 |
1 |
assertEquals('T', map.get(12).get(seq1).charValue()); |
2085 |
|
|
2086 |
|
|
2087 |
|
|
2088 |
|
|
2089 |
|
} |
2090 |
|
|
2091 |
|
|
2092 |
|
|
2093 |
|
|
2094 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
2095 |
1 |
@Test(groups = { "Functional" })... |
2096 |
|
public void testAddMappedPositions_withStopCodon() |
2097 |
|
{ |
2098 |
1 |
SequenceI from = new Sequence("dna", "ggAA-ATcc-TT-g"); |
2099 |
1 |
SequenceI seq1 = new Sequence("cds", "AAATTT"); |
2100 |
1 |
from.createDatasetSequence(); |
2101 |
1 |
seq1.createDatasetSequence(); |
2102 |
1 |
Mapping mapping = new Mapping(seq1, |
2103 |
|
new MapList(new int[] |
2104 |
|
{ 3, 6, 9, 10 }, new int[] { 1, 6 }, 1, 1)); |
2105 |
1 |
Map<Integer, Map<SequenceI, Character>> map = new TreeMap<>(); |
2106 |
1 |
AlignmentUtils.addMappedPositions(seq1, from, mapping, map); |
2107 |
|
|
2108 |
|
|
2109 |
|
|
2110 |
|
|
2111 |
1 |
assertEquals(6, map.size()); |
2112 |
1 |
assertEquals('A', map.get(3).get(seq1).charValue()); |
2113 |
1 |
assertEquals('A', map.get(4).get(seq1).charValue()); |
2114 |
1 |
assertEquals('A', map.get(6).get(seq1).charValue()); |
2115 |
1 |
assertEquals('T', map.get(7).get(seq1).charValue()); |
2116 |
1 |
assertEquals('T', map.get(11).get(seq1).charValue()); |
2117 |
1 |
assertEquals('T', map.get(12).get(seq1).charValue()); |
2118 |
|
} |
2119 |
|
|
2120 |
|
|
2121 |
|
|
2122 |
|
|
2123 |
|
|
2124 |
|
|
2125 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (70) |
Complexity: 1 |
Complexity Density: 0.01 |
1PASS
|
|
2126 |
1 |
@Test(groups = { "Functional" })... |
2127 |
|
public void testMakeCdsAlignment_filterProducts() |
2128 |
|
{ |
2129 |
1 |
SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa"); |
2130 |
1 |
SequenceI dna2 = new Sequence("dna2", "GGGcccTTTaaaCCC"); |
2131 |
1 |
SequenceI pep1 = new Sequence("Uniprot|pep1", "GF"); |
2132 |
1 |
SequenceI pep2 = new Sequence("Uniprot|pep2", "GFP"); |
2133 |
1 |
SequenceI pep3 = new Sequence("EMBL|pep3", "GF"); |
2134 |
1 |
SequenceI pep4 = new Sequence("EMBL|pep4", "GFP"); |
2135 |
1 |
dna1.createDatasetSequence(); |
2136 |
1 |
dna2.createDatasetSequence(); |
2137 |
1 |
pep1.createDatasetSequence(); |
2138 |
1 |
pep2.createDatasetSequence(); |
2139 |
1 |
pep3.createDatasetSequence(); |
2140 |
1 |
pep4.createDatasetSequence(); |
2141 |
1 |
AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2 }); |
2142 |
1 |
dna.setDataset(null); |
2143 |
1 |
AlignmentI emblPeptides = new Alignment(new SequenceI[] { pep3, pep4 }); |
2144 |
1 |
emblPeptides.setDataset(null); |
2145 |
|
|
2146 |
1 |
AlignedCodonFrame acf = new AlignedCodonFrame(); |
2147 |
1 |
MapList map = new MapList(new int[] { 4, 6, 10, 12 }, |
2148 |
|
new int[] |
2149 |
|
{ 1, 2 }, 3, 1); |
2150 |
1 |
acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map); |
2151 |
1 |
acf.addMap(dna1.getDatasetSequence(), pep3.getDatasetSequence(), map); |
2152 |
1 |
dna.addCodonFrame(acf); |
2153 |
|
|
2154 |
1 |
acf = new AlignedCodonFrame(); |
2155 |
1 |
map = new MapList(new int[] { 1, 3, 7, 9, 13, 15 }, new int[] { 1, 3 }, |
2156 |
|
3, 1); |
2157 |
1 |
acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), map); |
2158 |
1 |
acf.addMap(dna2.getDatasetSequence(), pep4.getDatasetSequence(), map); |
2159 |
1 |
dna.addCodonFrame(acf); |
2160 |
|
|
2161 |
|
|
2162 |
|
|
2163 |
|
|
2164 |
1 |
AlignmentI cds = AlignmentUtils |
2165 |
|
.makeCdsAlignment(new SequenceI[] |
2166 |
|
{ dna1, dna2 }, dna.getDataset(), |
2167 |
|
emblPeptides.getSequencesArray()); |
2168 |
|
|
2169 |
1 |
assertEquals(2, cds.getSequences().size()); |
2170 |
1 |
assertEquals("GGGTTT", cds.getSequenceAt(0).getSequenceAsString()); |
2171 |
1 |
assertEquals("GGGTTTCCC", cds.getSequenceAt(1).getSequenceAsString()); |
2172 |
|
|
2173 |
|
|
2174 |
|
|
2175 |
|
|
2176 |
1 |
assertSame(dna.getDataset(), cds.getDataset()); |
2177 |
1 |
assertTrue(dna.getDataset().getSequences() |
2178 |
|
.contains(cds.getSequenceAt(0).getDatasetSequence())); |
2179 |
1 |
assertTrue(dna.getDataset().getSequences() |
2180 |
|
.contains(cds.getSequenceAt(1).getDatasetSequence())); |
2181 |
|
|
2182 |
|
|
2183 |
|
|
2184 |
|
|
2185 |
|
|
2186 |
1 |
List<AlignedCodonFrame> cdsMappings = cds.getDataset().getCodonFrames(); |
2187 |
|
|
2188 |
|
|
2189 |
|
|
2190 |
1 |
assertEquals(6, cdsMappings.size()); |
2191 |
|
|
2192 |
|
|
2193 |
|
|
2194 |
|
|
2195 |
|
|
2196 |
|
|
2197 |
|
|
2198 |
|
|
2199 |
|
|
2200 |
|
|
2201 |
|
|
2202 |
|
|
2203 |
|
|
2204 |
|
|
2205 |
1 |
List<AlignedCodonFrame> pep3Mappings = MappingUtils |
2206 |
|
.findMappingsForSequence(pep3, cdsMappings); |
2207 |
1 |
assertEquals(2, pep3Mappings.size()); |
2208 |
1 |
List<AlignedCodonFrame> mappings = MappingUtils |
2209 |
|
.findMappingsForSequence(cds.getSequenceAt(0), pep3Mappings); |
2210 |
1 |
assertEquals(1, mappings.size()); |
2211 |
|
|
2212 |
|
|
2213 |
1 |
SearchResultsI sr = MappingUtils.buildSearchResults(pep3, 1, mappings); |
2214 |
1 |
assertEquals(1, sr.getResults().size()); |
2215 |
1 |
SearchResultMatchI m = sr.getResults().get(0); |
2216 |
1 |
assertSame(cds.getSequenceAt(0).getDatasetSequence(), m.getSequence()); |
2217 |
1 |
assertEquals(1, m.getStart()); |
2218 |
1 |
assertEquals(3, m.getEnd()); |
2219 |
|
|
2220 |
1 |
sr = MappingUtils.buildSearchResults(pep3, 2, mappings); |
2221 |
1 |
m = sr.getResults().get(0); |
2222 |
1 |
assertSame(cds.getSequenceAt(0).getDatasetSequence(), m.getSequence()); |
2223 |
1 |
assertEquals(4, m.getStart()); |
2224 |
1 |
assertEquals(6, m.getEnd()); |
2225 |
|
|
2226 |
|
|
2227 |
|
|
2228 |
|
|
2229 |
|
|
2230 |
1 |
List<AlignedCodonFrame> pep4Mappings = MappingUtils |
2231 |
|
.findMappingsForSequence(pep4, cdsMappings); |
2232 |
1 |
assertEquals(2, pep4Mappings.size()); |
2233 |
1 |
mappings = MappingUtils.findMappingsForSequence(cds.getSequenceAt(1), |
2234 |
|
pep4Mappings); |
2235 |
1 |
assertEquals(1, mappings.size()); |
2236 |
|
|
2237 |
1 |
sr = MappingUtils.buildSearchResults(pep4, 1, mappings); |
2238 |
1 |
assertEquals(1, sr.getResults().size()); |
2239 |
1 |
m = sr.getResults().get(0); |
2240 |
1 |
assertSame(cds.getSequenceAt(1).getDatasetSequence(), m.getSequence()); |
2241 |
1 |
assertEquals(1, m.getStart()); |
2242 |
1 |
assertEquals(3, m.getEnd()); |
2243 |
|
|
2244 |
1 |
sr = MappingUtils.buildSearchResults(pep4, 2, mappings); |
2245 |
1 |
m = sr.getResults().get(0); |
2246 |
1 |
assertSame(cds.getSequenceAt(1).getDatasetSequence(), m.getSequence()); |
2247 |
1 |
assertEquals(4, m.getStart()); |
2248 |
1 |
assertEquals(6, m.getEnd()); |
2249 |
|
|
2250 |
1 |
sr = MappingUtils.buildSearchResults(pep4, 3, mappings); |
2251 |
1 |
m = sr.getResults().get(0); |
2252 |
1 |
assertSame(cds.getSequenceAt(1).getDatasetSequence(), m.getSequence()); |
2253 |
1 |
assertEquals(7, m.getStart()); |
2254 |
1 |
assertEquals(9, m.getEnd()); |
2255 |
|
} |
2256 |
|
|
2257 |
|
|
2258 |
|
|
2259 |
|
|
2260 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (29) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
2261 |
1 |
@Test(groups = "Functional")... |
2262 |
|
public void testAlignAsSameSequences() |
2263 |
|
{ |
2264 |
1 |
SequenceI dna1 = new Sequence("dna1", "cccGGGTTTaaa"); |
2265 |
1 |
SequenceI dna2 = new Sequence("dna2", "CCCgggtttAAA"); |
2266 |
1 |
AlignmentI al1 = new Alignment(new SequenceI[] { dna1, dna2 }); |
2267 |
1 |
((Alignment) al1).createDatasetAlignment(); |
2268 |
|
|
2269 |
1 |
SequenceI dna3 = new Sequence(dna1); |
2270 |
1 |
SequenceI dna4 = new Sequence(dna2); |
2271 |
1 |
assertSame(dna3.getDatasetSequence(), dna1.getDatasetSequence()); |
2272 |
1 |
assertSame(dna4.getDatasetSequence(), dna2.getDatasetSequence()); |
2273 |
1 |
String seq1 = "-cc-GG-GT-TT--aaa"; |
2274 |
1 |
dna3.setSequence(seq1); |
2275 |
1 |
String seq2 = "C--C-Cgg--gtt-tAA-A-"; |
2276 |
1 |
dna4.setSequence(seq2); |
2277 |
1 |
AlignmentI al2 = new Alignment(new SequenceI[] { dna3, dna4 }); |
2278 |
1 |
((Alignment) al2).createDatasetAlignment(); |
2279 |
|
|
2280 |
|
|
2281 |
|
|
2282 |
|
|
2283 |
1 |
assertTrue(AlignmentUtils.alignAsSameSequences(al1, al2)); |
2284 |
1 |
String aligned1 = "-cc-GG-GTTT-aaa"; |
2285 |
1 |
assertEquals(aligned1, al1.getSequenceAt(0).getSequenceAsString()); |
2286 |
1 |
String aligned2 = "C--C-Cgg-gtttAAA"; |
2287 |
1 |
assertEquals(aligned2, al1.getSequenceAt(1).getSequenceAsString()); |
2288 |
|
|
2289 |
|
|
2290 |
|
|
2291 |
|
|
2292 |
|
|
2293 |
1 |
SequenceI dna5 = new Sequence("dna5", "CCCgggtttAAA"); |
2294 |
1 |
dna5.createDatasetSequence(); |
2295 |
1 |
al2.addSequence(dna5); |
2296 |
1 |
assertTrue(AlignmentUtils.alignAsSameSequences(al1, al2)); |
2297 |
1 |
assertEquals(aligned1, al1.getSequenceAt(0).getSequenceAsString()); |
2298 |
1 |
assertEquals(aligned2, al1.getSequenceAt(1).getSequenceAsString()); |
2299 |
|
|
2300 |
|
|
2301 |
|
|
2302 |
|
|
2303 |
|
|
2304 |
1 |
SequenceI dna6 = new Sequence("dna6", "CCCgggtttAAA"); |
2305 |
1 |
dna6.createDatasetSequence(); |
2306 |
1 |
al1.addSequence(dna6); |
2307 |
|
|
2308 |
1 |
assertFalse(AlignmentUtils.alignAsSameSequences(al1, al2)); |
2309 |
|
} |
2310 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (22) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
2311 |
1 |
@Test(groups = "Functional")... |
2312 |
|
public void testAlignAsSameSequencesMultipleSubSeq() |
2313 |
|
{ |
2314 |
1 |
SequenceI dna1 = new Sequence("dna1", "cccGGGTTTaaa"); |
2315 |
1 |
SequenceI dna2 = new Sequence("dna2", "CCCgggtttAAA"); |
2316 |
1 |
SequenceI as1 = dna1.deriveSequence(); |
2317 |
1 |
SequenceI as2 = dna1.deriveSequence().getSubSequence(3, 7); |
2318 |
1 |
SequenceI as3 = dna2.deriveSequence(); |
2319 |
1 |
as1.insertCharAt(6, 5, '-'); |
2320 |
1 |
assertEquals("cccGGG-----TTTaaa", as1.getSequenceAsString()); |
2321 |
1 |
as2.insertCharAt(6, 5, '-'); |
2322 |
1 |
assertEquals("GGGT-----", as2.getSequenceAsString()); |
2323 |
1 |
as3.insertCharAt(3, 5, '-'); |
2324 |
1 |
assertEquals("CCC-----gggtttAAA", as3.getSequenceAsString()); |
2325 |
1 |
AlignmentI aligned = new Alignment(new SequenceI[] { as1, as2, as3 }); |
2326 |
|
|
2327 |
|
|
2328 |
1 |
((Alignment) aligned).createDatasetAlignment(); |
2329 |
1 |
SequenceI uas1 = dna1.deriveSequence(); |
2330 |
1 |
SequenceI uas2 = dna1.deriveSequence().getSubSequence(3, 7); |
2331 |
1 |
SequenceI uas3 = dna2.deriveSequence(); |
2332 |
1 |
AlignmentI tobealigned = new Alignment( |
2333 |
|
new SequenceI[] |
2334 |
|
{ uas1, uas2, uas3 }); |
2335 |
1 |
((Alignment) tobealigned).createDatasetAlignment(); |
2336 |
|
|
2337 |
|
|
2338 |
|
|
2339 |
|
|
2340 |
1 |
assertTrue(AlignmentUtils.alignAsSameSequences(tobealigned, aligned)); |
2341 |
1 |
assertEquals("cccGGG---TTTaaa", uas1.getSequenceAsString()); |
2342 |
1 |
assertEquals("GGGT", uas2.getSequenceAsString()); |
2343 |
1 |
assertEquals("CCC---gggtttAAA", uas3.getSequenceAsString()); |
2344 |
|
} |
2345 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (33) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
2346 |
1 |
@Test(groups = { "Functional" })... |
2347 |
|
public void testTransferGeneLoci() |
2348 |
|
{ |
2349 |
1 |
SequenceI from = new Sequence("transcript", |
2350 |
|
"aaacccgggTTTAAACCCGGGtttaaacccgggttt"); |
2351 |
1 |
SequenceI to = new Sequence("CDS", "TTTAAACCCGGG"); |
2352 |
1 |
MapList map = new MapList(new int[] { 1, 12 }, new int[] { 10, 21 }, 1, |
2353 |
|
1); |
2354 |
|
|
2355 |
|
|
2356 |
|
|
2357 |
|
|
2358 |
1 |
AlignmentUtils.transferGeneLoci(from, map, to); |
2359 |
1 |
assertNull(to.getGeneLoci()); |
2360 |
|
|
2361 |
|
|
2362 |
|
|
2363 |
|
|
2364 |
1 |
int[] exons = new int[] { 100, 105, 155, 164, 210, 229 }; |
2365 |
1 |
MapList geneMap = new MapList(new int[] { 1, 36 }, exons, 1, 1); |
2366 |
1 |
from.setGeneLoci("human", "GRCh38", "7", geneMap); |
2367 |
1 |
AlignmentUtils.transferGeneLoci(from, map, to); |
2368 |
|
|
2369 |
1 |
GeneLociI toLoci = to.getGeneLoci(); |
2370 |
1 |
assertNotNull(toLoci); |
2371 |
|
|
2372 |
1 |
assertEquals("HUMAN", toLoci.getSpeciesId()); |
2373 |
1 |
assertEquals("GRCh38", toLoci.getAssemblyId()); |
2374 |
1 |
assertEquals("7", toLoci.getChromosomeId()); |
2375 |
|
|
2376 |
|
|
2377 |
|
|
2378 |
|
|
2379 |
|
|
2380 |
|
|
2381 |
|
|
2382 |
1 |
MapList toMap = toLoci.getMapping(); |
2383 |
1 |
assertEquals(1, toMap.getFromRanges().size()); |
2384 |
1 |
assertEquals(2, toMap.getFromRanges().get(0).length); |
2385 |
1 |
assertEquals(1, toMap.getFromRanges().get(0)[0]); |
2386 |
1 |
assertEquals(12, toMap.getFromRanges().get(0)[1]); |
2387 |
1 |
assertEquals(2, toMap.getToRanges().size()); |
2388 |
1 |
assertEquals(2, toMap.getToRanges().get(0).length); |
2389 |
1 |
assertEquals(158, toMap.getToRanges().get(0)[0]); |
2390 |
1 |
assertEquals(164, toMap.getToRanges().get(0)[1]); |
2391 |
1 |
assertEquals(210, toMap.getToRanges().get(1)[0]); |
2392 |
1 |
assertEquals(214, toMap.getToRanges().get(1)[1]); |
2393 |
|
|
2394 |
1 |
assertEquals("[ [1, 12] ] 1:1 to [ [158, 164] [210, 214] ]", |
2395 |
|
toMap.toString()); |
2396 |
|
|
2397 |
|
|
2398 |
|
|
2399 |
|
|
2400 |
1 |
geneMap = new MapList(new int[] { 1, 36 }, new int[] { 36, 1 }, 1, 1); |
2401 |
1 |
from.setGeneLoci("inhuman", "GRCh37", "6", geneMap); |
2402 |
1 |
AlignmentUtils.transferGeneLoci(from, map, to); |
2403 |
1 |
assertEquals("GRCh38", toLoci.getAssemblyId()); |
2404 |
1 |
assertEquals("7", toLoci.getChromosomeId()); |
2405 |
1 |
toMap = toLoci.getMapping(); |
2406 |
1 |
assertEquals("[ [1, 12] ] 1:1 to [ [158, 164] [210, 214] ]", |
2407 |
|
toMap.toString()); |
2408 |
|
} |
2409 |
|
|
2410 |
|
|
2411 |
|
|
2412 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (50) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
2413 |
1 |
@Test(groups = "Functional")... |
2414 |
|
public void testMapCdsToProtein() |
2415 |
|
{ |
2416 |
1 |
SequenceI peptide = new Sequence("pep", "KLQ"); |
2417 |
|
|
2418 |
|
|
2419 |
|
|
2420 |
|
|
2421 |
|
|
2422 |
1 |
SequenceI dna = new Sequence("dna", "AACGacgtCTCCT"); |
2423 |
1 |
dna.createDatasetSequence(); |
2424 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 1, 4, null)); |
2425 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 9, 13, null)); |
2426 |
1 |
MapList ml = AlignmentUtils.mapCdsToProtein(dna, peptide); |
2427 |
1 |
assertEquals(3, ml.getFromRatio()); |
2428 |
1 |
assertEquals(1, ml.getToRatio()); |
2429 |
1 |
assertEquals("[[1, 3]]", |
2430 |
|
Arrays.deepToString(ml.getToRanges().toArray())); |
2431 |
1 |
assertEquals("[[1, 4], [9, 13]]", |
2432 |
|
Arrays.deepToString(ml.getFromRanges().toArray())); |
2433 |
|
|
2434 |
|
|
2435 |
|
|
2436 |
|
|
2437 |
|
|
2438 |
1 |
dna = new Sequence("dna", "AACGacgtCTCCTCCC"); |
2439 |
1 |
dna.createDatasetSequence(); |
2440 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 1, 4, null)); |
2441 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 9, 16, null)); |
2442 |
1 |
ml = AlignmentUtils.mapCdsToProtein(dna, peptide); |
2443 |
1 |
assertEquals(3, ml.getFromRatio()); |
2444 |
1 |
assertEquals(1, ml.getToRatio()); |
2445 |
1 |
assertEquals("[[1, 3]]", |
2446 |
|
Arrays.deepToString(ml.getToRanges().toArray())); |
2447 |
1 |
assertEquals("[[1, 4], [9, 13]]", |
2448 |
|
Arrays.deepToString(ml.getFromRanges().toArray())); |
2449 |
|
|
2450 |
|
|
2451 |
|
|
2452 |
|
|
2453 |
1 |
dna = new Sequence("dna", "AACGacgtCTCCTTGATCA"); |
2454 |
1 |
dna.createDatasetSequence(); |
2455 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 1, 4, null)); |
2456 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 9, 19, null)); |
2457 |
1 |
ml = AlignmentUtils.mapCdsToProtein(dna, peptide); |
2458 |
1 |
assertNull(ml); |
2459 |
|
|
2460 |
|
|
2461 |
|
|
2462 |
|
|
2463 |
1 |
dna = new Sequence("dna", "AACGacgtCTCC"); |
2464 |
1 |
dna.createDatasetSequence(); |
2465 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 1, 4, null)); |
2466 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 9, 12, null)); |
2467 |
1 |
ml = AlignmentUtils.mapCdsToProtein(dna, peptide); |
2468 |
1 |
assertNull(ml); |
2469 |
|
|
2470 |
|
|
2471 |
|
|
2472 |
|
|
2473 |
1 |
dna = new Sequence("dna", "AACGacgtCTCCTTG"); |
2474 |
1 |
dna.createDatasetSequence(); |
2475 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 1, 4, null)); |
2476 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 9, 15, null)); |
2477 |
1 |
ml = AlignmentUtils.mapCdsToProtein(dna, peptide); |
2478 |
1 |
assertEquals(3, ml.getFromRatio()); |
2479 |
1 |
assertEquals(1, ml.getToRatio()); |
2480 |
1 |
assertEquals("[[1, 3]]", |
2481 |
|
Arrays.deepToString(ml.getToRanges().toArray())); |
2482 |
1 |
assertEquals("[[1, 4], [9, 13]]", |
2483 |
|
Arrays.deepToString(ml.getFromRanges().toArray())); |
2484 |
|
|
2485 |
|
|
2486 |
|
|
2487 |
|
|
2488 |
1 |
dna = new Sequence("dna", "ACGacgtCTCCTTGG"); |
2489 |
1 |
dna.createDatasetSequence(); |
2490 |
1 |
SequenceFeature sf = new SequenceFeature("CDS", "", 1, 3, null); |
2491 |
1 |
sf.setPhase("2"); |
2492 |
1 |
dna.addSequenceFeature(sf); |
2493 |
1 |
dna.addSequenceFeature(new SequenceFeature("CDS", "", 8, 15, null)); |
2494 |
1 |
peptide = new Sequence("pep", "XLQ"); |
2495 |
1 |
ml = AlignmentUtils.mapCdsToProtein(dna, peptide); |
2496 |
1 |
assertEquals("[[2, 3]]", |
2497 |
|
Arrays.deepToString(ml.getToRanges().toArray())); |
2498 |
1 |
assertEquals("[[3, 3], [8, 12]]", |
2499 |
|
Arrays.deepToString(ml.getFromRanges().toArray())); |
2500 |
|
} |
2501 |
|
|
2502 |
|
|
2503 |
|
|
2504 |
|
|
2505 |
|
|
2506 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
2507 |
1 |
@Test(groups = "Functional")... |
2508 |
|
public void testFindCdsForProtein() |
2509 |
|
{ |
2510 |
1 |
List<AlignedCodonFrame> mappings = new ArrayList<>(); |
2511 |
1 |
AlignedCodonFrame acf1 = new AlignedCodonFrame(); |
2512 |
1 |
mappings.add(acf1); |
2513 |
|
|
2514 |
1 |
SequenceI dna1 = new Sequence("dna1", "cgatATcgGCTATCTATGacg"); |
2515 |
1 |
dna1.createDatasetSequence(); |
2516 |
|
|
2517 |
|
|
2518 |
|
|
2519 |
1 |
SequenceI cds1 = new Sequence("cds1", "ATGCTATCT"); |
2520 |
1 |
cds1.createDatasetSequence(); |
2521 |
|
|
2522 |
1 |
SequenceI pep1 = new Sequence("pep1", "MLS"); |
2523 |
1 |
pep1.createDatasetSequence(); |
2524 |
1 |
List<AlignedCodonFrame> seqMappings = new ArrayList<>(); |
2525 |
1 |
MapList mapList = new MapList(new int[] { 5, 6, 9, 15 }, |
2526 |
|
new int[] |
2527 |
|
{ 1, 3 }, 3, 1); |
2528 |
1 |
Mapping dnaToPeptide = new Mapping(pep1.getDatasetSequence(), mapList); |
2529 |
|
|
2530 |
|
|
2531 |
1 |
seqMappings.add(acf1); |
2532 |
1 |
acf1.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), |
2533 |
|
mapList); |
2534 |
|
|
2535 |
|
|
2536 |
|
|
2537 |
|
|
2538 |
1 |
SequenceI seq = AlignmentUtils.findCdsForProtein(mappings, dna1, |
2539 |
|
seqMappings, dnaToPeptide); |
2540 |
1 |
assertNull(seq); |
2541 |
|
|
2542 |
|
|
2543 |
|
|
2544 |
|
|
2545 |
|
|
2546 |
|
|
2547 |
|
|
2548 |
1 |
AlignedCodonFrame acf2 = new AlignedCodonFrame(); |
2549 |
1 |
mappings.add(acf2); |
2550 |
1 |
MapList cdsToPeptideMapping = new MapList(new int[] { 1, 9 }, |
2551 |
|
new int[] |
2552 |
|
{ 1, 3 }, 3, 1); |
2553 |
1 |
acf2.addMap(cds1.getDatasetSequence(), pep1.getDatasetSequence(), |
2554 |
|
cdsToPeptideMapping); |
2555 |
1 |
assertNull(AlignmentUtils.findCdsForProtein(mappings, dna1, seqMappings, |
2556 |
|
dnaToPeptide)); |
2557 |
|
|
2558 |
|
|
2559 |
|
|
2560 |
|
|
2561 |
1 |
MapList dnaToCdsMapping = new MapList(new int[] { 5, 6, 9, 15 }, |
2562 |
|
new int[] |
2563 |
|
{ 1, 9 }, 1, 1); |
2564 |
1 |
acf1.addMap(dna1.getDatasetSequence(), cds1.getDatasetSequence(), |
2565 |
|
dnaToCdsMapping); |
2566 |
1 |
seq = AlignmentUtils.findCdsForProtein(mappings, dna1, seqMappings, |
2567 |
|
dnaToPeptide); |
2568 |
1 |
assertSame(seq, cds1.getDatasetSequence()); |
2569 |
|
} |
2570 |
|
|
2571 |
|
|
2572 |
|
|
2573 |
|
|
2574 |
|
|
2575 |
|
|
2576 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (28) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
2577 |
1 |
@Test(groups = "Functional")... |
2578 |
|
public void testFindCdsForProtein_noUTR() |
2579 |
|
{ |
2580 |
1 |
List<AlignedCodonFrame> mappings = new ArrayList<>(); |
2581 |
1 |
AlignedCodonFrame acf1 = new AlignedCodonFrame(); |
2582 |
1 |
mappings.add(acf1); |
2583 |
|
|
2584 |
1 |
SequenceI dna1 = new Sequence("dna1", "ATGCTATCTTAA"); |
2585 |
1 |
dna1.createDatasetSequence(); |
2586 |
|
|
2587 |
|
|
2588 |
|
|
2589 |
1 |
SequenceI cds1 = new Sequence("cds1", "ATGCTATCT"); |
2590 |
1 |
cds1.createDatasetSequence(); |
2591 |
|
|
2592 |
1 |
SequenceI pep1 = new Sequence("pep1", "MLS"); |
2593 |
1 |
pep1.createDatasetSequence(); |
2594 |
1 |
List<AlignedCodonFrame> seqMappings = new ArrayList<>(); |
2595 |
1 |
MapList mapList = new MapList(new int[] { 1, 9 }, new int[] { 1, 3 }, 3, |
2596 |
|
1); |
2597 |
1 |
Mapping dnaToPeptide = new Mapping(pep1.getDatasetSequence(), mapList); |
2598 |
|
|
2599 |
|
|
2600 |
1 |
seqMappings.add(acf1); |
2601 |
1 |
acf1.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), |
2602 |
|
mapList); |
2603 |
|
|
2604 |
|
|
2605 |
|
|
2606 |
|
|
2607 |
|
|
2608 |
1 |
SequenceI seq = AlignmentUtils.findCdsForProtein(mappings, dna1, |
2609 |
|
seqMappings, dnaToPeptide); |
2610 |
1 |
assertSame(seq, dna1.getDatasetSequence()); |
2611 |
|
|
2612 |
|
|
2613 |
|
|
2614 |
|
|
2615 |
|
|
2616 |
1 |
dna1.addSequenceFeature( |
2617 |
|
new SequenceFeature(SequenceOntologyI.CDS, "cds", 1, 12, null)); |
2618 |
1 |
seq = AlignmentUtils.findCdsForProtein(mappings, dna1, seqMappings, |
2619 |
|
dnaToPeptide); |
2620 |
1 |
assertNull(seq); |
2621 |
|
|
2622 |
|
|
2623 |
|
|
2624 |
|
|
2625 |
|
|
2626 |
|
|
2627 |
|
|
2628 |
1 |
AlignedCodonFrame acf2 = new AlignedCodonFrame(); |
2629 |
1 |
mappings.add(acf2); |
2630 |
1 |
MapList cdsToPeptideMapping = new MapList(new int[] { 1, 9 }, |
2631 |
|
new int[] |
2632 |
|
{ 1, 3 }, 3, 1); |
2633 |
1 |
acf2.addMap(cds1.getDatasetSequence(), pep1.getDatasetSequence(), |
2634 |
|
cdsToPeptideMapping); |
2635 |
1 |
assertNull(AlignmentUtils.findCdsForProtein(mappings, dna1, seqMappings, |
2636 |
|
dnaToPeptide)); |
2637 |
|
|
2638 |
|
|
2639 |
|
|
2640 |
|
|
2641 |
1 |
MapList dnaToCdsMapping = new MapList(new int[] { 1, 9 }, |
2642 |
|
new int[] |
2643 |
|
{ 1, 9 }, 1, 1); |
2644 |
1 |
acf1.addMap(dna1.getDatasetSequence(), cds1.getDatasetSequence(), |
2645 |
|
dnaToCdsMapping); |
2646 |
1 |
seq = AlignmentUtils.findCdsForProtein(mappings, dna1, seqMappings, |
2647 |
|
dnaToPeptide); |
2648 |
1 |
assertSame(seq, cds1.getDatasetSequence()); |
2649 |
|
} |
2650 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (33) |
Complexity: 2 |
Complexity Density: 0.06 |
1PASS
|
|
2651 |
1 |
@Test(groups = "Functional")... |
2652 |
|
public void testAddReferenceAnnotations() |
2653 |
|
{ |
2654 |
1 |
SequenceI longseq = new Sequence("longA", "ASDASDASDASDAASDASDASDASDA"); |
2655 |
1 |
Annotation[] aa = new Annotation[longseq.getLength()]; |
2656 |
|
|
2657 |
27 |
for (int p = 0; p < aa.length; p++) |
2658 |
|
{ |
2659 |
26 |
aa[p] = new Annotation("P", "pos " + (p + 1), (char) 0, |
2660 |
|
(float) p + 1); |
2661 |
|
} |
2662 |
1 |
AlignmentAnnotation refAnnot = new AlignmentAnnotation("LongSeqAnnot", |
2663 |
|
"Annotations", aa); |
2664 |
1 |
refAnnot.setCalcId("Test"); |
2665 |
1 |
longseq.addAlignmentAnnotation(refAnnot); |
2666 |
1 |
verifyExpectedSequenceAnnotation(refAnnot); |
2667 |
|
|
2668 |
1 |
Alignment ourAl = new Alignment( |
2669 |
|
new SequenceI[] |
2670 |
|
{ longseq.getSubSequence(5, 10), |
2671 |
|
longseq.getSubSequence(7, 12) }); |
2672 |
1 |
ourAl.createDatasetAlignment(); |
2673 |
|
|
2674 |
|
|
2675 |
1 |
SortedMap<String, String> tipEntries = new TreeMap<>(); |
2676 |
1 |
Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<>(); |
2677 |
|
|
2678 |
1 |
AlignmentUtils.findAddableReferenceAnnotations(ourAl.getSequences(), |
2679 |
|
tipEntries, candidates, ourAl); |
2680 |
1 |
AlignmentUtils.addReferenceAnnotations(candidates, ourAl, null); |
2681 |
|
|
2682 |
1 |
assertNotNull(ourAl.getAlignmentAnnotation()); |
2683 |
1 |
assertEquals(ourAl.getAlignmentAnnotation().length, 2); |
2684 |
|
|
2685 |
1 |
for (AlignmentAnnotation alan : ourAl.getAlignmentAnnotation()) |
2686 |
|
{ |
2687 |
2 |
verifyExpectedSequenceAnnotation(alan); |
2688 |
|
} |
2689 |
|
|
2690 |
|
|
2691 |
1 |
SequenceI[] newSeqAl = new SequenceI[2]; |
2692 |
|
|
2693 |
1 |
newSeqAl[0] = new Sequence(ourAl.getSequenceAt(0), |
2694 |
|
ourAl.getSequenceAt(0).getAnnotation()); |
2695 |
1 |
newSeqAl[1] = new Sequence(ourAl.getSequenceAt(1), |
2696 |
|
ourAl.getSequenceAt(1).getAnnotation()); |
2697 |
|
|
2698 |
1 |
Alignment newAl = new Alignment(newSeqAl); |
2699 |
|
|
2700 |
1 |
for (SequenceI sq : newAl.getSequences()) |
2701 |
|
{ |
2702 |
2 |
sq.setAlignmentAnnotation(new AlignmentAnnotation[0]); |
2703 |
|
} |
2704 |
|
|
2705 |
1 |
SequenceGroup sg = new SequenceGroup(Arrays.asList(newSeqAl)); |
2706 |
1 |
sg.setStartRes(0); |
2707 |
1 |
sg.setEndRes(newAl.getWidth()); |
2708 |
1 |
AlignmentUtils.addReferenceAnnotationTo(newAl, newSeqAl[0], |
2709 |
|
newSeqAl[0].getDatasetSequence().getAnnotation()[0], sg); |
2710 |
1 |
AlignmentUtils.addReferenceAnnotationTo(newAl, newSeqAl[1], |
2711 |
|
newSeqAl[1].getDatasetSequence().getAnnotation()[0], sg); |
2712 |
1 |
for (AlignmentAnnotation alan : newAl.getAlignmentAnnotation()) |
2713 |
|
{ |
2714 |
2 |
verifyExpectedSequenceAnnotation(alan); |
2715 |
|
} |
2716 |
|
} |
2717 |
|
|
2718 |
|
|
2719 |
|
|
2720 |
|
|
2721 |
|
|
2722 |
|
@param |
2723 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
2724 |
5 |
private void verifyExpectedSequenceAnnotation(AlignmentAnnotation alan)... |
2725 |
|
{ |
2726 |
51 |
for (int c = 0; c < alan.annotations.length; c++) |
2727 |
|
{ |
2728 |
46 |
Annotation a = alan.annotations[c]; |
2729 |
46 |
if (a != null) |
2730 |
|
{ |
2731 |
46 |
assertEquals("Misaligned annotation at " + c, |
2732 |
|
(float) alan.sequenceRef.findPosition(c), a.value); |
2733 |
|
} |
2734 |
|
else |
2735 |
|
{ |
2736 |
0 |
assertTrue("Unexpected Null at position " + c, |
2737 |
|
c >= alan.sequenceRef.getLength() |
2738 |
|
|| Comparison.isGap(alan.sequenceRef.getCharAt(c))); |
2739 |
|
} |
2740 |
|
} |
2741 |
|
} |
2742 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (28) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
2743 |
1 |
@Test(groups = "Functional")... |
2744 |
|
public void testAddReferenceContactMap() |
2745 |
|
{ |
2746 |
1 |
SequenceI sq = new Sequence("a", "SSSQ"); |
2747 |
1 |
ContactMatrixI cm = new SeqDistanceContactMatrix(4); |
2748 |
1 |
AlignmentAnnotation cm_aan = sq.addContactList(cm); |
2749 |
1 |
cm_aan.description = cm_aan.description + " cm1"; |
2750 |
1 |
SequenceI dssq = sq.createDatasetSequence(); |
2751 |
|
|
2752 |
|
|
2753 |
1 |
sq.removeAlignmentAnnotation(sq.getAnnotation()[0]); |
2754 |
|
|
2755 |
1 |
Alignment al = new Alignment(new SequenceI[] { sq }); |
2756 |
1 |
SortedMap<String, String> tipEntries = new TreeMap<>(); |
2757 |
1 |
Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<>(); |
2758 |
|
|
2759 |
1 |
AlignmentUtils.findAddableReferenceAnnotations(al.getSequences(), |
2760 |
|
tipEntries, candidates, al); |
2761 |
1 |
AlignmentUtils.addReferenceAnnotations(candidates, al, null); |
2762 |
1 |
assertTrue("No contact map annotation transferred", |
2763 |
|
al.getAlignmentAnnotation() != null |
2764 |
|
&& al.getAlignmentAnnotation().length == 1); |
2765 |
1 |
AlignmentAnnotation alan = al.findAnnotations(sq, null, cm_aan.label) |
2766 |
|
.iterator().next(); |
2767 |
1 |
ContactMatrixI t_cm = al.getContactMatrixFor(alan); |
2768 |
1 |
assertNotNull("No contact map for the transferred annotation row.", |
2769 |
|
t_cm); |
2770 |
1 |
assertTrue(t_cm instanceof SeqDistanceContactMatrix); |
2771 |
1 |
assertTrue(((SeqDistanceContactMatrix) t_cm).hasReferenceSeq()); |
2772 |
|
|
2773 |
1 |
ContactListI cl = al.getContactListFor(alan, 1); |
2774 |
1 |
assertNotNull( |
2775 |
|
"No contact matrix recovered after reference annotation transfer", |
2776 |
|
cl); |
2777 |
|
|
2778 |
|
|
2779 |
1 |
cl = al.getContactListFor(alan, 3); |
2780 |
1 |
assertNotNull( |
2781 |
|
"Contact matrix should have data for last position in sequence", |
2782 |
|
cl); |
2783 |
|
|
2784 |
1 |
ContactMatrixI cm2 = new SeqDistanceContactMatrix(4); |
2785 |
1 |
dssq.addContactList(cm2); |
2786 |
1 |
tipEntries = new TreeMap<>(); |
2787 |
1 |
candidates = new LinkedHashMap<>(); |
2788 |
|
|
2789 |
1 |
AlignmentUtils.findAddableReferenceAnnotations(al.getSequences(), |
2790 |
|
tipEntries, candidates, al); |
2791 |
1 |
AlignmentUtils.addReferenceAnnotations(candidates, al, null); |
2792 |
1 |
assertTrue("Expected two contact map annotation transferred", |
2793 |
|
al.getAlignmentAnnotation() != null |
2794 |
|
&& al.getAlignmentAnnotation().length == 2); |
2795 |
|
|
2796 |
|
} |
2797 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
2798 |
5 |
@Test(... |
2799 |
|
groups = "Functional", |
2800 |
|
dataProvider = "SecondaryStructureAnnotations") |
2801 |
|
public void testSecondaryStructurePresentAndSources( |
2802 |
|
AlignmentAnnotation[] annotations, boolean expectedSSPresent, |
2803 |
|
ArrayList<String> expectedSSSources) |
2804 |
|
{ |
2805 |
5 |
Assert.assertEquals(expectedSSPresent, |
2806 |
|
AlignmentUtils.isSecondaryStructurePresent(annotations)); |
2807 |
|
} |
2808 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
2809 |
1 |
@DataProvider(name = "SecondaryStructureAnnotations")... |
2810 |
|
public static Object[][] provideSecondaryStructureAnnotations() |
2811 |
|
{ |
2812 |
1 |
AlignmentAnnotation ann1 = new AlignmentAnnotation( |
2813 |
|
"Secondary Structure", "Secondary Structure", |
2814 |
|
new Annotation[] {}); |
2815 |
1 |
AlignmentAnnotation ann2 = new AlignmentAnnotation("jnetpred", |
2816 |
|
"jnetpred", new Annotation[] {}); |
2817 |
1 |
AlignmentAnnotation ann3 = new AlignmentAnnotation("Temp", "Temp", |
2818 |
|
new Annotation[] {}); |
2819 |
1 |
AlignmentAnnotation ann4 = new AlignmentAnnotation("Temp", "Temp", |
2820 |
|
new Annotation[] {}); |
2821 |
|
|
2822 |
1 |
List<String> ssSources1 = new ArrayList<>( |
2823 |
|
Arrays.asList("3D Structures")); |
2824 |
1 |
List<String> ssSources2 = new ArrayList<>(Arrays.asList("JPred")); |
2825 |
1 |
List<String> ssSources3 = new ArrayList<>( |
2826 |
|
Arrays.asList("3D Structures", "JPred")); |
2827 |
1 |
List<String> ssSources4 = new ArrayList<>(); |
2828 |
|
|
2829 |
1 |
return new Object[][] { |
2830 |
|
{ new AlignmentAnnotation[] |
2831 |
|
{ ann1, ann3, ann4 }, true, ssSources1 }, |
2832 |
|
{ new AlignmentAnnotation[] |
2833 |
|
{ ann2, ann3, ann4 }, true, ssSources2 }, |
2834 |
|
{ new AlignmentAnnotation[] |
2835 |
|
{ ann3, ann4 }, false, ssSources4 }, |
2836 |
|
{ new AlignmentAnnotation[] {}, false, ssSources4 }, |
2837 |
|
{ new AlignmentAnnotation[] |
2838 |
|
{ ann1, ann2, ann3, ann4 }, true, ssSources3 } }; |
2839 |
|
} |
2840 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
2841 |
0 |
@Test(dataProvider = "SecondaryStructureAnnotationColours")... |
2842 |
|
public void testSecondaryStructureAnnotationColour(char symbol, |
2843 |
|
Color expectedColor) |
2844 |
|
{ |
2845 |
0 |
Color actualColor = AlignmentUtils |
2846 |
|
.getSecondaryStructureAnnotationColour(symbol); |
2847 |
0 |
Assert.assertEquals(actualColor, expectedColor); |
2848 |
|
} |
2849 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2850 |
0 |
@DataProvider(name = "SecondaryStructureAnnotationColours")... |
2851 |
|
public static Object[][] provideSecondaryStructureAnnotationColours() |
2852 |
|
{ |
2853 |
0 |
return new Object[][] { { 'C', Color.gray }, { 'E', Color.green }, |
2854 |
|
{ 'H', Color.red }, |
2855 |
|
{ '-', Color.white } }; |
2856 |
|
} |
2857 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
2858 |
0 |
@Test(dataProvider = "SSAnnotationPresence")... |
2859 |
|
public void testIsSSAnnotationPresent( |
2860 |
|
Map<SequenceI, List<AlignmentAnnotation>> annotations, |
2861 |
|
boolean expectedPresence) |
2862 |
|
{ |
2863 |
0 |
boolean actualPresence = AlignmentUtils |
2864 |
|
.isSSAnnotationPresent(annotations); |
2865 |
0 |
Assert.assertEquals(actualPresence, expectedPresence); |
2866 |
|
} |
2867 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
|
2868 |
0 |
@DataProvider(name = "SSAnnotationPresence")... |
2869 |
|
public static Object[][] provideSSAnnotationPresence() |
2870 |
|
{ |
2871 |
0 |
Map<SequenceI, List<AlignmentAnnotation>> annotations1 = new HashMap<>(); |
2872 |
0 |
SequenceI seq1 = new Sequence("Seq1", "ASD---ASD---ASD", 37, 45); |
2873 |
0 |
List<AlignmentAnnotation> annotationsList1 = new ArrayList<>(); |
2874 |
0 |
annotationsList1.add(new AlignmentAnnotation("Secondary Structure", |
2875 |
|
"Secondary Structure", new Annotation[] {})); |
2876 |
0 |
annotations1.put(seq1, annotationsList1); |
2877 |
|
|
2878 |
|
|
2879 |
0 |
Map<SequenceI, List<AlignmentAnnotation>> annotations2 = new HashMap<>(); |
2880 |
0 |
SequenceI seq2 = new Sequence("Seq2", "ASD---ASD------", 37, 42); |
2881 |
0 |
List<AlignmentAnnotation> annotationsList2 = new ArrayList<>(); |
2882 |
0 |
annotationsList2.add(new AlignmentAnnotation("Other Annotation", |
2883 |
|
"Other Annotation", new Annotation[] {})); |
2884 |
0 |
annotations2.put(seq2, annotationsList2); |
2885 |
|
|
2886 |
|
|
2887 |
0 |
Map<SequenceI, List<AlignmentAnnotation>> annotations3 = new HashMap<>(); |
2888 |
|
|
2889 |
|
|
2890 |
0 |
Map<SequenceI, List<AlignmentAnnotation>> annotations4 = new HashMap<>(); |
2891 |
0 |
SequenceI seq4 = new Sequence("Seq4", "ASD---ASD---AS-", 37, 44); |
2892 |
0 |
List<AlignmentAnnotation> annotationsList4 = new ArrayList<>(); |
2893 |
0 |
annotationsList4.add(new AlignmentAnnotation("jnetpred", "jnetpred", |
2894 |
|
new Annotation[] {})); |
2895 |
0 |
annotations4.put(seq4, annotationsList4); |
2896 |
|
|
2897 |
|
|
2898 |
0 |
return new Object[][] { { annotations1, true }, |
2899 |
|
|
2900 |
|
|
2901 |
|
{ annotations2, false }, |
2902 |
|
|
2903 |
|
{ annotations3, false }, |
2904 |
|
{ annotations4, true }, |
2905 |
|
|
2906 |
|
}; |
2907 |
|
} |
2908 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 1 |
Complexity Density: 0.05 |
|
2909 |
0 |
@DataProvider(name = "SSSourceFromAnnotationDescription")... |
2910 |
|
public static Object[][] provideSSSourceFromAnnotationDescription() |
2911 |
|
{ |
2912 |
0 |
Map<SequenceI, List<AlignmentAnnotation>> annotations1 = new HashMap<>(); |
2913 |
0 |
SequenceI seq1 = new Sequence("Seq1", "ASD---ASD---ASD", 37, 45); |
2914 |
0 |
List<AlignmentAnnotation> annotationsList1 = new ArrayList<>(); |
2915 |
0 |
annotationsList1.add(new AlignmentAnnotation("jnetpred", "JPred Output", |
2916 |
|
new Annotation[] {})); |
2917 |
0 |
annotations1.put(seq1, annotationsList1); |
2918 |
|
|
2919 |
|
|
2920 |
0 |
Map<SequenceI, List<AlignmentAnnotation>> annotations2 = new HashMap<>(); |
2921 |
0 |
SequenceI seq2 = new Sequence("Seq2", "ASD---ASD------", 37, 42); |
2922 |
0 |
List<AlignmentAnnotation> annotationsList2 = new ArrayList<>(); |
2923 |
0 |
annotationsList2.add(new AlignmentAnnotation("Secondary Structure", |
2924 |
|
"Secondary Structure for af-q43517-f1A", new Annotation[] {})); |
2925 |
0 |
annotations2.put(seq2, annotationsList2); |
2926 |
|
|
2927 |
|
|
2928 |
|
|
2929 |
0 |
Map<SequenceI, List<AlignmentAnnotation>> annotations3 = new HashMap<>(); |
2930 |
|
|
2931 |
|
|
2932 |
0 |
Map<SequenceI, List<AlignmentAnnotation>> annotations4 = new HashMap<>(); |
2933 |
0 |
SequenceI seq4 = new Sequence("Seq4", "ASD---ASD---AS-", 37, 44); |
2934 |
0 |
List<AlignmentAnnotation> annotationsList4 = new ArrayList<>(); |
2935 |
0 |
annotationsList4.add(new AlignmentAnnotation("Secondary Structure", |
2936 |
|
"Secondary Structure for 4zhpA", new Annotation[] {})); |
2937 |
0 |
annotations4.put(seq4, annotationsList4); |
2938 |
|
|
2939 |
|
|
2940 |
0 |
Map<SequenceI, List<AlignmentAnnotation>> annotations5 = new HashMap<>(); |
2941 |
0 |
SequenceI seq5 = new Sequence("Seq5", "ASD---ASD---AS-", 37, 44); |
2942 |
0 |
List<AlignmentAnnotation> annotationsList5 = new ArrayList<>(); |
2943 |
0 |
annotationsList5.add(new AlignmentAnnotation("Secondary Structure", |
2944 |
|
"Secondary Structure for p09911_54-147__3a7wzn.1.p3502557454997462030P", |
2945 |
|
new Annotation[] {})); |
2946 |
0 |
annotations5.put(seq5, annotationsList5); |
2947 |
|
|
2948 |
|
|
2949 |
|
|
2950 |
|
|
2951 |
|
|
2952 |
|
|
2953 |
|
|
2954 |
|
|
2955 |
|
|
2956 |
0 |
return new Object[][] { { annotations1, "JPred" }, |
2957 |
|
{ annotations2, "Alphafold" }, |
2958 |
|
{ annotations3, null }, |
2959 |
|
{ annotations4, "PDB" }, |
2960 |
|
{ annotations5, "Swiss Model" } }; |
2961 |
|
} |
2962 |
|
|
2963 |
|
} |