1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.io.gff; |
22 |
|
|
23 |
|
import static org.testng.AssertJUnit.assertEquals; |
24 |
|
import static org.testng.AssertJUnit.assertSame; |
25 |
|
import static org.testng.AssertJUnit.assertTrue; |
26 |
|
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; |
27 |
|
|
28 |
|
import jalview.datamodel.AlignedCodonFrame; |
29 |
|
import jalview.datamodel.Alignment; |
30 |
|
import jalview.datamodel.AlignmentI; |
31 |
|
import jalview.datamodel.Mapping; |
32 |
|
import jalview.datamodel.Sequence; |
33 |
|
import jalview.datamodel.SequenceDummy; |
34 |
|
import jalview.datamodel.SequenceI; |
35 |
|
import jalview.gui.AlignFrame; |
36 |
|
import jalview.gui.JvOptionPane; |
37 |
|
import jalview.io.DataSourceType; |
38 |
|
import jalview.io.FileLoader; |
39 |
|
|
40 |
|
import java.util.List; |
41 |
|
|
42 |
|
import org.testng.annotations.BeforeClass; |
43 |
|
import org.testng.annotations.Test; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 2 |
Complexity Density: 0.07 |
|
50 |
|
public class GffTests |
51 |
|
{ |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
53 |
0 |
@BeforeClass(alwaysRun = true)... |
54 |
|
public void setUpJvOptionPane() |
55 |
|
{ |
56 |
0 |
JvOptionPane.setInteractiveMode(false); |
57 |
0 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
58 |
|
} |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 1 |
Complexity Density: 0.04 |
4-
|
|
65 |
0 |
@Test(groups = "Functional")... |
66 |
|
public void testResolveExonerateGff() |
67 |
|
{ |
68 |
0 |
String proteinSeq = ">prot1/10-16\nYCWRSGA"; |
69 |
0 |
AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(proteinSeq, |
70 |
|
DataSourceType.PASTE); |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
0 |
String exonerateGff = "##gff-version 2\n" |
77 |
|
+ "prot1\tprotein2genome\tsimilarity\t11\t15\t99\t-\t.\talignment_id 0 ; Target dna1 ; Align 11 24 5"; |
78 |
0 |
af.loadJalviewDataFile(exonerateGff, DataSourceType.PASTE, null, null); |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
0 |
AlignmentI dataset = af.getViewport().getAlignment().getDataset(); |
84 |
0 |
assertEquals(1, dataset.getSequences().size()); |
85 |
0 |
assertEquals("prot1", dataset.getSequenceAt(0).getName()); |
86 |
0 |
assertEquals("YCWRSGA", dataset.getSequenceAt(0).getSequenceAsString()); |
87 |
0 |
List<AlignedCodonFrame> mappings = dataset.getCodonFrames(); |
88 |
0 |
assertEquals(1, mappings.size()); |
89 |
0 |
AlignedCodonFrame mapping = mappings.iterator().next(); |
90 |
0 |
SequenceI mappedDna = mapping.getDnaForAaSeq(dataset.getSequenceAt(0)); |
91 |
0 |
assertTrue(mappedDna instanceof SequenceDummy); |
92 |
0 |
assertEquals("dna1", mappedDna.getName()); |
93 |
0 |
Mapping[] mapList = mapping.getProtMappings(); |
94 |
0 |
assertEquals(1, mapList.length); |
95 |
|
|
96 |
0 |
int[] mappedRegion = mapList[0].getMap().locateInFrom(11, 11); |
97 |
0 |
assertArrayEquals(new int[] { 24, 22 }, mappedRegion); |
98 |
|
|
99 |
0 |
mappedRegion = mapList[0].getMap().locateInFrom(15, 15); |
100 |
0 |
assertArrayEquals(new int[] { 12, 10 }, mappedRegion); |
101 |
|
|
102 |
0 |
SequenceI dna1 = new Sequence("dna1", "AAACCCGGGTTTAAACCCGGGTTT"); |
103 |
0 |
AlignmentI al = new Alignment(new SequenceI[] { dna1 }); |
104 |
0 |
al.setDataset(null); |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
0 |
mapping.realiseWith(dna1); |
112 |
|
|
113 |
0 |
assertSame(dna1.getDatasetSequence(), |
114 |
|
mapping.getDnaForAaSeq(dataset.getSequenceAt(0))); |
115 |
|
} |
116 |
|
} |