1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.datamodel; |
22 |
|
|
23 |
|
import java.awt.Color; |
24 |
|
import java.util.Arrays; |
25 |
|
import java.util.BitSet; |
26 |
|
import java.util.List; |
27 |
|
|
28 |
|
import jalview.util.ColorUtils; |
29 |
|
import jalview.ws.datamodel.MappableContactMatrixI; |
30 |
|
|
|
|
| 30.1% |
Uncovered Elements: 72 (103) |
Complexity: 35 |
Complexity Density: 0.7 |
|
31 |
|
public interface ContactMatrixI |
32 |
|
{ |
33 |
|
|
34 |
|
ContactListI getContactList(int column); |
35 |
|
|
36 |
|
float getMin(); |
37 |
|
|
38 |
|
float getMax(); |
39 |
|
|
40 |
|
String getAnnotDescr(); |
41 |
|
|
42 |
|
String getAnnotLabel(); |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@return |
49 |
|
|
50 |
|
String getType(); |
51 |
|
|
52 |
|
int getWidth(); |
53 |
|
|
54 |
|
int getHeight(); |
55 |
|
|
56 |
|
public GroupSetI getGroupSet(); |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
61 |
7055 |
default public boolean hasGroupSet()... |
62 |
|
{ |
63 |
7055 |
return getGroupSet() != null; |
64 |
|
} |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
5 |
default boolean hasGroups()... |
67 |
|
{ |
68 |
5 |
return hasGroupSet() && getGroupSet().hasGroups(); |
69 |
|
} |
70 |
|
|
|
|
| 42.9% |
Uncovered Elements: 4 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
71 |
3512 |
default BitSet getGroupsFor(int column)... |
72 |
|
{ |
73 |
3512 |
if (!hasGroupSet()) |
74 |
|
{ |
75 |
0 |
BitSet colbitset = new BitSet(); |
76 |
0 |
colbitset.set(column); |
77 |
0 |
return colbitset; |
78 |
|
} |
79 |
3512 |
return getGroupSet().getGroupsFor(column); |
80 |
|
} |
81 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
82 |
6 |
default List<BitSet> getGroups()... |
83 |
|
{ |
84 |
6 |
if (!hasGroupSet()) |
85 |
|
{ |
86 |
0 |
return Arrays.asList(); |
87 |
|
} |
88 |
6 |
return getGroupSet().getGroups(); |
89 |
|
} |
90 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
91 |
5 |
default boolean hasTree()... |
92 |
|
{ |
93 |
5 |
return hasGroupSet() ? getGroupSet().hasTree() : false; |
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
@return |
100 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
101 |
6 |
default String getNewick()... |
102 |
|
{ |
103 |
6 |
return hasGroupSet() ? getGroupSet().getNewick() : null; |
104 |
|
} |
105 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
106 |
3 |
default String getTreeMethod()... |
107 |
|
{ |
108 |
3 |
return hasGroupSet() ? getGroupSet().getTreeMethod() : null; |
109 |
|
} |
110 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
111 |
3 |
default boolean hasCutHeight()... |
112 |
|
{ |
113 |
3 |
return hasGroupSet() ? getGroupSet().hasCutHeight() : false; |
114 |
|
} |
115 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
116 |
3 |
default double getCutHeight()... |
117 |
|
{ |
118 |
3 |
return hasGroupSet() ? getGroupSet().getCutHeight() : 0; |
119 |
|
} |
120 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
121 |
0 |
default void updateGroups(List<BitSet> colGroups)... |
122 |
|
{ |
123 |
0 |
if (hasGroupSet()) |
124 |
|
{ |
125 |
0 |
getGroupSet().updateGroups(colGroups); |
126 |
|
} |
127 |
|
} |
128 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
129 |
0 |
default void setColorForGroup(BitSet bs, Color color)... |
130 |
|
{ |
131 |
0 |
if (hasGroupSet()) |
132 |
|
{ |
133 |
0 |
getGroupSet().setColorForGroup(bs, color); |
134 |
|
} |
135 |
|
} |
136 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
137 |
3512 |
default Color getColourForGroup(BitSet bs)... |
138 |
|
{ |
139 |
3512 |
if (hasGroupSet()) |
140 |
|
{ |
141 |
3512 |
return getGroupSet().getColourForGroup(bs); |
142 |
|
} |
143 |
|
else |
144 |
|
{ |
145 |
0 |
return Color.white; |
146 |
|
} |
147 |
|
} |
148 |
|
|
149 |
|
void setGroupSet(GroupSet makeGroups); |
150 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
151 |
0 |
default void randomlyReColourGroups()... |
152 |
|
{ |
153 |
0 |
if (hasGroupSet()) |
154 |
|
{ |
155 |
0 |
GroupSetI groups = getGroupSet(); |
156 |
0 |
for (BitSet group : groups.getGroups()) |
157 |
|
{ |
158 |
0 |
groups.setColorForGroup(group, ColorUtils.getARandomColor()); |
159 |
|
} |
160 |
|
} |
161 |
|
} |
162 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 8 |
Complexity Density: 0.44 |
|
163 |
0 |
default void transferGroupColorsTo(AlignmentAnnotation aa)... |
164 |
|
{ |
165 |
0 |
if (hasGroupSet()) |
166 |
|
{ |
167 |
0 |
GroupSetI groups = getGroupSet(); |
168 |
|
|
169 |
|
|
170 |
0 |
int sstart = aa.sequenceRef != null ? aa.sequenceRef.getStart() - 1 |
171 |
|
: 0; |
172 |
0 |
Annotation ae; |
173 |
0 |
Color gpcol = null; |
174 |
0 |
int[] seqpos = null; |
175 |
0 |
for (BitSet gp : groups.getGroups()) |
176 |
|
{ |
177 |
0 |
gpcol = groups.getColourForGroup(gp); |
178 |
0 |
for (int p = gp.nextSetBit(0); p >= 0 |
179 |
|
&& p < Integer.MAX_VALUE; p = gp.nextSetBit(p + 1)) |
180 |
|
{ |
181 |
0 |
if (this instanceof MappableContactMatrixI) |
182 |
|
{ |
183 |
0 |
MappableContactMatrixI mcm = (MappableContactMatrixI) this; |
184 |
0 |
seqpos = mcm.getMappedPositionsFor(aa.sequenceRef, p); |
185 |
0 |
if (seqpos == null) |
186 |
|
{ |
187 |
|
|
188 |
0 |
continue; |
189 |
|
} |
190 |
|
|
191 |
0 |
ae = aa.getAnnotationForPosition(seqpos[0]); |
192 |
|
} |
193 |
|
else |
194 |
|
{ |
195 |
0 |
ae = aa.getAnnotationForPosition(p + sstart); |
196 |
|
} |
197 |
0 |
if (ae != null) |
198 |
|
{ |
199 |
0 |
ae.colour = gpcol.brighter().darker(); |
200 |
|
} |
201 |
|
} |
202 |
|
} |
203 |
|
} |
204 |
|
} |
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
|
209 |
|
@return |
210 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
211 |
0 |
default Color getGroupColorForPosition(int column)... |
212 |
|
{ |
213 |
0 |
if (hasGroupSet()) |
214 |
|
{ |
215 |
0 |
GroupSetI groups = getGroupSet(); |
216 |
0 |
for (BitSet gp : groups.getGroups()) |
217 |
|
{ |
218 |
0 |
if (gp.get(column)) |
219 |
|
{ |
220 |
0 |
return groups.getColourForGroup(gp); |
221 |
|
} |
222 |
|
} |
223 |
|
} |
224 |
0 |
return Color.white; |
225 |
|
} |
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
|
230 |
|
|
231 |
|
|
232 |
|
|
233 |
|
@param |
234 |
|
@param |
235 |
|
@return |
236 |
|
|
237 |
|
double getElementAt(int column, int row); |
238 |
|
|
239 |
|
} |