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 jalview.datamodel.AlignmentI; |
26 |
|
import jalview.gui.AlignFrame; |
27 |
|
import jalview.io.DataSourceType; |
28 |
|
import jalview.io.FileLoader; |
29 |
|
|
30 |
|
import java.awt.Color; |
31 |
|
|
32 |
|
import org.testng.annotations.Test; |
33 |
|
|
|
|
| 88.2% |
Uncovered Elements: 4 (34) |
Complexity: 3 |
Complexity Density: 0.1 |
|
34 |
|
public class ClustalxColourSchemeTest |
35 |
|
{ |
36 |
|
|
37 |
|
private static final String FASTA = |
38 |
|
">seq1\nAAANNNRQ\n" + |
39 |
|
">seq2\nAAANNNRQ\n" + |
40 |
|
">seq3\nAAANNNRQ\n" + |
41 |
|
">seq4\nAAANNNRQ\n" + |
42 |
|
">seq5\nAAANYYKQ\n" + |
43 |
|
">seq6\nAAANYYKQ\n" + |
44 |
|
">seq7\nAVKWYYKQ\n" + |
45 |
|
">seq8\nKKKWYYQQ\n" + |
46 |
|
">seq9\nKKKWWYQQ\n" + |
47 |
|
">seq0\nKKKWWWQW\n"; |
48 |
|
|
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
50 |
1 |
@Test(groups = "Functional")... |
51 |
|
public void testFindColour() |
52 |
|
{ |
53 |
1 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(FASTA, |
54 |
|
DataSourceType.PASTE); |
55 |
1 |
AlignmentI al = af.getViewport().getAlignment(); |
56 |
1 |
ClustalxColourScheme cs = new ClustalxColourScheme(al, null); |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
1 |
Color clustalBlue = new Color(0.5f, 0.7f, 0.9f); |
62 |
1 |
assertEquals(cs.findColour('A', 0, al.getSequenceAt(0)), clustalBlue); |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
1 |
assertEquals(cs.findColour('A', 0, al.getSequenceAt(1)), clustalBlue); |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
1 |
assertEquals(cs.findColour('A', 2, al.getSequenceAt(1)), Color.white); |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
1 |
Color clustalGreen = new Color(0.1f, 0.8f, 0.1f); |
79 |
1 |
assertEquals(cs.findColour('N', 3, al.getSequenceAt(1)), clustalGreen); |
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
1 |
assertEquals(cs.findColour('N', 4, al.getSequenceAt(1)), Color.white); |
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
1 |
assertEquals(cs.findColour('N', 5, al.getSequenceAt(1)), Color.white); |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
1 |
Color clustalRed = new Color(0.9f, 0.2f, 0.1f); |
97 |
1 |
assertEquals(cs.findColour('R', 6, al.getSequenceAt(1)), clustalRed); |
98 |
1 |
assertEquals(cs.findColour('K', 6, al.getSequenceAt(7)), clustalRed); |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
1 |
assertEquals(cs.findColour('R', 7, al.getSequenceAt(1)), clustalRed); |
104 |
1 |
assertEquals(cs.findColour('K', 7, al.getSequenceAt(1)), clustalRed); |
105 |
|
|
106 |
|
|
107 |
|
} |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
115 |
1 |
@Test(groups = "Functional")... |
116 |
|
public void testFindColour_ignoreGaps() |
117 |
|
{ |
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
1 |
String fasta = ">seq1\nCCC\n>seq2\nccc\n>seq3\n-CC\n"; |
126 |
1 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(fasta, |
127 |
|
DataSourceType.PASTE); |
128 |
1 |
AlignmentI al = af.getViewport().getAlignment(); |
129 |
1 |
ClustalxColourScheme cs = new ClustalxColourScheme(al, null); |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
1 |
Color clustalBlue = ClustalxColourScheme.ClustalColour.BLUE.colour; |
135 |
1 |
assertEquals(cs.findColour('C', 0, al.getSequenceAt(0)), clustalBlue); |
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
1 |
cs.setIncludeGaps(false); |
141 |
1 |
Color clustalPink = ClustalxColourScheme.ClustalColour.PINK.colour; |
142 |
1 |
assertEquals(cs.findColour('C', 0, al.getSequenceAt(0)), clustalPink); |
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
1 |
cs.setIncludeGaps(true); |
148 |
1 |
assertEquals(cs.findColour('C', 0, al.getSequenceAt(0)), clustalBlue); |
149 |
1 |
af.getViewport().setIgnoreGapsConsensus(true, af.alignPanel); |
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
} |
154 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
155 |
0 |
@Test... |
156 |
|
public void testDocString() |
157 |
|
{ |
158 |
|
|
159 |
0 |
ClustalxColourScheme x = new ClustalxColourScheme(); |
160 |
0 |
String out = x.toRuleRep(); |
161 |
0 |
System.out.print(out); |
162 |
|
} |
163 |
|
} |