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 jalview.api.AlignViewportI; |
24 |
|
import jalview.datamodel.AnnotatedCollectionI; |
25 |
|
import jalview.datamodel.SequenceGroup; |
26 |
|
import jalview.datamodel.SequenceI; |
27 |
|
import jalview.util.Comparison; |
28 |
|
|
29 |
|
import java.awt.Color; |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 12 |
Complexity Density: 0.8 |
|
31 |
|
public class PIDColourScheme extends ResidueColourScheme |
32 |
|
{ |
33 |
|
private static final Color[] pidColours = { new Color(100, 100, 255), |
34 |
|
new Color(153, 153, 255), new Color(204, 204, 255), }; |
35 |
|
|
36 |
|
private static final float[] thresholds = { 80, 60, 40, }; |
37 |
|
|
38 |
|
SequenceGroup group; |
39 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
40 |
0 |
public PIDColourScheme()... |
41 |
|
{ |
42 |
|
} |
43 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 8 |
Complexity Density: 0.67 |
|
44 |
0 |
@Override... |
45 |
|
public Color findColour(char c, int j, SequenceI seq, |
46 |
|
String consensusResidue, float pid) |
47 |
|
{ |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
0 |
if ('a' <= c && c <= 'z') |
53 |
|
{ |
54 |
0 |
c -= ('a' - 'A'); |
55 |
|
} |
56 |
|
|
57 |
0 |
if (consensusResidue == null || Comparison.isGap(c)) |
58 |
|
{ |
59 |
0 |
return Color.white; |
60 |
|
} |
61 |
|
|
62 |
0 |
Color colour = Color.white; |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
0 |
boolean matchesConsensus = consensusResidue.contains(String.valueOf(c)); |
68 |
0 |
if (matchesConsensus) |
69 |
|
{ |
70 |
0 |
for (int i = 0; i < thresholds.length; i++) |
71 |
|
{ |
72 |
0 |
if (pid > thresholds[i]) |
73 |
|
{ |
74 |
0 |
colour = pidColours[i]; |
75 |
0 |
break; |
76 |
|
} |
77 |
|
} |
78 |
|
} |
79 |
|
|
80 |
0 |
return colour; |
81 |
|
} |
82 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
83 |
0 |
@Override... |
84 |
|
public String getSchemeName() |
85 |
|
{ |
86 |
0 |
return JalviewColourScheme.PID.toString(); |
87 |
|
} |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
93 |
0 |
@Override... |
94 |
|
public ColourSchemeI getInstance(AlignViewportI view, |
95 |
|
AnnotatedCollectionI coll) |
96 |
|
{ |
97 |
0 |
return new PIDColourScheme(); |
98 |
|
} |
99 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
0 |
@Override... |
101 |
|
public boolean isSimple() |
102 |
|
{ |
103 |
0 |
return false; |
104 |
|
} |
105 |
|
} |