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.util.Comparator; |
24 |
|
import java.util.LinkedHashMap; |
25 |
|
import java.util.Map; |
26 |
|
import java.util.Map.Entry; |
27 |
|
import java.util.SortedMap; |
28 |
|
import java.util.TreeMap; |
29 |
|
import java.util.Vector; |
30 |
|
|
31 |
|
import jalview.datamodel.features.FeatureAttributeType; |
32 |
|
import jalview.datamodel.features.FeatureAttributes; |
33 |
|
import jalview.datamodel.features.FeatureLocationI; |
34 |
|
import jalview.datamodel.features.FeatureSourceI; |
35 |
|
import jalview.datamodel.features.FeatureSources; |
36 |
|
import jalview.util.StringUtils; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
|
|
| 87.8% |
Uncovered Elements: 34 (278) |
Complexity: 95 |
Complexity Density: 0.63 |
|
43 |
|
public class SequenceFeature implements FeatureLocationI |
44 |
|
{ |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
private static final float NO_SCORE = 0f; |
50 |
|
|
51 |
|
private static final String STATUS = "status"; |
52 |
|
|
53 |
|
public static final String STRAND = "STRAND"; |
54 |
|
|
55 |
|
|
56 |
|
public static final String PHASE = "!Phase"; |
57 |
|
|
58 |
|
|
59 |
|
private static final String LOCATION = "!Location"; |
60 |
|
|
61 |
|
private static final String ROW_DATA = "<tr><td>%s</td><td>%s</td><td>%s</td></tr>"; |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
public final String type; |
69 |
|
|
70 |
|
public final int begin; |
71 |
|
|
72 |
|
public final int end; |
73 |
|
|
74 |
|
public final String featureGroup; |
75 |
|
|
76 |
|
public final float score; |
77 |
|
|
78 |
|
private final boolean contactFeature; |
79 |
|
|
80 |
|
public String description; |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
public Map<String, Object> otherDetails; |
87 |
|
|
88 |
|
public Vector<String> links; |
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
private String source; |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
@param |
102 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
200 |
public SequenceFeature(SequenceFeature cpy)... |
104 |
|
{ |
105 |
200 |
this(cpy, cpy.getBegin(), cpy.getEnd(), cpy.getFeatureGroup(), |
106 |
|
cpy.getScore()); |
107 |
|
} |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
@param |
113 |
|
@param |
114 |
|
@param |
115 |
|
@param |
116 |
|
@param |
117 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
118 |
67655 |
public SequenceFeature(String theType, String theDesc, int theBegin,... |
119 |
|
int theEnd, String group) |
120 |
|
{ |
121 |
67655 |
this(theType, theDesc, theBegin, theEnd, NO_SCORE, group); |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
@param |
128 |
|
@param |
129 |
|
@param |
130 |
|
@param |
131 |
|
@param |
132 |
|
@param |
133 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
134 |
234293 |
public SequenceFeature(String theType, String theDesc, int theBegin,... |
135 |
|
int theEnd, float theScore, String group) |
136 |
|
{ |
137 |
234293 |
this.type = theType; |
138 |
234293 |
this.description = theDesc; |
139 |
234293 |
this.begin = theBegin; |
140 |
234293 |
this.end = theEnd; |
141 |
234293 |
this.featureGroup = group; |
142 |
234293 |
this.score = theScore; |
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
234293 |
this.contactFeature = "disulfide bond".equalsIgnoreCase(type) |
148 |
|
|| "disulphide bond".equalsIgnoreCase(type); |
149 |
|
} |
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
@param |
155 |
|
@param |
156 |
|
@param |
157 |
|
@param |
158 |
|
@param |
159 |
|
@param |
160 |
|
|
|
|
| 75% |
Uncovered Elements: 3 (12) |
Complexity: 4 |
Complexity Density: 0.5 |
|
161 |
30106 |
public SequenceFeature(SequenceFeature sf, String newType, int newBegin,... |
162 |
|
int newEnd, String newGroup, float newScore) |
163 |
|
{ |
164 |
30106 |
this(newType, sf.getDescription(), newBegin, newEnd, newScore, |
165 |
|
newGroup); |
166 |
|
|
167 |
30106 |
this.source = sf.source; |
168 |
|
|
169 |
30106 |
if (sf.otherDetails != null) |
170 |
|
{ |
171 |
5306 |
otherDetails = new LinkedHashMap<>(); |
172 |
5306 |
otherDetails.putAll(sf.otherDetails); |
173 |
|
} |
174 |
30106 |
if (sf.links != null && sf.links.size() > 0) |
175 |
|
{ |
176 |
0 |
links = new Vector<>(); |
177 |
0 |
links.addAll(sf.links); |
178 |
|
} |
179 |
|
} |
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
@param |
185 |
|
@param |
186 |
|
@param |
187 |
|
@param |
188 |
|
@param |
189 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
190 |
30105 |
public SequenceFeature(SequenceFeature sf, int newBegin, int newEnd,... |
191 |
|
String newGroup, float newScore) |
192 |
|
{ |
193 |
30105 |
this(sf, sf.getType(), newBegin, newEnd, newGroup, newScore); |
194 |
|
} |
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
205 |
97774 |
@Override... |
206 |
|
public boolean equals(Object o) |
207 |
|
{ |
208 |
97774 |
return equals(o, false); |
209 |
|
} |
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
@param |
218 |
|
@param |
219 |
|
@return |
220 |
|
|
|
|
| 97.2% |
Uncovered Elements: 1 (36) |
Complexity: 13 |
Complexity Density: 0.72 |
|
221 |
97774 |
public boolean equals(Object o, boolean ignoreParent)... |
222 |
|
{ |
223 |
97774 |
if (o == null || !(o instanceof SequenceFeature)) |
224 |
|
{ |
225 |
1 |
return false; |
226 |
|
} |
227 |
|
|
228 |
97773 |
SequenceFeature sf = (SequenceFeature) o; |
229 |
97773 |
boolean sameScore = Float.isNaN(score) ? Float.isNaN(sf.score) |
230 |
|
: score == sf.score; |
231 |
97773 |
if (begin != sf.begin || end != sf.end || !sameScore) |
232 |
|
{ |
233 |
12102 |
return false; |
234 |
|
} |
235 |
|
|
236 |
85671 |
if (getStrand() != sf.getStrand()) |
237 |
|
{ |
238 |
1 |
return false; |
239 |
|
} |
240 |
|
|
241 |
85670 |
if (!(type + description + featureGroup + getPhase()).equals( |
242 |
|
sf.type + sf.description + sf.featureGroup + sf.getPhase())) |
243 |
|
{ |
244 |
6633 |
return false; |
245 |
|
} |
246 |
79037 |
if (!equalAttribute(getValue("ID"), sf.getValue("ID"))) |
247 |
|
{ |
248 |
1 |
return false; |
249 |
|
} |
250 |
79036 |
if (!equalAttribute(getValue("Name"), sf.getValue("Name"))) |
251 |
|
{ |
252 |
1 |
return false; |
253 |
|
} |
254 |
79035 |
if (!ignoreParent) |
255 |
|
{ |
256 |
79035 |
if (!equalAttribute(getValue("Parent"), sf.getValue("Parent"))) |
257 |
|
{ |
258 |
11 |
return false; |
259 |
|
} |
260 |
|
} |
261 |
79024 |
return true; |
262 |
|
} |
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
|
@param |
268 |
|
@param |
269 |
|
@return |
270 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 4 |
Complexity Density: 0.8 |
|
271 |
237108 |
protected static boolean equalAttribute(Object att1, Object att2)... |
272 |
|
{ |
273 |
237108 |
if (att1 == null && att2 == null) |
274 |
|
{ |
275 |
236692 |
return true; |
276 |
|
} |
277 |
416 |
if (att1 != null) |
278 |
|
{ |
279 |
410 |
return att1.equals(att2); |
280 |
|
} |
281 |
6 |
return att2.equals(att1); |
282 |
|
} |
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
@return |
288 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
289 |
2888188 |
@Override... |
290 |
|
public int getBegin() |
291 |
|
{ |
292 |
2888183 |
return begin; |
293 |
|
} |
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
@return |
299 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
300 |
940520 |
@Override... |
301 |
|
public int getEnd() |
302 |
|
{ |
303 |
940520 |
return end; |
304 |
|
} |
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
|
309 |
|
@return |
310 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
311 |
576348 |
public String getType()... |
312 |
|
{ |
313 |
576346 |
return type; |
314 |
|
} |
315 |
|
|
316 |
|
|
317 |
|
|
318 |
|
|
319 |
|
@return |
320 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
321 |
45807 |
public String getDescription()... |
322 |
|
{ |
323 |
45807 |
return description; |
324 |
|
} |
325 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
326 |
342 |
public void setDescription(String desc)... |
327 |
|
{ |
328 |
342 |
description = desc; |
329 |
|
} |
330 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
331 |
218519 |
public String getFeatureGroup()... |
332 |
|
{ |
333 |
218519 |
return featureGroup; |
334 |
|
} |
335 |
|
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
@param |
340 |
|
|
|
|
| 75% |
Uncovered Elements: 2 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
341 |
6862 |
public void addLink(String labelLink)... |
342 |
|
{ |
343 |
6862 |
if (links == null) |
344 |
|
{ |
345 |
6862 |
links = new Vector<>(); |
346 |
|
} |
347 |
|
|
348 |
6862 |
if (!links.contains(labelLink)) |
349 |
|
{ |
350 |
6862 |
links.insertElementAt(labelLink, 0); |
351 |
|
} |
352 |
|
} |
353 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
354 |
178260 |
public float getScore()... |
355 |
|
{ |
356 |
178260 |
return score; |
357 |
|
} |
358 |
|
|
359 |
|
|
360 |
|
|
361 |
|
|
362 |
|
|
363 |
|
@param |
364 |
|
|
365 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
366 |
668592 |
public Object getValue(String key)... |
367 |
|
{ |
368 |
668592 |
if (otherDetails == null) |
369 |
|
{ |
370 |
53103 |
return null; |
371 |
|
} |
372 |
|
else |
373 |
|
{ |
374 |
615489 |
return otherDetails.get(key); |
375 |
|
} |
376 |
|
} |
377 |
|
|
378 |
|
|
379 |
|
|
380 |
|
|
381 |
|
|
382 |
|
|
383 |
|
|
384 |
|
|
385 |
|
@param |
386 |
|
@return |
387 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 5 |
Complexity Density: 0.83 |
|
388 |
117 |
public String getValueAsString(String... key)... |
389 |
|
{ |
390 |
117 |
if (otherDetails == null) |
391 |
|
{ |
392 |
10 |
return null; |
393 |
|
} |
394 |
107 |
Object value = otherDetails.get(key[0]); |
395 |
107 |
if (key.length > 1 && value instanceof Map<?, ?>) |
396 |
|
{ |
397 |
26 |
value = ((Map) value).get(key[1]); |
398 |
|
} |
399 |
107 |
return value == null ? null : value.toString(); |
400 |
|
} |
401 |
|
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
|
|
406 |
|
@param |
407 |
|
@param |
408 |
|
@return |
409 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
410 |
2 |
public Object getValue(String key, Object defaultValue)... |
411 |
|
{ |
412 |
2 |
Object value = getValue(key); |
413 |
2 |
return value == null ? defaultValue : value; |
414 |
|
} |
415 |
|
|
416 |
|
|
417 |
|
|
418 |
|
|
419 |
|
|
420 |
|
@param |
421 |
|
|
422 |
|
@param |
423 |
|
|
424 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
425 |
669110 |
public void setValue(String key, Object value)... |
426 |
|
{ |
427 |
669110 |
if (value != null) |
428 |
|
{ |
429 |
533170 |
if (otherDetails == null) |
430 |
|
{ |
431 |
|
|
432 |
|
|
433 |
|
|
434 |
151606 |
otherDetails = new LinkedHashMap<>(); |
435 |
|
} |
436 |
|
|
437 |
533170 |
otherDetails.put(key, value); |
438 |
533170 |
recordAttribute(key, value); |
439 |
|
} |
440 |
|
} |
441 |
|
|
442 |
|
|
443 |
|
|
444 |
|
|
445 |
|
|
446 |
|
|
447 |
|
@param |
448 |
|
@param |
449 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
450 |
533170 |
protected void recordAttribute(String key, Object value)... |
451 |
|
{ |
452 |
533170 |
String attDesc = null; |
453 |
533170 |
if (source != null) |
454 |
|
{ |
455 |
289 |
attDesc = FeatureSources.getInstance().getSource(source) |
456 |
|
.getAttributeName(key); |
457 |
|
} |
458 |
|
|
459 |
533170 |
FeatureAttributes.getInstance().addAttribute(this.type, attDesc, value, |
460 |
|
key); |
461 |
|
} |
462 |
|
|
463 |
|
|
464 |
|
|
465 |
|
|
466 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
467 |
157347 |
public void setStatus(String status)... |
468 |
|
{ |
469 |
157347 |
setValue(STATUS, status); |
470 |
|
} |
471 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
472 |
21404 |
public String getStatus()... |
473 |
|
{ |
474 |
21404 |
return (String) getValue(STATUS); |
475 |
|
} |
476 |
|
|
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
|
481 |
|
@return |
482 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
483 |
171384 |
public int getStrand()... |
484 |
|
{ |
485 |
171384 |
int strand = 0; |
486 |
171384 |
if (otherDetails != null) |
487 |
|
{ |
488 |
162915 |
Object str = otherDetails.get(STRAND); |
489 |
162915 |
if ("-".equals(str)) |
490 |
|
{ |
491 |
754 |
strand = -1; |
492 |
|
} |
493 |
162161 |
else if ("+".equals(str)) |
494 |
|
{ |
495 |
126591 |
strand = 1; |
496 |
|
} |
497 |
|
} |
498 |
171384 |
return strand; |
499 |
|
} |
500 |
|
|
501 |
|
|
502 |
|
|
503 |
|
|
504 |
|
@param |
505 |
|
|
506 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
507 |
77 |
public void setStrand(String strand)... |
508 |
|
{ |
509 |
77 |
setValue(STRAND, strand); |
510 |
|
} |
511 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
512 |
63 |
public void setPhase(String phase)... |
513 |
|
{ |
514 |
63 |
setValue(PHASE, phase); |
515 |
|
} |
516 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
517 |
171383 |
public String getPhase()... |
518 |
|
{ |
519 |
171383 |
return (String) getValue(PHASE); |
520 |
|
} |
521 |
|
|
522 |
|
|
523 |
|
|
524 |
|
|
525 |
|
@param |
526 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
527 |
32 |
public void setEnaLocation(String loc)... |
528 |
|
{ |
529 |
32 |
setValue(LOCATION, loc); |
530 |
|
} |
531 |
|
|
532 |
|
|
533 |
|
|
534 |
|
|
535 |
|
@param |
536 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
537 |
8 |
public String getEnaLocation()... |
538 |
|
{ |
539 |
8 |
return (String) getValue(LOCATION); |
540 |
|
} |
541 |
|
|
542 |
|
|
543 |
|
|
544 |
|
|
545 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
546 |
918 |
@Override... |
547 |
|
public String toString() |
548 |
|
{ |
549 |
918 |
return String.format("%d %d %s %s", getBegin(), getEnd(), getType(), |
550 |
|
getDescription()); |
551 |
|
} |
552 |
|
|
553 |
|
|
554 |
|
|
555 |
|
|
556 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
557 |
4 |
@Override... |
558 |
|
public int hashCode() |
559 |
|
{ |
560 |
4 |
String s = getType() + getDescription() + getFeatureGroup() |
561 |
|
+ getValue("ID") + getValue("Name") + getValue("Parent") |
562 |
|
+ getPhase(); |
563 |
4 |
return s.hashCode() + getBegin() + getEnd() + (int) getScore() |
564 |
|
+ getStrand(); |
565 |
|
} |
566 |
|
|
567 |
|
|
568 |
|
|
569 |
|
|
570 |
|
|
571 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
572 |
500051 |
@Override... |
573 |
|
public boolean isContactFeature() |
574 |
|
{ |
575 |
500052 |
return contactFeature; |
576 |
|
} |
577 |
|
|
578 |
|
|
579 |
|
|
580 |
|
|
581 |
|
@return |
582 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
583 |
751430 |
public boolean isNonPositional()... |
584 |
|
{ |
585 |
751430 |
return begin == 0 && end == 0; |
586 |
|
} |
587 |
|
|
588 |
|
|
589 |
|
|
590 |
|
|
591 |
|
|
592 |
|
|
593 |
|
|
594 |
|
@param |
595 |
|
@param |
596 |
|
|
597 |
|
@return |
598 |
|
|
|
|
| 83.1% |
Uncovered Elements: 13 (77) |
Complexity: 18 |
Complexity Density: 0.4 |
|
599 |
6 |
public String getDetailsReport(String seqName, MappedFeatures mf)... |
600 |
|
{ |
601 |
6 |
FeatureSourceI metadata = FeatureSources.getInstance() |
602 |
|
.getSource(source); |
603 |
|
|
604 |
6 |
StringBuilder sb = new StringBuilder(128); |
605 |
6 |
sb.append("<br>"); |
606 |
6 |
sb.append("<table>"); |
607 |
6 |
String name = mf == null ? seqName : mf.getLinkedSequenceName(); |
608 |
6 |
sb.append(String.format(ROW_DATA, "Location", name, begin == end ? begin |
609 |
4 |
: begin + (isContactFeature() ? ":" : "-") + end)); |
610 |
|
|
611 |
6 |
String consequence = ""; |
612 |
6 |
if (mf != null) |
613 |
|
{ |
614 |
2 |
int[] localRange = mf.getMappedPositions(begin, end); |
615 |
2 |
int from = localRange[0]; |
616 |
2 |
int to = localRange[localRange.length - 1]; |
617 |
2 |
String s = mf.isFromCds() ? "Peptide Location" : "Coding location"; |
618 |
2 |
sb.append(String.format(ROW_DATA, s, seqName, from == to ? from |
619 |
1 |
: from + (isContactFeature() ? ":" : "-") + to)); |
620 |
2 |
if (mf.isFromCds()) |
621 |
|
{ |
622 |
2 |
consequence = mf.findProteinVariants(this); |
623 |
|
} |
624 |
|
} |
625 |
6 |
sb.append(String.format(ROW_DATA, "Type", type, "")); |
626 |
6 |
String desc = StringUtils.stripHtmlTags(description); |
627 |
6 |
sb.append(String.format(ROW_DATA, "Description", desc, "")); |
628 |
6 |
if (!Float.isNaN(score) && score != 0f) |
629 |
|
{ |
630 |
1 |
sb.append(String.format(ROW_DATA, "Score", score, "")); |
631 |
|
} |
632 |
6 |
if (featureGroup != null) |
633 |
|
{ |
634 |
2 |
sb.append(String.format(ROW_DATA, "Group", featureGroup, "")); |
635 |
|
} |
636 |
|
|
637 |
6 |
if (!consequence.isEmpty()) |
638 |
|
{ |
639 |
1 |
sb.append(String.format(ROW_DATA, "Consequence", |
640 |
|
"<i>Translated by Jalview</i>", consequence)); |
641 |
|
} |
642 |
|
|
643 |
6 |
if (otherDetails != null) |
644 |
|
{ |
645 |
2 |
TreeMap<String, Object> ordered = new TreeMap<>( |
646 |
|
String.CASE_INSENSITIVE_ORDER); |
647 |
2 |
ordered.putAll(otherDetails); |
648 |
|
|
649 |
2 |
for (Entry<String, Object> entry : ordered.entrySet()) |
650 |
|
{ |
651 |
3 |
String key = entry.getKey(); |
652 |
|
|
653 |
3 |
Object value = entry.getValue(); |
654 |
3 |
if (value instanceof Map<?, ?>) |
655 |
|
{ |
656 |
|
|
657 |
|
|
658 |
|
|
659 |
|
|
660 |
0 |
Map<String, Object> values = (Map<String, Object>) value; |
661 |
0 |
SortedMap<String, Object> sm = new TreeMap<>( |
662 |
|
String.CASE_INSENSITIVE_ORDER); |
663 |
0 |
sm.putAll(values); |
664 |
0 |
for (Entry<?, ?> e : sm.entrySet()) |
665 |
|
{ |
666 |
0 |
sb.append(String.format(ROW_DATA, key, e.getKey().toString(), |
667 |
|
e.getValue().toString())); |
668 |
|
} |
669 |
|
} |
670 |
|
else |
671 |
|
{ |
672 |
|
|
673 |
3 |
String attDesc = null; |
674 |
3 |
if (metadata != null) |
675 |
|
{ |
676 |
0 |
attDesc = metadata.getAttributeName(key); |
677 |
|
} |
678 |
3 |
String s = entry.getValue().toString(); |
679 |
3 |
if (isValueInteresting(key, s, metadata)) |
680 |
|
{ |
681 |
3 |
sb.append(String.format(ROW_DATA, key, |
682 |
3 |
attDesc == null ? "" : attDesc, s)); |
683 |
|
} |
684 |
|
} |
685 |
|
} |
686 |
|
} |
687 |
6 |
sb.append("</table>"); |
688 |
|
|
689 |
6 |
String text = sb.toString(); |
690 |
6 |
return text; |
691 |
|
} |
692 |
|
|
693 |
|
|
694 |
|
|
695 |
|
|
696 |
|
|
697 |
|
@param |
698 |
|
@param |
699 |
|
@param |
700 |
|
@return |
701 |
|
|
|
|
| 26.3% |
Uncovered Elements: 14 (19) |
Complexity: 11 |
Complexity Density: 1 |
|
702 |
3 |
boolean isValueInteresting(String key, String value,... |
703 |
|
FeatureSourceI metadata) |
704 |
|
{ |
705 |
|
|
706 |
|
|
707 |
|
|
708 |
3 |
if (value == null || "".equals(value) || ".".equals(value) |
709 |
|
|| "0".equals(value)) |
710 |
|
{ |
711 |
0 |
return false; |
712 |
|
} |
713 |
|
|
714 |
3 |
if (metadata == null) |
715 |
|
{ |
716 |
3 |
return true; |
717 |
|
} |
718 |
|
|
719 |
0 |
FeatureAttributeType attType = metadata.getAttributeType(key); |
720 |
0 |
if (attType != null && (attType == FeatureAttributeType.Float |
721 |
|
|| attType.equals(FeatureAttributeType.Integer))) |
722 |
|
{ |
723 |
0 |
try |
724 |
|
{ |
725 |
0 |
float fval = Float.valueOf(value); |
726 |
0 |
if (fval == 0f) |
727 |
|
{ |
728 |
0 |
return false; |
729 |
|
} |
730 |
|
} catch (NumberFormatException e) |
731 |
|
{ |
732 |
|
|
733 |
|
} |
734 |
|
} |
735 |
|
|
736 |
0 |
return true; |
737 |
|
} |
738 |
|
|
739 |
|
|
740 |
|
|
741 |
|
|
742 |
|
@param |
743 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
744 |
51 |
public void setSource(String theSource)... |
745 |
|
{ |
746 |
51 |
source = theSource; |
747 |
|
} |
748 |
|
} |
749 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
750 |
|
class SFSortByEnd implements Comparator<SequenceFeature> |
751 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
752 |
32 |
@Override... |
753 |
|
public int compare(SequenceFeature a, SequenceFeature b) |
754 |
|
{ |
755 |
32 |
return a.getEnd() - b.getEnd(); |
756 |
|
} |
757 |
|
} |
758 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
759 |
|
class SFSortByBegin implements Comparator<SequenceFeature> |
760 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
761 |
0 |
@Override... |
762 |
|
public int compare(SequenceFeature a, SequenceFeature b) |
763 |
|
{ |
764 |
0 |
return a.getBegin() - b.getBegin(); |
765 |
|
} |
766 |
|
} |