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.assertNotNull; |
25 |
|
import static org.testng.AssertJUnit.assertSame; |
26 |
|
import static org.testng.AssertJUnit.assertTrue; |
27 |
|
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; |
28 |
|
|
29 |
|
import jalview.datamodel.AlignedCodonFrame; |
30 |
|
import jalview.datamodel.Alignment; |
31 |
|
import jalview.datamodel.AlignmentI; |
32 |
|
import jalview.datamodel.Sequence; |
33 |
|
import jalview.datamodel.SequenceDummy; |
34 |
|
import jalview.datamodel.SequenceFeature; |
35 |
|
import jalview.datamodel.SequenceI; |
36 |
|
import jalview.gui.JvOptionPane; |
37 |
|
|
38 |
|
import java.io.IOException; |
39 |
|
import java.util.ArrayList; |
40 |
|
import java.util.List; |
41 |
|
import java.util.Map; |
42 |
|
|
43 |
|
import org.testng.annotations.BeforeClass; |
44 |
|
import org.testng.annotations.Test; |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 2 |
Complexity Density: 0.06 |
|
46 |
|
public class InterProScanHelperTest |
47 |
|
{ |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
49 |
0 |
@BeforeClass(alwaysRun = true)... |
50 |
|
public void setUpJvOptionPane() |
51 |
|
{ |
52 |
0 |
JvOptionPane.setInteractiveMode(false); |
53 |
0 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
54 |
|
} |
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
@throws |
60 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 1 |
Complexity Density: 0.03 |
4-
|
|
61 |
0 |
@Test(groups = "Functional")... |
62 |
|
public void testProcessProteinMatch() throws IOException |
63 |
|
{ |
64 |
0 |
InterProScanHelper testee = new InterProScanHelper(); |
65 |
0 |
List<SequenceI> newseqs = new ArrayList<SequenceI>(); |
66 |
0 |
String[] gff = "Submitted\tPfam\tprotein_match\t5\t30\t0\t+\t.\tName=PF12838;Target=Submitted 5 30;signature_desc=4Fe-4S dicluster domain;ID=match$17_5_30" |
67 |
|
.split("\\t"); |
68 |
0 |
SequenceI seq = new Sequence("Prot1", "PQRASTGKEEDVMIWCHQN"); |
69 |
0 |
seq.createDatasetSequence(); |
70 |
0 |
AlignmentI align = new Alignment(new SequenceI[] {}); |
71 |
0 |
Map<String, List<String>> set = Gff3Helper.parseNameValuePairs(gff[8]); |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
0 |
testee.processProteinMatch(set, seq, gff, align, newseqs, false); |
78 |
0 |
assertEquals(1, newseqs.size()); |
79 |
0 |
assertTrue(newseqs.get(0) instanceof SequenceDummy); |
80 |
0 |
assertEquals("match$17_5_30", newseqs.get(0).getName()); |
81 |
|
|
82 |
0 |
assertNotNull(newseqs.get(0).getSequenceFeatures()); |
83 |
0 |
assertEquals(1, newseqs.get(0).getSequenceFeatures().size()); |
84 |
0 |
SequenceFeature sf = newseqs.get(0).getSequenceFeatures().get(0); |
85 |
0 |
assertEquals(1, sf.getBegin()); |
86 |
0 |
assertEquals(26, sf.getEnd()); |
87 |
0 |
assertEquals("Pfam", sf.getType()); |
88 |
0 |
assertEquals("4Fe-4S dicluster domain", sf.getDescription()); |
89 |
0 |
assertEquals("InterProScan", sf.getFeatureGroup()); |
90 |
|
|
91 |
0 |
assertEquals(1, align.getCodonFrames().size()); |
92 |
0 |
AlignedCodonFrame mapping = align.getCodonFrames().iterator().next(); |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
0 |
assertEquals(1, mapping.getAaSeqs().length); |
100 |
0 |
assertSame(seq.getDatasetSequence(), mapping.getdnaSeqs()[0]); |
101 |
0 |
assertEquals(1, mapping.getdnaSeqs().length); |
102 |
0 |
assertSame(newseqs.get(0), mapping.getAaSeqs()[0]); |
103 |
0 |
assertEquals(1, mapping.getdnaToProt().length); |
104 |
0 |
assertEquals(1, mapping.getdnaToProt()[0].getFromRanges().size()); |
105 |
0 |
assertArrayEquals(new int[] { 5, 30 }, |
106 |
|
mapping.getdnaToProt()[0].getFromRanges().get(0)); |
107 |
0 |
assertEquals(1, mapping.getdnaToProt()[0].getToRanges().size()); |
108 |
0 |
assertArrayEquals(new int[] { 1, 26 }, |
109 |
|
mapping.getdnaToProt()[0].getToRanges().get(0)); |
110 |
|
} |
111 |
|
|
112 |
|
} |