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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (29) |
Complexity: 2 |
Complexity Density: 0.07 |
|
50 |
|
public class GffTests |
51 |
|
{ |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
53 |
1 |
@BeforeClass(alwaysRun = true)... |
54 |
|
public void setUpJvOptionPane() |
55 |
|
{ |
56 |
1 |
JvOptionPane.setInteractiveMode(false); |
57 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
58 |
|
} |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
65 |
1 |
@Test(groups = "Functional")... |
66 |
|
public void testResolveExonerateGff() |
67 |
|
{ |
68 |
1 |
String proteinSeq = ">prot1/10-16\nYCWRSGA"; |
69 |
1 |
AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(proteinSeq, |
70 |
|
DataSourceType.PASTE); |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
1 |
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 |
1 |
af.loadJalviewDataFile(exonerateGff, DataSourceType.PASTE, null, null); |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
1 |
AlignmentI dataset = af.getViewport().getAlignment().getDataset(); |
84 |
1 |
assertEquals(1, dataset.getSequences().size()); |
85 |
1 |
assertEquals("prot1", dataset.getSequenceAt(0).getName()); |
86 |
1 |
assertEquals("YCWRSGA", dataset.getSequenceAt(0).getSequenceAsString()); |
87 |
1 |
List<AlignedCodonFrame> mappings = dataset.getCodonFrames(); |
88 |
1 |
assertEquals(1, mappings.size()); |
89 |
1 |
AlignedCodonFrame mapping = mappings.iterator().next(); |
90 |
1 |
SequenceI mappedDna = mapping.getDnaForAaSeq(dataset.getSequenceAt(0)); |
91 |
1 |
assertTrue(mappedDna instanceof SequenceDummy); |
92 |
1 |
assertEquals("dna1", mappedDna.getName()); |
93 |
1 |
Mapping[] mapList = mapping.getProtMappings(); |
94 |
1 |
assertEquals(1, mapList.length); |
95 |
|
|
96 |
1 |
int[] mappedRegion = mapList[0].getMap().locateInFrom(11, 11); |
97 |
1 |
assertArrayEquals(new int[] { 24, 22 }, mappedRegion); |
98 |
|
|
99 |
1 |
mappedRegion = mapList[0].getMap().locateInFrom(15, 15); |
100 |
1 |
assertArrayEquals(new int[] { 12, 10 }, mappedRegion); |
101 |
|
|
102 |
1 |
SequenceI dna1 = new Sequence("dna1", "AAACCCGGGTTTAAACCCGGGTTT"); |
103 |
1 |
AlignmentI al = new Alignment(new SequenceI[] { dna1 }); |
104 |
1 |
al.setDataset(null); |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
1 |
mapping.realiseWith(dna1); |
112 |
|
|
113 |
1 |
assertSame(dna1.getDatasetSequence(), |
114 |
|
mapping.getDnaForAaSeq(dataset.getSequenceAt(0))); |
115 |
|
} |
116 |
|
} |