1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ext.so; |
22 |
|
|
23 |
|
import static org.testng.AssertJUnit.assertFalse; |
24 |
|
import static org.testng.AssertJUnit.assertTrue; |
25 |
|
|
26 |
|
import jalview.gui.JvOptionPane; |
27 |
|
import jalview.io.gff.SequenceOntologyI; |
28 |
|
|
29 |
|
import org.testng.annotations.BeforeClass; |
30 |
|
import org.testng.annotations.Test; |
31 |
|
|
|
|
| 96.6% |
Uncovered Elements: 2 (58) |
Complexity: 6 |
Complexity Density: 0.11 |
|
32 |
|
public class SequenceOntologyTest |
33 |
|
{ |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
35 |
1 |
@BeforeClass(alwaysRun = true)... |
36 |
|
public void setUpJvOptionPane() |
37 |
|
{ |
38 |
1 |
JvOptionPane.setInteractiveMode(false); |
39 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
40 |
|
} |
41 |
|
|
42 |
|
private SequenceOntologyI so; |
43 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
44 |
1 |
@BeforeClass(alwaysRun = true)... |
45 |
|
public void setUp() |
46 |
|
{ |
47 |
1 |
long now = System.currentTimeMillis(); |
48 |
1 |
try |
49 |
|
{ |
50 |
1 |
so = new SequenceOntology(); |
51 |
|
} catch (Throwable t) |
52 |
|
{ |
53 |
0 |
System.out.println("SOTest error "); |
54 |
0 |
t.printStackTrace(System.err); |
55 |
|
} |
56 |
1 |
long elapsed = System.currentTimeMillis() - now; |
57 |
1 |
System.out.println( |
58 |
|
"Load and cache of Sequence Ontology took " + elapsed + "ms"); |
59 |
|
} |
60 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
61 |
1 |
@Test(groups = "Functional")... |
62 |
|
public void testIsA() |
63 |
|
{ |
64 |
1 |
assertFalse(so.isA(null, null)); |
65 |
1 |
assertFalse(so.isA(null, "SO:0000087")); |
66 |
1 |
assertFalse(so.isA("SO:0000087", null)); |
67 |
1 |
assertFalse(so.isA("complete", "garbage")); |
68 |
|
|
69 |
1 |
assertTrue(so.isA("SO:0000087", "SO:0000704")); |
70 |
1 |
assertFalse(so.isA("SO:0000704", "SO:0000087")); |
71 |
1 |
assertTrue(so.isA("SO:0000736", "SO:0000735")); |
72 |
|
|
73 |
|
|
74 |
1 |
assertTrue(so.isA("micronuclear_sequence", "micronuclear_sequence")); |
75 |
|
|
76 |
1 |
assertTrue(so.isA("micronuclear_sequence", "organelle_sequence")); |
77 |
|
|
78 |
1 |
assertTrue(so.isA("micronuclear_sequence", "sequence_location")); |
79 |
|
|
80 |
1 |
assertTrue(so.isA("micronuclear_sequence", "sequence_attribute")); |
81 |
|
|
82 |
|
|
83 |
1 |
assertTrue(so.isA("micronuclear_sequence", "SO:0000084")); |
84 |
1 |
assertTrue(so.isA("SO:0000084", "micronuclear_sequence")); |
85 |
1 |
assertTrue(so.isA("SO:0000084", "SO:0000084")); |
86 |
|
|
87 |
|
|
88 |
1 |
assertTrue(so.isA("SO:0000084", "organelle_sequence")); |
89 |
1 |
assertTrue(so.isA("SO:0000084", "sequence_location")); |
90 |
1 |
assertTrue(so.isA("SO:0000084", "sequence_attribute")); |
91 |
|
|
92 |
|
|
93 |
1 |
assertTrue(so.isA("micronuclear_sequence", "SO:0000736")); |
94 |
1 |
assertTrue(so.isA("micronuclear_sequence", "SO:0000735")); |
95 |
1 |
assertTrue(so.isA("micronuclear_sequence", "SO:0000400")); |
96 |
|
} |
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
98 |
1 |
@Test(groups = "Functional")... |
99 |
|
public void testIsCDS() |
100 |
|
{ |
101 |
1 |
assertTrue(so.isA("CDS", "CDS")); |
102 |
1 |
assertTrue(so.isA("CDS_predicted", "CDS")); |
103 |
1 |
assertTrue(so.isA("transposable_element_CDS", "CDS")); |
104 |
1 |
assertTrue(so.isA("edited_CDS", "CDS")); |
105 |
1 |
assertTrue(so.isA("CDS_independently_known", "CDS")); |
106 |
1 |
assertTrue(so.isA("CDS_fragment", "CDS")); |
107 |
1 |
assertFalse(so.isA("CDS_region", "CDS")); |
108 |
1 |
assertFalse(so.isA("polypeptide", "CDS")); |
109 |
|
} |
110 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
111 |
1 |
@Test(groups = "Functional")... |
112 |
|
public void testIsSequenceVariant() |
113 |
|
{ |
114 |
1 |
assertFalse(so.isA("CDS", "sequence_variant")); |
115 |
1 |
assertTrue(so.isA("sequence_variant", "sequence_variant")); |
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
1 |
assertTrue(so.isA("structural_variant", "sequence_variant")); |
121 |
1 |
assertTrue(so.isA("feature_variant", "sequence_variant")); |
122 |
1 |
assertTrue(so.isA("gene_variant", "sequence_variant")); |
123 |
1 |
assertTrue(so.isA("transcript_variant", "sequence_variant")); |
124 |
1 |
assertTrue(so.isA("NMD_transcript_variant", "sequence_variant")); |
125 |
1 |
assertTrue(so.isA("missense_variant", "sequence_variant")); |
126 |
1 |
assertTrue(so.isA("synonymous_variant", "sequence_variant")); |
127 |
1 |
assertTrue(so.isA("frameshift_variant", "sequence_variant")); |
128 |
1 |
assertTrue(so.isA("5_prime_UTR_variant", "sequence_variant")); |
129 |
1 |
assertTrue(so.isA("3_prime_UTR_variant", "sequence_variant")); |
130 |
1 |
assertTrue(so.isA("stop_gained", "sequence_variant")); |
131 |
1 |
assertTrue(so.isA("stop_lost", "sequence_variant")); |
132 |
1 |
assertTrue(so.isA("inframe_deletion", "sequence_variant")); |
133 |
1 |
assertTrue(so.isA("inframe_insertion", "sequence_variant")); |
134 |
|
} |
135 |
|
} |