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.Collection; |
24 |
|
import java.util.Collections; |
25 |
|
import java.util.HashMap; |
26 |
|
import java.util.HashSet; |
27 |
|
import java.util.Map; |
28 |
|
|
29 |
|
import jalview.ws.datamodel.MappableContactMatrixI; |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 52 (52) |
Complexity: 16 |
Complexity Density: 0.52 |
|
31 |
|
public class ContactMapHolder implements ContactMapHolderI |
32 |
|
{ |
33 |
|
|
34 |
|
Map<Object, ContactMatrixI> contactmaps = new HashMap<>(); |
35 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
36 |
0 |
@Override... |
37 |
|
public Collection<ContactMatrixI> getContactMaps() |
38 |
|
{ |
39 |
0 |
if (contactmaps != null && contactmaps.size() > 0) |
40 |
|
{ |
41 |
|
|
42 |
|
|
43 |
0 |
return new HashSet<ContactMatrixI>(contactmaps.values()); |
44 |
|
} |
45 |
0 |
return Collections.EMPTY_LIST; |
46 |
|
} |
47 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
48 |
0 |
@Override... |
49 |
|
public ContactListI getContactListFor(AlignmentAnnotation _aa, int column) |
50 |
|
{ |
51 |
0 |
ContactMatrixI cm = contactmaps.get(_aa.annotationId); |
52 |
0 |
if (cm == null) |
53 |
|
{ |
54 |
0 |
return null; |
55 |
|
} |
56 |
0 |
if (cm instanceof MappableContactMatrixI) |
57 |
|
{ |
58 |
0 |
if (_aa.sequenceRef != null) |
59 |
|
{ |
60 |
0 |
return ((MappableContactMatrixI) cm) |
61 |
|
.getMappableContactList(_aa.sequenceRef, column); |
62 |
|
} |
63 |
|
} |
64 |
|
|
65 |
|
|
66 |
|
|
67 |
0 |
return cm.getContactList(column); |
68 |
|
} |
69 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
70 |
0 |
@Override... |
71 |
|
public AlignmentAnnotation addContactList(ContactMatrixI cm) |
72 |
|
{ |
73 |
|
|
74 |
0 |
AlignmentAnnotation aa = new AlignmentAnnotation(cm.getAnnotLabel(), |
75 |
|
cm.getAnnotDescr(), new Annotation[0]); |
76 |
0 |
aa.graph = AlignmentAnnotation.CONTACT_MAP; |
77 |
0 |
aa.graphMin = cm.getMin(); |
78 |
0 |
aa.graphMax = cm.getMax(); |
79 |
0 |
aa.editable = false; |
80 |
0 |
aa.calcId = cm.getType(); |
81 |
|
|
82 |
0 |
contactmaps.put(aa.annotationId, cm); |
83 |
|
|
84 |
|
|
85 |
0 |
if (cm instanceof MappableContactMatrixI) |
86 |
|
{ |
87 |
0 |
aa.setSequenceRef(((MappableContactMatrixI) cm).getReferenceSeq()); |
88 |
|
} |
89 |
0 |
return aa; |
90 |
|
} |
91 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
92 |
0 |
@Override... |
93 |
|
public ContactMatrixI getContactMatrixFor(AlignmentAnnotation ann) |
94 |
|
{ |
95 |
0 |
return contactmaps == null ? null : contactmaps.get(ann.annotationId); |
96 |
|
} |
97 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 5 |
Complexity Density: 0.5 |
|
98 |
0 |
@Override... |
99 |
|
public void addContactListFor(AlignmentAnnotation annotation, |
100 |
|
ContactMatrixI cm) |
101 |
|
{ |
102 |
|
|
103 |
0 |
annotation.graphMin = cm.getMin(); |
104 |
0 |
annotation.graphMax = cm.getMax(); |
105 |
0 |
annotation.editable = false; |
106 |
0 |
annotation.graph = AlignmentAnnotation.CONTACT_MAP; |
107 |
0 |
annotation.calcId = cm.getType(); |
108 |
0 |
if (annotation.label == null || "".equals(annotation.label)) |
109 |
|
{ |
110 |
0 |
annotation.label = cm.getAnnotLabel(); |
111 |
|
|
112 |
|
} |
113 |
0 |
if (annotation.description == null || "".equals(annotation.description)) |
114 |
|
{ |
115 |
0 |
annotation.description = cm.getAnnotDescr(); |
116 |
|
} |
117 |
0 |
contactmaps.put(annotation.annotationId, cm); |
118 |
|
} |
119 |
|
} |