1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.schemes; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
|
25 |
|
import java.awt.Color; |
26 |
|
|
27 |
|
import org.testng.annotations.Test; |
28 |
|
|
29 |
|
import jalview.datamodel.SequenceI; |
30 |
|
import jalview.gui.AlignFrame; |
31 |
|
import jalview.gui.AlignViewport; |
32 |
|
import jalview.io.DataSourceType; |
33 |
|
import jalview.io.FileLoader; |
34 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 4 |
Complexity Density: 0.15 |
|
35 |
|
public class PIDColourSchemeTest |
36 |
|
{ |
37 |
|
static final Color white = Color.white; |
38 |
|
|
39 |
|
static final Color over40 = new Color(204, 204, 255); |
40 |
|
|
41 |
|
static final Color over60 = new Color(153, 153, 255); |
42 |
|
|
43 |
|
static final Color over80 = new Color(100, 100, 255); |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
4-
|
|
58 |
0 |
@Test(groups = "Functional")... |
59 |
|
public void testFindColour() |
60 |
|
{ |
61 |
0 |
ColourSchemeI scheme = new PIDColourScheme(); |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
0 |
assertEquals(scheme.findColour('A', 0, null, "A", 0f), white); |
68 |
0 |
assertEquals(scheme.findColour('A', 0, null, "A", 40f), white); |
69 |
0 |
assertEquals(scheme.findColour('A', 0, null, "A", 40.1f), over40); |
70 |
0 |
assertEquals(scheme.findColour('A', 0, null, "A", 60f), over40); |
71 |
0 |
assertEquals(scheme.findColour('A', 0, null, "A", 60.1f), over60); |
72 |
0 |
assertEquals(scheme.findColour('A', 0, null, "A", 80f), over60); |
73 |
0 |
assertEquals(scheme.findColour('A', 0, null, "A", 80.1f), over80); |
74 |
0 |
assertEquals(scheme.findColour('A', 0, null, "A", 100f), over80); |
75 |
0 |
assertEquals(scheme.findColour('A', 0, null, "KFV", 100f), white); |
76 |
|
|
77 |
0 |
assertEquals(scheme.findColour('a', 0, null, "A", 80f), over60); |
78 |
0 |
assertEquals(scheme.findColour('A', 0, null, "AC", 80f), over60); |
79 |
0 |
assertEquals(scheme.findColour('A', 0, null, "KCA", 80f), over60); |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 3 |
Complexity Density: 0.21 |
4-
|
|
87 |
0 |
@Test(groups = "Functional")... |
88 |
|
public void testFindColour_ignoreGaps() |
89 |
|
{ |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
0 |
String seqs = ">seq1\nAAAAA\n>seq2\nAAAAA\n>seq3\n-CCCC\n>seq4\nFFFFF\n"; |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
0 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(seqs, |
105 |
|
DataSourceType.PASTE); |
106 |
0 |
AlignViewport viewport = af.getViewport(); |
107 |
0 |
viewport.setIgnoreGapsConsensus(false, af.alignPanel); |
108 |
0 |
do |
109 |
|
{ |
110 |
0 |
try |
111 |
|
{ |
112 |
0 |
Thread.sleep(50); |
113 |
|
} catch (InterruptedException x) |
114 |
|
{ |
115 |
|
} |
116 |
0 |
} while (af.getViewport().getCalcManager().isWorking()); |
117 |
0 |
af.changeColour_actionPerformed(JalviewColourScheme.PID.toString()); |
118 |
|
|
119 |
0 |
SequenceI seq = viewport.getAlignment().getSequenceAt(0); |
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
0 |
Color c = viewport.getResidueShading().findColour('A', 0, seq); |
125 |
0 |
assertEquals(c, over40); |
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
0 |
viewport.setIgnoreGapsConsensus(true, af.alignPanel); |
131 |
0 |
c = viewport.getResidueShading().findColour('A', 0, seq); |
132 |
0 |
assertEquals(c, over60); |
133 |
|
} |
134 |
|
} |