1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
package ext.edu.ucsf.rbvi.strucviz2; |
34 |
|
|
35 |
|
import java.util.ArrayList; |
36 |
|
import java.util.Collection; |
37 |
|
import java.util.List; |
38 |
|
import java.util.TreeMap; |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
@author |
44 |
|
|
45 |
|
|
46 |
|
|
|
|
| 0% |
Uncovered Elements: 102 (102) |
Complexity: 34 |
Complexity Density: 0.6 |
|
47 |
|
public class ChimeraChain implements ChimeraStructuralObject |
48 |
|
{ |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
private int modelNumber; |
54 |
|
|
55 |
|
private int subModelNumber; |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
private ChimeraModel chimeraModel; |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
private String chainId; |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
private TreeMap<String, ChimeraResidue> residueMap; |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
private Object userData; |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
private boolean selected = false; |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
@param |
86 |
|
|
87 |
|
@param |
88 |
|
|
89 |
|
@param |
90 |
|
|
91 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
92 |
0 |
public ChimeraChain(int model, int subModel, String chainId)... |
93 |
|
{ |
94 |
0 |
this.modelNumber = model; |
95 |
0 |
this.subModelNumber = subModel; |
96 |
0 |
this.chainId = chainId; |
97 |
0 |
residueMap = new TreeMap<String, ChimeraResidue>(); |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
@param |
104 |
|
|
105 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
0 |
public void setSelected(boolean selected)... |
107 |
|
{ |
108 |
0 |
this.selected = selected; |
109 |
|
} |
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
@return |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
0 |
public boolean isSelected()... |
117 |
|
{ |
118 |
0 |
return selected; |
119 |
|
} |
120 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
121 |
0 |
public boolean hasSelectedChildren()... |
122 |
|
{ |
123 |
0 |
if (selected) |
124 |
|
{ |
125 |
0 |
return true; |
126 |
|
} |
127 |
|
else |
128 |
|
{ |
129 |
0 |
for (ChimeraResidue residue : getResidues()) |
130 |
|
{ |
131 |
0 |
if (residue.isSelected()) |
132 |
0 |
return true; |
133 |
|
} |
134 |
|
} |
135 |
0 |
return false; |
136 |
|
} |
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
@return |
142 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
143 |
0 |
public List<ChimeraResidue> getSelectedResidues()... |
144 |
|
{ |
145 |
0 |
List<ChimeraResidue> residueList = new ArrayList<ChimeraResidue>(); |
146 |
0 |
if (selected) |
147 |
|
{ |
148 |
0 |
residueList.addAll(getResidues()); |
149 |
|
} |
150 |
|
else |
151 |
|
{ |
152 |
0 |
for (ChimeraResidue residue : getResidues()) |
153 |
|
{ |
154 |
0 |
if (residue.isSelected()) |
155 |
0 |
residueList.add(residue); |
156 |
|
} |
157 |
|
} |
158 |
0 |
return residueList; |
159 |
|
} |
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
@param |
165 |
|
|
166 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
167 |
0 |
public void addResidue(ChimeraResidue residue)... |
168 |
|
{ |
169 |
0 |
String index = residue.getIndex(); |
170 |
|
|
171 |
0 |
residueMap.put(index, residue); |
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
@return |
178 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
179 |
0 |
public Collection<ChimeraResidue> getResidues()... |
180 |
|
{ |
181 |
0 |
return residueMap.values(); |
182 |
|
} |
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
187 |
|
@return |
188 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
189 |
0 |
public List<ChimeraStructuralObject> getChildren()... |
190 |
|
{ |
191 |
0 |
return new ArrayList<ChimeraStructuralObject>(residueMap.values()); |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
@param |
198 |
|
|
199 |
|
@return |
200 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
201 |
0 |
public ChimeraResidue getResidue(String index)... |
202 |
|
{ |
203 |
|
|
204 |
0 |
if (residueMap.containsKey(index)) |
205 |
0 |
return residueMap.get(index); |
206 |
0 |
return null; |
207 |
|
} |
208 |
|
|
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
@param |
213 |
|
|
214 |
|
@return |
215 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 5 |
Complexity Density: 0.45 |
|
216 |
0 |
public List<ChimeraResidue> getResidueRange(String residueRange)... |
217 |
|
{ |
218 |
0 |
String[] range = residueRange.split("-", 2); |
219 |
0 |
if (range[1] == null || range[1].length() == 0) |
220 |
|
{ |
221 |
0 |
range[1] = range[0]; |
222 |
|
} |
223 |
0 |
List<ChimeraResidue> resultRange = new ArrayList<ChimeraResidue>(); |
224 |
0 |
int start = Integer.parseInt(range[0]); |
225 |
0 |
int end = Integer.parseInt(range[1]); |
226 |
0 |
for (int i = start; i <= end; i++) |
227 |
|
{ |
228 |
0 |
String index = String.valueOf(i); |
229 |
0 |
if (residueMap.containsKey(index)) |
230 |
0 |
resultRange.add(residueMap.get(index)); |
231 |
|
} |
232 |
0 |
return resultRange; |
233 |
|
} |
234 |
|
|
235 |
|
|
236 |
|
|
237 |
|
|
238 |
|
@return |
239 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
240 |
0 |
public String getChainId()... |
241 |
|
{ |
242 |
0 |
return chainId; |
243 |
|
} |
244 |
|
|
245 |
|
|
246 |
|
|
247 |
|
|
248 |
|
@return |
249 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
250 |
0 |
public int getModelNumber()... |
251 |
|
{ |
252 |
0 |
return modelNumber; |
253 |
|
} |
254 |
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
@return |
259 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
260 |
0 |
public int getSubModelNumber()... |
261 |
|
{ |
262 |
0 |
return subModelNumber; |
263 |
|
} |
264 |
|
|
265 |
|
|
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
@return |
270 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
271 |
0 |
public String displayName()... |
272 |
|
{ |
273 |
0 |
if (chainId.equals("_")) |
274 |
|
{ |
275 |
0 |
return ("Chain (no ID) (" + getResidueCount() + " residues)"); |
276 |
|
} |
277 |
|
else |
278 |
|
{ |
279 |
0 |
return ("Chain " + chainId + " (" + getResidueCount() + " residues)"); |
280 |
|
} |
281 |
|
} |
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
@return |
288 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
289 |
0 |
public String toString()... |
290 |
|
{ |
291 |
0 |
String displayName = chimeraModel.getModelName(); |
292 |
0 |
if (displayName.length() > 14) |
293 |
0 |
displayName = displayName.substring(0, 13) + "..."; |
294 |
0 |
if (chainId.equals("_")) |
295 |
|
{ |
296 |
0 |
return (displayName + " Chain (no ID) (" + getResidueCount() |
297 |
|
+ " residues)"); |
298 |
|
} |
299 |
|
else |
300 |
|
{ |
301 |
0 |
return (displayName + " Chain " + chainId + " (" + getResidueCount() |
302 |
|
+ " residues)"); |
303 |
|
} |
304 |
|
} |
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
|
309 |
|
@return |
310 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
311 |
0 |
public String toSpec()... |
312 |
|
{ |
313 |
0 |
if (chainId.equals("_")) |
314 |
|
{ |
315 |
0 |
return ("#" + modelNumber + "." + subModelNumber + ":."); |
316 |
|
} |
317 |
|
else |
318 |
|
{ |
319 |
0 |
return ("#" + modelNumber + "." + subModelNumber + ":." + chainId); |
320 |
|
} |
321 |
|
} |
322 |
|
|
323 |
|
|
324 |
|
|
325 |
|
|
326 |
|
@return |
327 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
328 |
0 |
public int getResidueCount()... |
329 |
|
{ |
330 |
0 |
return residueMap.size(); |
331 |
|
} |
332 |
|
|
333 |
|
|
334 |
|
|
335 |
|
|
336 |
|
@param |
337 |
|
|
338 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
339 |
0 |
public void setChimeraModel(ChimeraModel model)... |
340 |
|
{ |
341 |
0 |
this.chimeraModel = model; |
342 |
|
} |
343 |
|
|
344 |
|
|
345 |
|
|
346 |
|
|
347 |
|
@return |
348 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
349 |
0 |
public ChimeraModel getChimeraModel()... |
350 |
|
{ |
351 |
0 |
return chimeraModel; |
352 |
|
} |
353 |
|
|
354 |
|
|
355 |
|
|
356 |
|
|
357 |
|
@return |
358 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
359 |
0 |
public Object getUserData()... |
360 |
|
{ |
361 |
0 |
return userData; |
362 |
|
} |
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
|
367 |
|
@param |
368 |
|
|
369 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
370 |
0 |
public void setUserData(Object data)... |
371 |
|
{ |
372 |
0 |
this.userData = data; |
373 |
|
} |
374 |
|
} |