1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.renderer; |
22 |
|
|
23 |
|
import jalview.datamodel.SequenceGroup; |
24 |
|
import jalview.datamodel.SequenceI; |
25 |
|
import jalview.renderer.seqfeatures.FeatureColourFinder; |
26 |
|
|
27 |
|
import java.awt.Color; |
28 |
|
|
|
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 14 |
Complexity Density: 0.67 |
|
29 |
|
public class ResidueColourFinder |
30 |
|
{ |
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
31 |
0 |
public ResidueColourFinder()... |
32 |
|
{ |
33 |
|
} |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
@param |
39 |
|
|
40 |
|
@param |
41 |
|
|
42 |
|
@param |
43 |
|
|
44 |
|
@param |
45 |
|
|
46 |
|
@param |
47 |
|
|
48 |
|
@param |
49 |
|
|
50 |
|
@return |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
52 |
0 |
public Color getResidueColour(boolean showBoxes, ResidueShaderI shader,... |
53 |
|
SequenceGroup[] allGroups, final SequenceI seq, int position, |
54 |
|
FeatureColourFinder finder) |
55 |
|
{ |
56 |
0 |
Color col = getResidueBoxColour(showBoxes, shader, allGroups, seq, |
57 |
|
position); |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
0 |
if (finder != null) |
62 |
|
{ |
63 |
0 |
col = finder.findFeatureColour(col, seq, position); |
64 |
|
} |
65 |
0 |
return col; |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
@param |
72 |
|
|
73 |
|
@param |
74 |
|
|
75 |
|
@param |
76 |
|
|
77 |
|
@param |
78 |
|
|
79 |
|
@param |
80 |
|
|
81 |
|
@return |
82 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
83 |
0 |
protected Color getResidueBoxColour(boolean showBoxes,... |
84 |
|
ResidueShaderI shader, SequenceGroup[] allGroups, SequenceI seq, |
85 |
|
int i) |
86 |
|
{ |
87 |
0 |
SequenceGroup currentSequenceGroup = getCurrentSequenceGroup(allGroups, |
88 |
|
i); |
89 |
0 |
if (currentSequenceGroup != null) |
90 |
|
{ |
91 |
0 |
if (currentSequenceGroup.getDisplayBoxes()) |
92 |
|
{ |
93 |
0 |
return getBoxColour(currentSequenceGroup.getGroupColourScheme(), |
94 |
|
seq, i); |
95 |
|
} |
96 |
|
} |
97 |
0 |
else if (showBoxes) |
98 |
|
{ |
99 |
0 |
return getBoxColour(shader, seq, i); |
100 |
|
} |
101 |
|
|
102 |
0 |
return Color.white; |
103 |
|
} |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
@param |
110 |
|
|
111 |
|
@param |
112 |
|
|
113 |
|
@return |
114 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 5 |
Complexity Density: 0.83 |
|
115 |
0 |
public SequenceGroup getCurrentSequenceGroup(SequenceGroup[] allGroups,... |
116 |
|
int res) |
117 |
|
{ |
118 |
0 |
if (allGroups == null) |
119 |
|
{ |
120 |
0 |
return null; |
121 |
|
} |
122 |
|
|
123 |
0 |
for (int i = 0; i < allGroups.length; i++) |
124 |
|
{ |
125 |
0 |
if ((allGroups[i].getStartRes() <= res) |
126 |
|
&& (allGroups[i].getEndRes() >= res)) |
127 |
|
{ |
128 |
0 |
return (allGroups[i]); |
129 |
|
} |
130 |
|
} |
131 |
|
|
132 |
0 |
return null; |
133 |
|
} |
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
@param |
139 |
|
|
140 |
|
@param |
141 |
|
|
142 |
|
@param |
143 |
|
|
144 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
145 |
0 |
public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i)... |
146 |
|
{ |
147 |
0 |
Color resBoxColour = Color.white; |
148 |
0 |
if (shader.getColourScheme() != null) |
149 |
|
{ |
150 |
0 |
resBoxColour = shader.findColour(seq.getCharAt(i), i, seq); |
151 |
|
} |
152 |
0 |
return resBoxColour; |
153 |
|
} |
154 |
|
|
155 |
|
} |