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.AlignmentAnnotation; |
25 |
|
import jalview.datamodel.AnnotatedCollectionI; |
26 |
|
import jalview.util.ColorUtils; |
27 |
|
|
28 |
|
import java.awt.Color; |
29 |
|
import java.util.Hashtable; |
30 |
|
import java.util.Map; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@author |
36 |
|
@version |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 11 |
Complexity Density: 0.58 |
|
38 |
|
public class CovariationColourScheme extends ResidueColourScheme |
39 |
|
{ |
40 |
|
public Map<String, Color> helixcolorhash = new Hashtable<>(); |
41 |
|
|
42 |
|
public Map<Integer, String> positionsToHelix = new Hashtable<>(); |
43 |
|
|
44 |
|
int numHelix = 0; |
45 |
|
|
46 |
|
public AlignmentAnnotation annotation; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
0 |
@Override... |
53 |
|
public ColourSchemeI getInstance(AlignViewportI view, |
54 |
|
AnnotatedCollectionI coll) |
55 |
|
{ |
56 |
0 |
return new CovariationColourScheme(coll.getAlignmentAnnotation()[0]); |
57 |
|
} |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
62 |
0 |
public CovariationColourScheme(AlignmentAnnotation annotation)... |
63 |
|
{ |
64 |
0 |
this.annotation = annotation; |
65 |
|
|
66 |
0 |
for (int x = 0; x < this.annotation._rnasecstr.length; x++) |
67 |
|
{ |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
0 |
positionsToHelix.put(this.annotation._rnasecstr[x].getBegin(), |
76 |
|
this.annotation._rnasecstr[x].getFeatureGroup()); |
77 |
0 |
positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(), |
78 |
|
this.annotation._rnasecstr[x].getFeatureGroup()); |
79 |
|
|
80 |
0 |
if (Integer.parseInt( |
81 |
|
this.annotation._rnasecstr[x].getFeatureGroup()) > numHelix) |
82 |
|
{ |
83 |
0 |
numHelix = Integer |
84 |
|
.parseInt(this.annotation._rnasecstr[x].getFeatureGroup()); |
85 |
|
} |
86 |
|
|
87 |
|
} |
88 |
|
|
89 |
0 |
for (int j = 0; j <= numHelix; j++) |
90 |
|
{ |
91 |
0 |
helixcolorhash.put(String.valueOf(j), |
92 |
|
ColorUtils.generateRandomColor(Color.white)); |
93 |
|
} |
94 |
|
|
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
@param |
101 |
|
|
102 |
|
|
103 |
|
@return |
104 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
105 |
0 |
@Override... |
106 |
|
public Color findColour(char c) |
107 |
|
{ |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
0 |
return ResidueProperties.purinepyrimidine[ResidueProperties.purinepyrimidineIndex[c]]; |
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
@param |
118 |
|
|
119 |
|
@param |
120 |
|
|
121 |
|
|
122 |
|
@return |
123 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
124 |
0 |
public Color findColour(char c, int j)... |
125 |
|
{ |
126 |
0 |
Color currentColour = Color.white; |
127 |
0 |
String currentHelix = null; |
128 |
|
|
129 |
0 |
currentHelix = positionsToHelix.get(j); |
130 |
|
|
131 |
|
|
132 |
0 |
if (currentHelix != null) |
133 |
|
{ |
134 |
0 |
currentColour = helixcolorhash.get(currentHelix); |
135 |
|
} |
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
0 |
return currentColour; |
141 |
|
} |
142 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
143 |
0 |
@Override... |
144 |
|
public boolean isNucleotideSpecific() |
145 |
|
{ |
146 |
0 |
return true; |
147 |
|
} |
148 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
149 |
0 |
@Override... |
150 |
|
public String getSchemeName() |
151 |
|
{ |
152 |
0 |
return "Covariation"; |
153 |
|
} |
154 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
155 |
0 |
@Override... |
156 |
|
public boolean isSimple() |
157 |
|
{ |
158 |
0 |
return false; |
159 |
|
} |
160 |
|
} |