1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.structures.models; |
22 |
|
|
23 |
|
import java.awt.Color; |
24 |
|
import java.io.File; |
25 |
|
import java.io.IOException; |
26 |
|
import java.util.ArrayList; |
27 |
|
import java.util.Arrays; |
28 |
|
import java.util.BitSet; |
29 |
|
import java.util.HashMap; |
30 |
|
import java.util.LinkedHashMap; |
31 |
|
import java.util.List; |
32 |
|
import java.util.Map; |
33 |
|
|
34 |
|
import javax.swing.SwingUtilities; |
35 |
|
|
36 |
|
import jalview.api.AlignViewportI; |
37 |
|
import jalview.api.AlignmentViewPanel; |
38 |
|
import jalview.api.FeatureRenderer; |
39 |
|
import jalview.api.SequenceRenderer; |
40 |
|
import jalview.api.StructureSelectionManagerProvider; |
41 |
|
import jalview.api.structures.JalviewStructureDisplayI; |
42 |
|
import jalview.bin.Cache; |
43 |
|
import jalview.datamodel.AlignmentI; |
44 |
|
import jalview.datamodel.HiddenColumns; |
45 |
|
import jalview.datamodel.MappedFeatures; |
46 |
|
import jalview.datamodel.PDBEntry; |
47 |
|
import jalview.datamodel.SequenceFeature; |
48 |
|
import jalview.datamodel.SequenceI; |
49 |
|
import jalview.ext.rbvi.chimera.JalviewChimeraBinding; |
50 |
|
import jalview.gui.AlignmentPanel; |
51 |
|
import jalview.gui.Desktop; |
52 |
|
import jalview.gui.StructureViewer.ViewerType; |
53 |
|
import jalview.io.DataSourceType; |
54 |
|
import jalview.io.StructureFile; |
55 |
|
import jalview.renderer.seqfeatures.FeatureColourFinder; |
56 |
|
import jalview.schemes.ColourSchemeI; |
57 |
|
import jalview.schemes.ResidueProperties; |
58 |
|
import jalview.structure.AtomSpec; |
59 |
|
import jalview.structure.AtomSpecModel; |
60 |
|
import jalview.structure.StructureCommandI; |
61 |
|
import jalview.structure.StructureCommandsI; |
62 |
|
import jalview.structure.StructureListener; |
63 |
|
import jalview.structure.StructureMapping; |
64 |
|
import jalview.structure.StructureSelectionManager; |
65 |
|
import jalview.util.Comparison; |
66 |
|
import jalview.util.MessageManager; |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
@author |
75 |
|
|
76 |
|
|
|
|
| 58.3% |
Uncovered Elements: 341 (818) |
Complexity: 240 |
Complexity Density: 0.49 |
|
77 |
|
public abstract class AAStructureBindingModel |
78 |
|
extends SequenceStructureBindingModel |
79 |
|
implements StructureListener, StructureSelectionManagerProvider |
80 |
|
{ |
81 |
|
|
82 |
|
|
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.5 |
|
84 |
|
public static class SuperposeData |
85 |
|
{ |
86 |
|
public String filename; |
87 |
|
|
88 |
|
public String pdbId; |
89 |
|
|
90 |
|
public String chain = ""; |
91 |
|
|
92 |
|
public boolean isRna; |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
public int[] pdbResNo; |
98 |
|
|
99 |
|
public String modelId; |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
@param |
105 |
|
|
106 |
|
|
107 |
|
@param |
108 |
|
|
109 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
110 |
9 |
public SuperposeData(int width, String model)... |
111 |
|
{ |
112 |
9 |
pdbResNo = new int[width]; |
113 |
9 |
modelId = model; |
114 |
|
} |
115 |
|
} |
116 |
|
|
117 |
|
private static final int MIN_POS_TO_SUPERPOSE = 4; |
118 |
|
|
119 |
|
private static final String COLOURING_STRUCTURES = MessageManager |
120 |
|
.getString("status.colouring_structures"); |
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
private JalviewStructureDisplayI viewer; |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
private StructureCommandsI commandGenerator; |
132 |
|
|
133 |
|
private StructureSelectionManager ssm; |
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
private List<String> chainNames; |
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
private Map<String, String> chainFile; |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
private PDBEntry[] pdbEntry; |
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
private SequenceI[][] sequence; |
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
private String[][] chains; |
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
DataSourceType protocol = null; |
165 |
|
|
166 |
|
protected boolean colourBySequence = true; |
167 |
|
|
168 |
|
private boolean nucleotide; |
169 |
|
|
170 |
|
private boolean finishedInit = false; |
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
|
175 |
|
protected String[] modelFileNames = null; |
176 |
|
|
177 |
|
public String fileLoadingError; |
178 |
|
|
179 |
|
protected Thread externalViewerMonitor; |
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
@param |
185 |
|
@param |
186 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
187 |
13 |
public AAStructureBindingModel(StructureSelectionManager ssm,... |
188 |
|
SequenceI[][] seqs) |
189 |
|
{ |
190 |
13 |
this.ssm = ssm; |
191 |
13 |
this.sequence = seqs; |
192 |
13 |
chainNames = new ArrayList<>(); |
193 |
13 |
chainFile = new HashMap<>(); |
194 |
|
} |
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
@param |
200 |
|
@param |
201 |
|
@param |
202 |
|
@param |
203 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
204 |
13 |
public AAStructureBindingModel(StructureSelectionManager ssm,... |
205 |
|
PDBEntry[] pdbentry, SequenceI[][] sequenceIs, |
206 |
|
DataSourceType protocol) |
207 |
|
{ |
208 |
13 |
this(ssm, sequenceIs); |
209 |
13 |
this.nucleotide = Comparison.isNucleotide(sequenceIs); |
210 |
13 |
this.pdbEntry = pdbentry; |
211 |
13 |
this.protocol = protocol; |
212 |
13 |
resolveChains(); |
213 |
|
} |
214 |
|
|
|
|
| 91.7% |
Uncovered Elements: 3 (36) |
Complexity: 11 |
Complexity Density: 0.46 |
|
215 |
13 |
private boolean resolveChains()... |
216 |
|
{ |
217 |
|
|
218 |
|
|
219 |
|
|
220 |
13 |
int chainmaps = 0; |
221 |
|
|
222 |
|
|
223 |
13 |
String[][] newchains = new String[pdbEntry.length][]; |
224 |
13 |
int pe = 0; |
225 |
13 |
for (PDBEntry pdb : pdbEntry) |
226 |
|
{ |
227 |
22 |
SequenceI[] seqsForPdb = sequence[pe]; |
228 |
22 |
if (seqsForPdb != null) |
229 |
|
{ |
230 |
22 |
newchains[pe] = new String[seqsForPdb.length]; |
231 |
22 |
int se = 0; |
232 |
22 |
for (SequenceI asq : seqsForPdb) |
233 |
|
{ |
234 |
32 |
String chain = (chains != null && chains[pe] != null) |
235 |
|
? chains[pe][se] |
236 |
|
: null; |
237 |
32 |
SequenceI sq = (asq.getDatasetSequence() == null) ? asq |
238 |
|
: asq.getDatasetSequence(); |
239 |
32 |
if (sq.getAllPDBEntries() != null) |
240 |
|
{ |
241 |
32 |
for (PDBEntry pdbentry : sq.getAllPDBEntries()) |
242 |
|
{ |
243 |
30 |
if (pdb.getFile() != null && pdbentry.getFile() != null |
244 |
|
&& pdb.getFile().equals(pdbentry.getFile())) |
245 |
|
{ |
246 |
14 |
String chaincode = pdbentry.getChainCode(); |
247 |
14 |
if (chaincode != null && chaincode.length() > 0) |
248 |
|
{ |
249 |
8 |
chain = chaincode; |
250 |
8 |
chainmaps++; |
251 |
8 |
break; |
252 |
|
} |
253 |
|
} |
254 |
|
} |
255 |
|
} |
256 |
32 |
newchains[pe][se] = chain; |
257 |
32 |
se++; |
258 |
|
} |
259 |
22 |
pe++; |
260 |
|
} |
261 |
|
} |
262 |
|
|
263 |
13 |
chains = newchains; |
264 |
13 |
return chainmaps > 0; |
265 |
|
} |
266 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
267 |
78 |
public StructureSelectionManager getSsm()... |
268 |
|
{ |
269 |
78 |
return ssm; |
270 |
|
} |
271 |
|
|
272 |
|
|
273 |
|
|
274 |
|
|
275 |
|
@param |
276 |
|
@return |
277 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 3 |
Complexity Density: 3 |
|
278 |
126 |
public PDBEntry getPdbEntry(int i)... |
279 |
|
{ |
280 |
126 |
return (pdbEntry != null && pdbEntry.length > i) ? pdbEntry[i] : null; |
281 |
|
} |
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
@param |
287 |
|
@return |
288 |
|
|
|
|
| 66.7% |
Uncovered Elements: 3 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
289 |
1 |
public boolean hasPdbId(String pdbId)... |
290 |
|
{ |
291 |
1 |
if (pdbEntry != null) |
292 |
|
{ |
293 |
1 |
for (PDBEntry pdb : pdbEntry) |
294 |
|
{ |
295 |
1 |
if (pdb.getId().equals(pdbId)) |
296 |
|
{ |
297 |
0 |
return true; |
298 |
|
} |
299 |
|
} |
300 |
|
} |
301 |
1 |
return false; |
302 |
|
} |
303 |
|
|
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
@return |
308 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
309 |
260 |
public int getPdbCount()... |
310 |
|
{ |
311 |
260 |
return pdbEntry == null ? 0 : pdbEntry.length; |
312 |
|
} |
313 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
314 |
444 |
public SequenceI[][] getSequence()... |
315 |
|
{ |
316 |
444 |
return sequence; |
317 |
|
} |
318 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
319 |
222 |
public String[][] getChains()... |
320 |
|
{ |
321 |
222 |
return chains; |
322 |
|
} |
323 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
324 |
0 |
public DataSourceType getProtocol()... |
325 |
|
{ |
326 |
0 |
return protocol; |
327 |
|
} |
328 |
|
|
329 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
330 |
1 |
protected void setPdbentry(PDBEntry[] pdbentry)... |
331 |
|
{ |
332 |
1 |
this.pdbEntry = pdbentry; |
333 |
|
} |
334 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
335 |
1 |
protected void setSequence(SequenceI[][] sequence)... |
336 |
|
{ |
337 |
1 |
this.sequence = sequence; |
338 |
|
} |
339 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
340 |
1 |
protected void setChains(String[][] chains)... |
341 |
|
{ |
342 |
1 |
this.chains = chains; |
343 |
|
} |
344 |
|
|
345 |
|
|
346 |
|
|
347 |
|
|
348 |
|
|
349 |
|
@param |
350 |
|
|
351 |
|
@param |
352 |
|
|
353 |
|
@return |
354 |
|
|
|
|
| 66.7% |
Uncovered Elements: 7 (21) |
Complexity: 8 |
Complexity Density: 0.62 |
|
355 |
14 |
public String getViewerTitle(String viewerName, boolean verbose)... |
356 |
|
{ |
357 |
14 |
if (getSequence() == null || getSequence().length < 1 |
358 |
|
|| getPdbCount() < 1 || getSequence()[0].length < 1) |
359 |
|
{ |
360 |
0 |
return ("Jalview " + viewerName + " Window"); |
361 |
|
} |
362 |
|
|
363 |
|
|
364 |
14 |
StringBuilder title = new StringBuilder(64); |
365 |
14 |
final PDBEntry pdbe = getPdbEntry(0); |
366 |
14 |
title.append(viewerName + " view for " + getSequence()[0][0].getName() |
367 |
|
+ ":" + pdbe.getId()); |
368 |
|
|
369 |
14 |
if (verbose) |
370 |
|
{ |
371 |
14 |
String method = (String) pdbe.getProperty("method"); |
372 |
14 |
if (method != null) |
373 |
|
{ |
374 |
0 |
title.append(" Method: ").append(method); |
375 |
|
} |
376 |
14 |
String chain = (String) pdbe.getProperty("chains"); |
377 |
14 |
if (chain != null) |
378 |
|
{ |
379 |
0 |
title.append(" Chain:").append(chain); |
380 |
|
} |
381 |
|
} |
382 |
14 |
return title.toString(); |
383 |
|
} |
384 |
|
|
385 |
|
|
386 |
|
|
387 |
|
|
388 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
389 |
0 |
protected void releaseUIResources()... |
390 |
|
{ |
391 |
|
} |
392 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
393 |
0 |
@Override... |
394 |
|
public void releaseReferences(Object svl) |
395 |
|
{ |
396 |
|
} |
397 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
398 |
41 |
public boolean isColourBySequence()... |
399 |
|
{ |
400 |
41 |
return colourBySequence; |
401 |
|
} |
402 |
|
|
403 |
|
|
404 |
|
|
405 |
|
|
406 |
|
|
407 |
|
|
408 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
409 |
0 |
public void refreshGUI()... |
410 |
|
{ |
411 |
|
} |
412 |
|
|
413 |
|
|
414 |
|
|
415 |
|
|
416 |
|
|
417 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
418 |
7 |
public void refreshPdbEntries()... |
419 |
|
{ |
420 |
|
} |
421 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
422 |
22 |
public void setColourBySequence(boolean colourBySequence)... |
423 |
|
{ |
424 |
22 |
this.colourBySequence = colourBySequence; |
425 |
|
} |
426 |
|
|
|
|
| 75.9% |
Uncovered Elements: 14 (58) |
Complexity: 18 |
Complexity Density: 0.6 |
|
427 |
30 |
protected void addSequenceAndChain(int pe, SequenceI[] seq,... |
428 |
|
String[] tchain) |
429 |
|
{ |
430 |
30 |
if (pe < 0 || pe >= getPdbCount()) |
431 |
|
{ |
432 |
0 |
throw new Error(MessageManager.formatMessage( |
433 |
|
"error.implementation_error_no_pdbentry_from_index", |
434 |
|
new Object[] |
435 |
|
{ Integer.valueOf(pe).toString() })); |
436 |
|
} |
437 |
30 |
final String nullChain = "TheNullChain"; |
438 |
30 |
List<SequenceI> s = new ArrayList<>(); |
439 |
30 |
List<String> c = new ArrayList<>(); |
440 |
30 |
if (getChains() == null) |
441 |
|
{ |
442 |
0 |
setChains(new String[getPdbCount()][]); |
443 |
|
} |
444 |
30 |
if (getSequence()[pe] != null) |
445 |
|
{ |
446 |
81 |
for (int i = 0; i < getSequence()[pe].length; i++) |
447 |
|
{ |
448 |
52 |
s.add(getSequence()[pe][i]); |
449 |
52 |
if (getChains()[pe] != null) |
450 |
|
{ |
451 |
50 |
if (i < getChains()[pe].length) |
452 |
|
{ |
453 |
50 |
c.add(getChains()[pe][i]); |
454 |
|
} |
455 |
|
else |
456 |
|
{ |
457 |
0 |
c.add(nullChain); |
458 |
|
} |
459 |
|
} |
460 |
|
else |
461 |
|
{ |
462 |
2 |
if (tchain != null && tchain.length > 0) |
463 |
|
{ |
464 |
0 |
c.add(nullChain); |
465 |
|
} |
466 |
|
} |
467 |
|
} |
468 |
|
} |
469 |
83 |
for (int i = 0; i < seq.length; i++) |
470 |
|
{ |
471 |
53 |
if (!s.contains(seq[i])) |
472 |
|
{ |
473 |
1 |
s.add(seq[i]); |
474 |
1 |
if (tchain != null && i < tchain.length) |
475 |
|
{ |
476 |
0 |
c.add(tchain[i] == null ? nullChain : tchain[i]); |
477 |
|
} |
478 |
|
} |
479 |
|
} |
480 |
30 |
SequenceI[] tmp = s.toArray(new SequenceI[s.size()]); |
481 |
30 |
getSequence()[pe] = tmp; |
482 |
30 |
if (c.size() > 0) |
483 |
|
{ |
484 |
27 |
String[] tch = c.toArray(new String[c.size()]); |
485 |
77 |
for (int i = 0; i < tch.length; i++) |
486 |
|
{ |
487 |
50 |
if (tch[i] == nullChain) |
488 |
|
{ |
489 |
0 |
tch[i] = null; |
490 |
|
} |
491 |
|
} |
492 |
27 |
getChains()[pe] = tch; |
493 |
|
} |
494 |
|
else |
495 |
|
{ |
496 |
3 |
getChains()[pe] = null; |
497 |
|
} |
498 |
|
} |
499 |
|
|
500 |
|
|
501 |
|
|
502 |
|
|
503 |
|
|
504 |
|
|
|
|
| 88.9% |
Uncovered Elements: 4 (36) |
Complexity: 7 |
Complexity Density: 0.27 |
|
505 |
1 |
public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe,... |
506 |
|
SequenceI[][] seq, String[][] chns) |
507 |
|
{ |
508 |
1 |
List<PDBEntry> v = new ArrayList<>(); |
509 |
1 |
List<int[]> rtn = new ArrayList<>(); |
510 |
2 |
for (int i = 0; i < getPdbCount(); i++) |
511 |
|
{ |
512 |
1 |
v.add(getPdbEntry(i)); |
513 |
|
} |
514 |
2 |
for (int i = 0; i < pdbe.length; i++) |
515 |
|
{ |
516 |
1 |
int r = v.indexOf(pdbe[i]); |
517 |
1 |
if (r == -1 || r >= getPdbCount()) |
518 |
|
{ |
519 |
1 |
rtn.add(new int[] { v.size(), i }); |
520 |
1 |
v.add(pdbe[i]); |
521 |
|
} |
522 |
|
else |
523 |
|
{ |
524 |
|
|
525 |
0 |
addSequenceAndChain(r, seq[i], chns[i]); |
526 |
|
} |
527 |
|
} |
528 |
1 |
pdbe = v.toArray(new PDBEntry[v.size()]); |
529 |
1 |
setPdbentry(pdbe); |
530 |
1 |
if (rtn.size() > 0) |
531 |
|
{ |
532 |
|
|
533 |
1 |
SequenceI[][] sqs = new SequenceI[getPdbCount()][]; |
534 |
1 |
String[][] sch = new String[getPdbCount()][]; |
535 |
1 |
System.arraycopy(getSequence(), 0, sqs, 0, getSequence().length); |
536 |
1 |
System.arraycopy(getChains(), 0, sch, 0, this.getChains().length); |
537 |
1 |
setSequence(sqs); |
538 |
1 |
setChains(sch); |
539 |
1 |
pdbe = new PDBEntry[rtn.size()]; |
540 |
2 |
for (int r = 0; r < pdbe.length; r++) |
541 |
|
{ |
542 |
1 |
int[] stri = (rtn.get(r)); |
543 |
|
|
544 |
1 |
pdbe[r] = getPdbEntry(stri[0]); |
545 |
|
|
546 |
1 |
addSequenceAndChain(stri[0], seq[stri[1]], chns[stri[1]]); |
547 |
|
} |
548 |
|
} |
549 |
|
else |
550 |
|
{ |
551 |
0 |
pdbe = null; |
552 |
|
} |
553 |
1 |
return pdbe; |
554 |
|
} |
555 |
|
|
556 |
|
|
557 |
|
|
558 |
|
|
559 |
|
@param |
560 |
|
@param |
561 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
562 |
29 |
public void addSequence(int pe, SequenceI[] seq)... |
563 |
|
{ |
564 |
29 |
addSequenceAndChain(pe, seq, null); |
565 |
|
} |
566 |
|
|
567 |
|
|
568 |
|
|
569 |
|
|
570 |
|
@param |
571 |
|
|
572 |
|
@param |
573 |
|
|
574 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 1 |
|
575 |
35 |
public void addSequenceForStructFile(String pdbFile, SequenceI[] seq)... |
576 |
|
{ |
577 |
70 |
for (int pe = 0; pe < getPdbCount(); pe++) |
578 |
|
{ |
579 |
35 |
if (getPdbEntry(pe).getFile().equals(pdbFile)) |
580 |
|
{ |
581 |
20 |
addSequence(pe, seq); |
582 |
|
} |
583 |
|
} |
584 |
|
} |
585 |
|
|
586 |
|
@Override |
587 |
|
public abstract void highlightAtoms(List<AtomSpec> atoms); |
588 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
589 |
0 |
protected boolean isNucleotide()... |
590 |
|
{ |
591 |
0 |
return this.nucleotide; |
592 |
|
} |
593 |
|
|
594 |
|
|
595 |
|
|
596 |
|
|
597 |
|
|
598 |
|
@param |
599 |
|
@param |
600 |
|
@return |
601 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
602 |
0 |
public String printMappings()... |
603 |
|
{ |
604 |
0 |
if (pdbEntry == null) |
605 |
|
{ |
606 |
0 |
return ""; |
607 |
|
} |
608 |
0 |
StringBuilder sb = new StringBuilder(128); |
609 |
0 |
for (int pdbe = 0; pdbe < getPdbCount(); pdbe++) |
610 |
|
{ |
611 |
0 |
String pdbfile = getPdbEntry(pdbe).getFile(); |
612 |
0 |
List<SequenceI> seqs = Arrays.asList(getSequence()[pdbe]); |
613 |
0 |
sb.append(getSsm().printMappings(pdbfile, seqs)); |
614 |
|
} |
615 |
0 |
return sb.toString(); |
616 |
|
} |
617 |
|
|
618 |
|
|
619 |
|
|
620 |
|
|
621 |
|
|
622 |
|
|
623 |
|
@param |
624 |
|
@param |
625 |
|
@param |
626 |
|
@return |
627 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
628 |
620 |
protected int getMappedPosition(SequenceI seq, int alignedPos,... |
629 |
|
StructureMapping mapping) |
630 |
|
{ |
631 |
620 |
if (alignedPos >= seq.getLength()) |
632 |
|
{ |
633 |
1 |
return -1; |
634 |
|
} |
635 |
|
|
636 |
619 |
if (Comparison.isGap(seq.getCharAt(alignedPos))) |
637 |
|
{ |
638 |
6 |
return -1; |
639 |
|
} |
640 |
613 |
int seqPos = seq.findPosition(alignedPos); |
641 |
613 |
int pos = mapping.getPDBResNum(seqPos); |
642 |
613 |
return pos; |
643 |
|
} |
644 |
|
|
645 |
|
|
646 |
|
|
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
|
651 |
|
|
652 |
|
@param |
653 |
|
|
654 |
|
|
655 |
|
@param |
656 |
|
|
657 |
|
|
658 |
|
|
659 |
|
@param |
660 |
|
|
661 |
|
@return |
662 |
|
|
|
|
| 91.8% |
Uncovered Elements: 4 (49) |
Complexity: 13 |
Complexity Density: 0.42 |
|
663 |
3 |
protected int findSuperposableResidues(AlignmentI alignment,... |
664 |
|
BitSet matched, |
665 |
|
AAStructureBindingModel.SuperposeData[] structures) |
666 |
|
{ |
667 |
3 |
int refStructure = -1; |
668 |
3 |
String[] files = getStructureFiles(); |
669 |
3 |
if (files == null) |
670 |
|
{ |
671 |
0 |
return -1; |
672 |
|
} |
673 |
11 |
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) |
674 |
|
{ |
675 |
8 |
StructureMapping[] mappings = getSsm().getMapping(files[pdbfnum]); |
676 |
8 |
int lastPos = -1; |
677 |
|
|
678 |
|
|
679 |
|
|
680 |
|
|
681 |
|
|
682 |
8 |
final int seqCountForPdbFile = getSequence()[pdbfnum].length; |
683 |
16 |
for (int s = 0; s < seqCountForPdbFile; s++) |
684 |
|
{ |
685 |
8 |
for (StructureMapping mapping : mappings) |
686 |
|
{ |
687 |
8 |
final SequenceI theSequence = getSequence()[pdbfnum][s]; |
688 |
8 |
if (mapping.getSequence() == theSequence |
689 |
|
&& alignment.findIndex(theSequence) > -1) |
690 |
|
{ |
691 |
8 |
if (refStructure < 0) |
692 |
|
{ |
693 |
3 |
refStructure = pdbfnum; |
694 |
|
} |
695 |
638 |
for (int r = 0; r < alignment.getWidth(); r++) |
696 |
|
{ |
697 |
630 |
if (!matched.get(r)) |
698 |
|
{ |
699 |
10 |
continue; |
700 |
|
} |
701 |
620 |
int pos = getMappedPosition(theSequence, r, mapping); |
702 |
620 |
if (pos < 1 || pos == lastPos) |
703 |
|
{ |
704 |
7 |
matched.clear(r); |
705 |
7 |
continue; |
706 |
|
} |
707 |
613 |
lastPos = pos; |
708 |
613 |
structures[pdbfnum].pdbResNo[r] = pos; |
709 |
|
} |
710 |
8 |
String chain = mapping.getChain(); |
711 |
8 |
if (chain != null && chain.trim().length() > 0) |
712 |
|
{ |
713 |
8 |
structures[pdbfnum].chain = chain; |
714 |
|
} |
715 |
8 |
structures[pdbfnum].pdbId = mapping.getPdbId(); |
716 |
8 |
structures[pdbfnum].isRna = theSequence.getRNA() != null; |
717 |
|
|
718 |
|
|
719 |
|
|
720 |
|
|
721 |
|
|
722 |
8 |
s = seqCountForPdbFile; |
723 |
8 |
break; |
724 |
|
} |
725 |
|
} |
726 |
|
} |
727 |
|
} |
728 |
3 |
return refStructure; |
729 |
|
} |
730 |
|
|
731 |
|
|
732 |
|
|
733 |
|
|
734 |
|
|
735 |
|
|
736 |
|
@param |
737 |
|
|
|
|
| 70.4% |
Uncovered Elements: 8 (27) |
Complexity: 8 |
Complexity Density: 0.42 |
|
738 |
1 |
protected boolean waitForFileLoad(String[] files)... |
739 |
|
{ |
740 |
|
|
741 |
|
|
742 |
|
|
743 |
1 |
long starttime = System.currentTimeMillis(); |
744 |
1 |
long endTime = 10000 + 1000 * files.length + starttime; |
745 |
1 |
String notLoaded = null; |
746 |
|
|
747 |
1 |
boolean waiting = true; |
748 |
2 |
while (waiting && System.currentTimeMillis() < endTime) |
749 |
|
{ |
750 |
1 |
waiting = false; |
751 |
1 |
for (String file : files) |
752 |
|
{ |
753 |
2 |
notLoaded = file; |
754 |
2 |
if (file == null) |
755 |
|
{ |
756 |
0 |
continue; |
757 |
|
} |
758 |
2 |
try |
759 |
|
{ |
760 |
2 |
StructureMapping[] sm = getSsm().getMapping(file); |
761 |
2 |
if (sm == null || sm.length == 0) |
762 |
|
{ |
763 |
0 |
waiting = true; |
764 |
|
} |
765 |
|
} catch (Throwable x) |
766 |
|
{ |
767 |
0 |
waiting = true; |
768 |
|
} |
769 |
|
} |
770 |
|
} |
771 |
|
|
772 |
1 |
if (waiting) |
773 |
|
{ |
774 |
0 |
System.err.println( |
775 |
|
"Timed out waiting for structure viewer to load file " |
776 |
|
+ notLoaded); |
777 |
0 |
return false; |
778 |
|
} |
779 |
1 |
return true; |
780 |
|
} |
781 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 6 |
Complexity Density: 0.86 |
|
782 |
0 |
@Override... |
783 |
|
public boolean isListeningFor(SequenceI seq) |
784 |
|
{ |
785 |
0 |
if (sequence != null) |
786 |
|
{ |
787 |
0 |
for (SequenceI[] seqs : sequence) |
788 |
|
{ |
789 |
0 |
if (seqs != null) |
790 |
|
{ |
791 |
0 |
for (SequenceI s : seqs) |
792 |
|
{ |
793 |
0 |
if (s == seq || (s.getDatasetSequence() != null |
794 |
|
&& s.getDatasetSequence() == seq.getDatasetSequence())) |
795 |
|
{ |
796 |
0 |
return true; |
797 |
|
} |
798 |
|
} |
799 |
|
} |
800 |
|
} |
801 |
|
} |
802 |
0 |
return false; |
803 |
|
} |
804 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
805 |
11 |
public boolean isFinishedInit()... |
806 |
|
{ |
807 |
11 |
return finishedInit; |
808 |
|
} |
809 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
810 |
14 |
public void setFinishedInit(boolean fi)... |
811 |
|
{ |
812 |
14 |
this.finishedInit = fi; |
813 |
|
} |
814 |
|
|
815 |
|
|
816 |
|
|
817 |
|
|
818 |
|
|
819 |
|
@return |
820 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
821 |
23 |
public List<String> getChainNames()... |
822 |
|
{ |
823 |
23 |
return chainNames; |
824 |
|
} |
825 |
|
|
826 |
|
|
827 |
|
|
828 |
|
|
829 |
|
@return |
830 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
831 |
462 |
public JalviewStructureDisplayI getViewer()... |
832 |
|
{ |
833 |
462 |
return viewer; |
834 |
|
} |
835 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
836 |
14 |
public void setViewer(JalviewStructureDisplayI v)... |
837 |
|
{ |
838 |
14 |
viewer = v; |
839 |
|
} |
840 |
|
|
841 |
|
|
842 |
|
|
843 |
|
|
844 |
|
|
845 |
|
|
846 |
|
@param |
847 |
|
|
848 |
|
@return |
849 |
|
|
|
|
| 55.1% |
Uncovered Elements: 22 (49) |
Complexity: 10 |
Complexity Density: 0.3 |
|
850 |
1 |
public String superposeStructures(List<AlignmentViewPanel> alignWith)... |
851 |
|
{ |
852 |
1 |
String error = ""; |
853 |
1 |
String[] files = getStructureFiles(); |
854 |
|
|
855 |
1 |
if (!waitForFileLoad(files)) |
856 |
|
{ |
857 |
0 |
return null; |
858 |
|
} |
859 |
1 |
refreshPdbEntries(); |
860 |
|
|
861 |
1 |
for (AlignmentViewPanel view : alignWith) |
862 |
|
{ |
863 |
1 |
AlignmentI alignment = view.getAlignment(); |
864 |
1 |
HiddenColumns hiddenCols = alignment.getHiddenColumns(); |
865 |
|
|
866 |
|
|
867 |
|
|
868 |
|
|
869 |
|
|
870 |
1 |
BitSet matched = new BitSet(); |
871 |
1 |
final int width = alignment.getWidth(); |
872 |
298 |
for (int m = 0; m < width; m++) |
873 |
|
{ |
874 |
297 |
if (hiddenCols == null || hiddenCols.isVisible(m)) |
875 |
|
{ |
876 |
297 |
matched.set(m); |
877 |
|
} |
878 |
|
} |
879 |
|
|
880 |
1 |
AAStructureBindingModel.SuperposeData[] structures = new AAStructureBindingModel.SuperposeData[files.length]; |
881 |
3 |
for (int f = 0; f < files.length; f++) |
882 |
|
{ |
883 |
2 |
structures[f] = new AAStructureBindingModel.SuperposeData(width, |
884 |
|
getModelIdForFile(files[f])); |
885 |
|
} |
886 |
|
|
887 |
|
|
888 |
|
|
889 |
|
|
890 |
|
|
891 |
1 |
int refStructure = findSuperposableResidues(alignment, matched, |
892 |
|
structures); |
893 |
|
|
894 |
|
|
895 |
|
|
896 |
|
|
897 |
1 |
int nmatched = matched.cardinality(); |
898 |
1 |
if (nmatched < MIN_POS_TO_SUPERPOSE) |
899 |
|
{ |
900 |
0 |
String msg = MessageManager |
901 |
|
.formatMessage("label.insufficient_residues", nmatched); |
902 |
0 |
error += view.getViewName() + ": " + msg + "; "; |
903 |
0 |
continue; |
904 |
|
} |
905 |
|
|
906 |
|
|
907 |
|
|
908 |
|
|
909 |
1 |
AtomSpecModel refAtoms = getAtomSpec(structures[refStructure], |
910 |
|
matched); |
911 |
|
|
912 |
|
|
913 |
|
|
914 |
|
|
915 |
|
|
916 |
|
|
917 |
1 |
executeCommands(commandGenerator.showBackbone(), true, null); |
918 |
|
|
919 |
|
|
920 |
|
|
921 |
|
|
922 |
0 |
for (int i = 0; i < structures.length; i++) |
923 |
|
{ |
924 |
0 |
if (i != refStructure) |
925 |
|
{ |
926 |
0 |
AtomSpecModel atomSpec = getAtomSpec(structures[i], matched); |
927 |
0 |
List<StructureCommandI> commands = commandGenerator |
928 |
|
.superposeStructures(refAtoms, atomSpec); |
929 |
0 |
List<String> replies = executeCommands(commands, true, null); |
930 |
0 |
for (String reply : replies) |
931 |
|
{ |
932 |
|
|
933 |
0 |
if (reply.toLowerCase().contains("unequal numbers of atoms")) |
934 |
|
{ |
935 |
0 |
error += "; " + reply; |
936 |
|
} |
937 |
|
} |
938 |
|
} |
939 |
|
} |
940 |
|
} |
941 |
|
|
942 |
0 |
return error; |
943 |
|
} |
944 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
945 |
1 |
private AtomSpecModel getAtomSpec(... |
946 |
|
AAStructureBindingModel.SuperposeData superposeData, |
947 |
|
BitSet matched) |
948 |
|
{ |
949 |
1 |
AtomSpecModel model = new AtomSpecModel(); |
950 |
1 |
int nextColumnMatch = matched.nextSetBit(0); |
951 |
297 |
while (nextColumnMatch != -1) |
952 |
|
{ |
953 |
296 |
int pdbResNum = superposeData.pdbResNo[nextColumnMatch]; |
954 |
296 |
model.addRange(superposeData.modelId, pdbResNum, pdbResNum, |
955 |
|
superposeData.chain); |
956 |
296 |
nextColumnMatch = matched.nextSetBit(nextColumnMatch + 1); |
957 |
|
} |
958 |
|
|
959 |
1 |
return model; |
960 |
|
} |
961 |
|
|
962 |
|
|
963 |
|
|
964 |
|
|
965 |
|
|
966 |
|
@param |
967 |
|
|
968 |
|
@return |
969 |
|
|
970 |
|
public abstract SequenceRenderer getSequenceRenderer( |
971 |
|
AlignmentViewPanel alignment); |
972 |
|
|
973 |
|
|
974 |
|
|
975 |
|
|
976 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
977 |
0 |
public void colourByChain()... |
978 |
|
{ |
979 |
0 |
colourBySequence = false; |
980 |
|
|
981 |
|
|
982 |
|
|
983 |
0 |
executeCommand(false, COLOURING_STRUCTURES, |
984 |
|
commandGenerator.colourByChain()); |
985 |
|
} |
986 |
|
|
987 |
|
|
988 |
|
|
989 |
|
|
990 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
991 |
0 |
public void colourByCharge()... |
992 |
|
{ |
993 |
0 |
colourBySequence = false; |
994 |
|
|
995 |
0 |
executeCommands(commandGenerator.colourByCharge(), false, |
996 |
|
COLOURING_STRUCTURES); |
997 |
|
} |
998 |
|
|
999 |
|
|
1000 |
|
|
1001 |
|
|
1002 |
|
|
1003 |
|
|
1004 |
|
|
1005 |
|
@param |
1006 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.36 |
|
1007 |
0 |
public void colourByJalviewColourScheme(ColourSchemeI cs)... |
1008 |
|
{ |
1009 |
0 |
colourBySequence = false; |
1010 |
|
|
1011 |
0 |
if (cs == null || !cs.isSimple()) |
1012 |
|
{ |
1013 |
0 |
return; |
1014 |
|
} |
1015 |
|
|
1016 |
|
|
1017 |
|
|
1018 |
|
|
1019 |
0 |
Map<String, Color> colours = new HashMap<>(); |
1020 |
0 |
List<String> residues = ResidueProperties.getResidues(isNucleotide(), |
1021 |
|
false); |
1022 |
0 |
for (String resName : residues) |
1023 |
|
{ |
1024 |
0 |
char res = resName.length() == 3 |
1025 |
|
? ResidueProperties.getSingleCharacterCode(resName) |
1026 |
|
: resName.charAt(0); |
1027 |
0 |
Color colour = cs.findColour(res, 0, null, null, 0f); |
1028 |
0 |
colours.put(resName, colour); |
1029 |
|
} |
1030 |
|
|
1031 |
|
|
1032 |
|
|
1033 |
|
|
1034 |
0 |
List<StructureCommandI> cmd = commandGenerator |
1035 |
|
.colourByResidues(colours); |
1036 |
0 |
executeCommands(cmd, false, COLOURING_STRUCTURES); |
1037 |
|
} |
1038 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1039 |
0 |
public void setBackgroundColour(Color col)... |
1040 |
|
{ |
1041 |
0 |
StructureCommandI cmd = commandGenerator.setBackgroundColour(col); |
1042 |
0 |
executeCommand(false, null, cmd); |
1043 |
|
} |
1044 |
|
|
1045 |
|
|
1046 |
|
|
1047 |
|
|
1048 |
|
|
1049 |
|
@param |
1050 |
|
@param |
1051 |
|
|
1052 |
|
protected abstract List<String> executeCommand(StructureCommandI cmd, |
1053 |
|
boolean getReply); |
1054 |
|
|
1055 |
|
|
1056 |
|
|
1057 |
|
|
1058 |
|
@param |
1059 |
|
@param |
1060 |
|
@param |
1061 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1062 |
11 |
protected List<String> executeCommands(List<StructureCommandI> commands,... |
1063 |
|
boolean getReply, String msg) |
1064 |
|
{ |
1065 |
11 |
return executeCommand(getReply, msg, |
1066 |
|
commands.toArray(new StructureCommandI[commands.size()])); |
1067 |
|
} |
1068 |
|
|
1069 |
|
|
1070 |
|
|
1071 |
|
|
1072 |
|
|
1073 |
|
|
1074 |
|
|
1075 |
|
|
1076 |
|
|
1077 |
|
@param |
1078 |
|
@param |
1079 |
|
@param |
1080 |
|
@return |
1081 |
|
|
|
|
| 81.8% |
Uncovered Elements: 4 (22) |
Complexity: 5 |
Complexity Density: 0.36 |
|
1082 |
11 |
protected List<String> executeCommand(boolean getReply, String msg,... |
1083 |
|
StructureCommandI... cmds) |
1084 |
|
{ |
1085 |
11 |
JalviewStructureDisplayI theViewer = getViewer(); |
1086 |
11 |
final long handle = msg == null ? 0 : theViewer.startProgressBar(msg); |
1087 |
|
|
1088 |
11 |
if (getReply) |
1089 |
|
{ |
1090 |
|
|
1091 |
|
|
1092 |
|
|
1093 |
1 |
List<String> response = new ArrayList<>(); |
1094 |
1 |
try |
1095 |
|
{ |
1096 |
1 |
for (StructureCommandI cmd : cmds) |
1097 |
|
{ |
1098 |
1 |
List<String> replies = executeCommand(cmd, true); |
1099 |
1 |
response.addAll(replies); |
1100 |
|
} |
1101 |
0 |
return response; |
1102 |
|
} finally |
1103 |
|
{ |
1104 |
1 |
if (msg != null) |
1105 |
|
{ |
1106 |
0 |
theViewer.stopProgressBar(null, handle); |
1107 |
|
} |
1108 |
|
} |
1109 |
|
} |
1110 |
|
|
1111 |
|
|
1112 |
|
|
1113 |
|
|
1114 |
10 |
String threadName = msg == null ? "StructureCommand" : msg; |
1115 |
10 |
new Thread(new Runnable() |
1116 |
|
{ |
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
1117 |
10 |
@Override... |
1118 |
|
public void run() |
1119 |
|
{ |
1120 |
10 |
try |
1121 |
|
{ |
1122 |
10 |
for (StructureCommandI cmd : cmds) |
1123 |
|
{ |
1124 |
10 |
executeCommand(cmd, false); |
1125 |
|
} |
1126 |
|
} finally |
1127 |
|
{ |
1128 |
10 |
if (msg != null) |
1129 |
|
{ |
1130 |
10 |
SwingUtilities.invokeLater(new Runnable() |
1131 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1132 |
10 |
@Override... |
1133 |
|
public void run() |
1134 |
|
{ |
1135 |
10 |
theViewer.stopProgressBar(null, handle); |
1136 |
|
} |
1137 |
|
}); |
1138 |
|
} |
1139 |
|
} |
1140 |
|
} |
1141 |
|
}, threadName).start(); |
1142 |
10 |
return null; |
1143 |
|
} |
1144 |
|
|
1145 |
|
|
1146 |
|
|
1147 |
|
|
1148 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 4 |
Complexity Density: 0.8 |
|
1149 |
10 |
public void colourBySequence(AlignmentViewPanel alignmentv)... |
1150 |
|
{ |
1151 |
10 |
if (!colourBySequence || !isLoadingFinished() || getSsm() == null) |
1152 |
|
{ |
1153 |
0 |
return; |
1154 |
|
} |
1155 |
10 |
Map<Object, AtomSpecModel> colourMap = buildColoursMap(ssm, sequence, |
1156 |
|
alignmentv); |
1157 |
|
|
1158 |
10 |
List<StructureCommandI> colourBySequenceCommands = commandGenerator |
1159 |
|
.colourBySequence(colourMap); |
1160 |
10 |
executeCommands(colourBySequenceCommands, false, COLOURING_STRUCTURES); |
1161 |
|
} |
1162 |
|
|
1163 |
|
|
1164 |
|
|
1165 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1166 |
0 |
public void focusView()... |
1167 |
|
{ |
1168 |
0 |
executeCommand(false, null, commandGenerator.focusView()); |
1169 |
|
} |
1170 |
|
|
1171 |
|
|
1172 |
|
|
1173 |
|
|
1174 |
|
|
1175 |
|
|
1176 |
|
@param |
1177 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
1178 |
0 |
public void showChains(List<String> toShow)... |
1179 |
|
{ |
1180 |
|
|
1181 |
|
|
1182 |
|
|
1183 |
|
|
1184 |
|
|
1185 |
|
|
1186 |
|
|
1187 |
0 |
List<String> showThese = new ArrayList<>(); |
1188 |
0 |
for (String chainId : toShow) |
1189 |
|
{ |
1190 |
0 |
String[] tokens = chainId.split("\\:"); |
1191 |
0 |
if (tokens.length == 2) |
1192 |
|
{ |
1193 |
0 |
String pdbFile = getFileForChain(chainId); |
1194 |
0 |
String model = getModelIdForFile(pdbFile); |
1195 |
0 |
showThese.add(model + ":" + tokens[1]); |
1196 |
|
} |
1197 |
|
} |
1198 |
0 |
executeCommands(commandGenerator.showChains(showThese), false, null); |
1199 |
|
} |
1200 |
|
|
1201 |
|
|
1202 |
|
|
1203 |
|
|
1204 |
|
|
1205 |
|
@param |
1206 |
|
@return |
1207 |
|
|
1208 |
|
protected abstract String getModelIdForFile(String chainId); |
1209 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1210 |
9 |
public boolean hasFileLoadingError()... |
1211 |
|
{ |
1212 |
9 |
return fileLoadingError != null && fileLoadingError.length() > 0; |
1213 |
|
} |
1214 |
|
|
1215 |
|
|
1216 |
|
|
1217 |
|
|
1218 |
|
|
1219 |
|
@param |
1220 |
|
@return |
1221 |
|
|
|
|
| 60% |
Uncovered Elements: 4 (10) |
Complexity: 4 |
Complexity Density: 1 |
|
1222 |
6 |
public FeatureRenderer getFeatureRenderer(AlignmentViewPanel avp)... |
1223 |
|
{ |
1224 |
6 |
AlignmentViewPanel ap = (avp == null) ? getViewer().getAlignmentPanel() |
1225 |
|
: avp; |
1226 |
6 |
if (ap == null) |
1227 |
|
{ |
1228 |
0 |
return null; |
1229 |
|
} |
1230 |
6 |
return ap.getAlignViewport().isShowSequenceFeatures() |
1231 |
|
? ap.getFeatureRenderer() |
1232 |
|
: null; |
1233 |
|
} |
1234 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1235 |
7 |
protected void setStructureCommands(StructureCommandsI cmd)... |
1236 |
|
{ |
1237 |
7 |
commandGenerator = cmd; |
1238 |
|
} |
1239 |
|
|
1240 |
|
|
1241 |
|
|
1242 |
|
|
1243 |
|
|
1244 |
|
@param |
1245 |
|
@param |
1246 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1247 |
16 |
public void addChainFile(String chainId, String fileName)... |
1248 |
|
{ |
1249 |
16 |
chainFile.put(chainId, fileName); |
1250 |
|
} |
1251 |
|
|
1252 |
|
|
1253 |
|
|
1254 |
|
|
1255 |
|
|
1256 |
|
@param |
1257 |
|
@return |
1258 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1259 |
0 |
protected String getFileForChain(String chainId)... |
1260 |
|
{ |
1261 |
0 |
return chainFile.get(chainId); |
1262 |
|
} |
1263 |
|
|
|
|
| 88.9% |
Uncovered Elements: 1 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
1264 |
403 |
@Override... |
1265 |
|
public void updateColours(Object source) |
1266 |
|
{ |
1267 |
403 |
AlignmentViewPanel ap = (AlignmentViewPanel) source; |
1268 |
|
|
1269 |
403 |
if (!getViewer().isUsedForColourBy(ap)) |
1270 |
|
{ |
1271 |
397 |
return; |
1272 |
|
} |
1273 |
6 |
if (!isLoadingFromArchive()) |
1274 |
|
{ |
1275 |
6 |
colourBySequence(ap); |
1276 |
|
} |
1277 |
|
} |
1278 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1279 |
8 |
public StructureCommandsI getCommandGenerator()... |
1280 |
|
{ |
1281 |
8 |
return commandGenerator; |
1282 |
|
} |
1283 |
|
|
1284 |
|
protected abstract ViewerType getViewerType(); |
1285 |
|
|
1286 |
|
|
1287 |
|
|
1288 |
|
|
1289 |
|
|
1290 |
|
|
1291 |
|
|
1292 |
|
|
1293 |
|
|
1294 |
|
|
1295 |
|
|
1296 |
|
|
1297 |
|
|
1298 |
|
|
1299 |
|
|
1300 |
|
|
1301 |
|
@param |
1302 |
|
@param |
1303 |
|
@param |
1304 |
|
@return |
1305 |
|
|
|
|
| 89.7% |
Uncovered Elements: 7 (68) |
Complexity: 18 |
Complexity Density: 0.41 |
|
1306 |
11 |
protected Map<Object, AtomSpecModel> buildColoursMap(... |
1307 |
|
StructureSelectionManager ssm, SequenceI[][] sequence, |
1308 |
|
AlignmentViewPanel viewPanel) |
1309 |
|
{ |
1310 |
11 |
String[] files = getStructureFiles(); |
1311 |
11 |
SequenceRenderer sr = getSequenceRenderer(viewPanel); |
1312 |
11 |
FeatureRenderer fr = viewPanel.getFeatureRenderer(); |
1313 |
11 |
FeatureColourFinder finder = new FeatureColourFinder(fr); |
1314 |
11 |
AlignViewportI viewport = viewPanel.getAlignViewport(); |
1315 |
11 |
HiddenColumns cs = viewport.getAlignment().getHiddenColumns(); |
1316 |
11 |
AlignmentI al = viewport.getAlignment(); |
1317 |
11 |
Map<Object, AtomSpecModel> colourMap = new LinkedHashMap<>(); |
1318 |
11 |
Color lastColour = null; |
1319 |
|
|
1320 |
25 |
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) |
1321 |
|
{ |
1322 |
14 |
final String modelId = getModelIdForFile(files[pdbfnum]); |
1323 |
14 |
StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); |
1324 |
|
|
1325 |
14 |
if (mapping == null || mapping.length < 1) |
1326 |
|
{ |
1327 |
1 |
continue; |
1328 |
|
} |
1329 |
|
|
1330 |
13 |
int startPos = -1, lastPos = -1; |
1331 |
13 |
String lastChain = ""; |
1332 |
26 |
for (int s = 0; s < sequence[pdbfnum].length; s++) |
1333 |
|
{ |
1334 |
27 |
for (int sp, m = 0; m < mapping.length; m++) |
1335 |
|
{ |
1336 |
14 |
final SequenceI seq = sequence[pdbfnum][s]; |
1337 |
? |
if (mapping[m].getSequence() == seq |
1338 |
|
&& (sp = al.findIndex(seq)) > -1) |
1339 |
|
{ |
1340 |
12 |
SequenceI asp = al.getSequenceAt(sp); |
1341 |
2994 |
for (int r = 0; r < asp.getLength(); r++) |
1342 |
|
{ |
1343 |
|
|
1344 |
2982 |
if (Comparison.isGap(asp.getCharAt(r))) |
1345 |
|
{ |
1346 |
0 |
continue; |
1347 |
|
} |
1348 |
2982 |
int pos = mapping[m].getPDBResNum(asp.findPosition(r)); |
1349 |
|
|
1350 |
2982 |
if (pos < 1 || pos == lastPos) |
1351 |
|
{ |
1352 |
0 |
continue; |
1353 |
|
} |
1354 |
|
|
1355 |
2982 |
Color colour = sr.getResidueColour(seq, r, finder); |
1356 |
|
|
1357 |
|
|
1358 |
|
|
1359 |
|
|
1360 |
2982 |
if (!cs.isVisible(r)) |
1361 |
|
{ |
1362 |
6 |
colour = Color.GRAY; |
1363 |
|
} |
1364 |
|
|
1365 |
2982 |
final String chain = mapping[m].getChain(); |
1366 |
|
|
1367 |
|
|
1368 |
|
|
1369 |
|
|
1370 |
|
|
1371 |
|
|
1372 |
2982 |
final boolean newColour = !colour.equals(lastColour); |
1373 |
2982 |
final boolean nonContig = lastPos + 1 != pos; |
1374 |
2982 |
final boolean newChain = !chain.equals(lastChain); |
1375 |
2982 |
if (newColour || nonContig || newChain) |
1376 |
|
{ |
1377 |
18 |
if (startPos != -1) |
1378 |
|
{ |
1379 |
6 |
addAtomSpecRange(colourMap, lastColour, modelId, startPos, |
1380 |
|
lastPos, lastChain); |
1381 |
|
} |
1382 |
18 |
startPos = pos; |
1383 |
|
} |
1384 |
2982 |
lastColour = colour; |
1385 |
2982 |
lastPos = pos; |
1386 |
2982 |
lastChain = chain; |
1387 |
|
} |
1388 |
|
|
1389 |
12 |
if (lastColour != null) |
1390 |
|
{ |
1391 |
12 |
addAtomSpecRange(colourMap, lastColour, modelId, startPos, |
1392 |
|
lastPos, lastChain); |
1393 |
|
} |
1394 |
|
|
1395 |
|
} |
1396 |
|
} |
1397 |
|
} |
1398 |
|
} |
1399 |
11 |
return colourMap; |
1400 |
|
} |
1401 |
|
|
1402 |
|
|
1403 |
|
|
1404 |
|
|
1405 |
|
@param |
1406 |
|
@param |
1407 |
|
@return |
1408 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1409 |
0 |
protected String getModelId(int pdbfnum, String file)... |
1410 |
|
{ |
1411 |
0 |
return String.valueOf(pdbfnum); |
1412 |
|
} |
1413 |
|
|
1414 |
|
|
1415 |
|
|
1416 |
|
|
1417 |
|
|
1418 |
|
@param |
1419 |
|
@param |
1420 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
1421 |
7 |
public void stashFoundChains(StructureFile pdb, String file)... |
1422 |
|
{ |
1423 |
23 |
for (int i = 0; i < pdb.getChains().size(); i++) |
1424 |
|
{ |
1425 |
16 |
String chid = pdb.getId() + ":" + pdb.getChains().elementAt(i).id; |
1426 |
16 |
addChainFile(chid, file); |
1427 |
16 |
getChainNames().add(chid); |
1428 |
|
} |
1429 |
|
} |
1430 |
|
|
1431 |
|
|
1432 |
|
|
1433 |
|
|
1434 |
|
|
1435 |
|
|
1436 |
|
|
1437 |
|
|
1438 |
|
|
1439 |
|
|
1440 |
|
|
1441 |
|
@param |
1442 |
|
@param |
1443 |
|
@param |
1444 |
|
@param |
1445 |
|
@param |
1446 |
|
@param |
1447 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
1448 |
18 |
public static final void addAtomSpecRange(Map<Object, AtomSpecModel> map,... |
1449 |
|
Object value, String model, int startPos, int endPos, |
1450 |
|
String chain) |
1451 |
|
{ |
1452 |
|
|
1453 |
|
|
1454 |
|
|
1455 |
18 |
AtomSpecModel atomSpec = map.get(value); |
1456 |
18 |
if (atomSpec == null) |
1457 |
|
{ |
1458 |
13 |
atomSpec = new AtomSpecModel(); |
1459 |
13 |
map.put(value, atomSpec); |
1460 |
|
} |
1461 |
|
|
1462 |
18 |
atomSpec.addRange(model, startPos, endPos, chain); |
1463 |
|
} |
1464 |
|
|
1465 |
|
|
1466 |
|
|
1467 |
|
|
1468 |
|
|
1469 |
|
|
1470 |
|
@return |
1471 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1472 |
0 |
public String getSessionFileExtension()... |
1473 |
|
{ |
1474 |
0 |
return null; |
1475 |
|
} |
1476 |
|
|
1477 |
|
|
1478 |
|
|
1479 |
|
|
1480 |
|
|
1481 |
|
@return |
1482 |
|
|
|
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 2 |
Complexity Density: 0.25 |
|
1483 |
2 |
public File saveSession()... |
1484 |
|
{ |
1485 |
2 |
String prefix = getViewerType().toString(); |
1486 |
2 |
String suffix = getSessionFileExtension(); |
1487 |
2 |
File f = null; |
1488 |
2 |
try |
1489 |
|
{ |
1490 |
2 |
f = File.createTempFile(prefix, suffix); |
1491 |
2 |
saveSession(f); |
1492 |
|
} catch (IOException e) |
1493 |
|
{ |
1494 |
0 |
Cache.log.error(String.format("Error saving %s session: %s", prefix, |
1495 |
|
e.toString())); |
1496 |
|
} |
1497 |
|
|
1498 |
2 |
return f; |
1499 |
|
} |
1500 |
|
|
1501 |
|
|
1502 |
|
|
1503 |
|
|
1504 |
|
@param |
1505 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1506 |
2 |
protected void saveSession(File f)... |
1507 |
|
{ |
1508 |
2 |
StructureCommandI cmd = commandGenerator.saveSession(f.getPath()); |
1509 |
2 |
if (cmd != null) |
1510 |
|
{ |
1511 |
2 |
executeCommand(cmd, false); |
1512 |
|
} |
1513 |
|
} |
1514 |
|
|
1515 |
|
|
1516 |
|
|
1517 |
|
|
1518 |
|
|
1519 |
|
|
1520 |
|
@return |
1521 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1522 |
7 |
public boolean isViewerRunning()... |
1523 |
|
{ |
1524 |
7 |
return false; |
1525 |
|
} |
1526 |
|
|
1527 |
|
|
1528 |
|
|
1529 |
|
|
1530 |
|
|
1531 |
|
|
1532 |
|
@param |
1533 |
|
|
|
|
| 68.8% |
Uncovered Elements: 5 (16) |
Complexity: 4 |
Complexity Density: 0.4 |
|
1534 |
7 |
public void closeViewer(boolean forceClose)... |
1535 |
|
{ |
1536 |
7 |
getSsm().removeStructureViewerListener(this, this.getStructureFiles()); |
1537 |
7 |
releaseUIResources(); |
1538 |
|
|
1539 |
|
|
1540 |
|
|
1541 |
|
|
1542 |
7 |
if (externalViewerMonitor != null) |
1543 |
|
{ |
1544 |
0 |
externalViewerMonitor.interrupt(); |
1545 |
0 |
externalViewerMonitor = null; |
1546 |
|
} |
1547 |
|
|
1548 |
7 |
stopListening(); |
1549 |
|
|
1550 |
7 |
if (forceClose) |
1551 |
|
{ |
1552 |
1 |
StructureCommandI cmd = getCommandGenerator().closeViewer(); |
1553 |
1 |
if (cmd != null) |
1554 |
|
{ |
1555 |
0 |
executeCommand(cmd, false); |
1556 |
|
} |
1557 |
|
} |
1558 |
|
} |
1559 |
|
|
1560 |
|
|
1561 |
|
|
1562 |
|
|
1563 |
|
|
1564 |
|
@return |
1565 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1566 |
0 |
public String getHelpURL()... |
1567 |
|
{ |
1568 |
0 |
return null; |
1569 |
|
} |
1570 |
|
|
1571 |
|
|
1572 |
|
|
1573 |
|
|
1574 |
|
|
1575 |
|
|
1576 |
|
|
1577 |
|
@param |
1578 |
|
@return |
1579 |
|
|
|
|
| 0% |
Uncovered Elements: 61 (61) |
Complexity: 16 |
Complexity Density: 0.43 |
|
1580 |
0 |
protected Map<String, Map<Object, AtomSpecModel>> buildFeaturesMap(... |
1581 |
|
AlignmentViewPanel viewPanel) |
1582 |
|
{ |
1583 |
0 |
Map<String, Map<Object, AtomSpecModel>> theMap = new LinkedHashMap<>(); |
1584 |
0 |
String[] files = getStructureFiles(); |
1585 |
0 |
if (files == null) |
1586 |
|
{ |
1587 |
0 |
return theMap; |
1588 |
|
} |
1589 |
|
|
1590 |
0 |
FeatureRenderer fr = viewPanel.getFeatureRenderer(); |
1591 |
0 |
if (fr == null) |
1592 |
|
{ |
1593 |
0 |
return theMap; |
1594 |
|
} |
1595 |
|
|
1596 |
0 |
AlignViewportI viewport = viewPanel.getAlignViewport(); |
1597 |
0 |
List<String> visibleFeatures = fr.getDisplayedFeatureTypes(); |
1598 |
|
|
1599 |
|
|
1600 |
|
|
1601 |
|
|
1602 |
|
|
1603 |
0 |
boolean showLinkedFeatures = viewport.isShowComplementFeatures(); |
1604 |
0 |
List<String> complementFeatures = new ArrayList<>(); |
1605 |
0 |
FeatureRenderer complementRenderer = null; |
1606 |
0 |
if (showLinkedFeatures) |
1607 |
|
{ |
1608 |
0 |
AlignViewportI comp = fr.getViewport().getCodingComplement(); |
1609 |
0 |
if (comp != null) |
1610 |
|
{ |
1611 |
0 |
complementRenderer = Desktop.getAlignFrameFor(comp) |
1612 |
|
.getFeatureRenderer(); |
1613 |
0 |
complementFeatures = complementRenderer.getDisplayedFeatureTypes(); |
1614 |
|
} |
1615 |
|
} |
1616 |
0 |
if (visibleFeatures.isEmpty() && complementFeatures.isEmpty()) |
1617 |
|
{ |
1618 |
0 |
return theMap; |
1619 |
|
} |
1620 |
|
|
1621 |
0 |
AlignmentI alignment = viewPanel.getAlignment(); |
1622 |
0 |
SequenceI[][] seqs = getSequence(); |
1623 |
|
|
1624 |
0 |
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) |
1625 |
|
{ |
1626 |
0 |
String modelId = getModelIdForFile(files[pdbfnum]); |
1627 |
0 |
StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); |
1628 |
|
|
1629 |
0 |
if (mapping == null || mapping.length < 1) |
1630 |
|
{ |
1631 |
0 |
continue; |
1632 |
|
} |
1633 |
|
|
1634 |
0 |
for (int seqNo = 0; seqNo < seqs[pdbfnum].length; seqNo++) |
1635 |
|
{ |
1636 |
0 |
for (int m = 0; m < mapping.length; m++) |
1637 |
|
{ |
1638 |
0 |
final SequenceI seq = seqs[pdbfnum][seqNo]; |
1639 |
0 |
int sp = alignment.findIndex(seq); |
1640 |
0 |
StructureMapping structureMapping = mapping[m]; |
1641 |
0 |
if (structureMapping.getSequence() == seq && sp > -1) |
1642 |
|
{ |
1643 |
|
|
1644 |
|
|
1645 |
|
|
1646 |
|
|
1647 |
0 |
if (!visibleFeatures.isEmpty()) |
1648 |
|
{ |
1649 |
0 |
scanSequenceFeatures(visibleFeatures, structureMapping, seq, |
1650 |
|
theMap, modelId); |
1651 |
|
} |
1652 |
0 |
if (showLinkedFeatures) |
1653 |
|
{ |
1654 |
0 |
scanComplementFeatures(complementRenderer, structureMapping, |
1655 |
|
seq, theMap, modelId); |
1656 |
|
} |
1657 |
|
} |
1658 |
|
} |
1659 |
|
} |
1660 |
|
} |
1661 |
0 |
return theMap; |
1662 |
|
} |
1663 |
|
|
1664 |
|
|
1665 |
|
|
1666 |
|
|
1667 |
|
|
1668 |
|
@param |
1669 |
|
@return |
1670 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
1671 |
0 |
public boolean openSession(String filepath)... |
1672 |
|
{ |
1673 |
0 |
StructureCommandI cmd = getCommandGenerator().openSession(filepath); |
1674 |
0 |
if (cmd == null) |
1675 |
|
{ |
1676 |
0 |
return false; |
1677 |
|
} |
1678 |
0 |
executeCommand(cmd, true); |
1679 |
|
|
1680 |
0 |
return true; |
1681 |
|
} |
1682 |
|
|
1683 |
|
|
1684 |
|
|
1685 |
|
|
1686 |
|
|
1687 |
|
@param |
1688 |
|
@param |
1689 |
|
@param |
1690 |
|
@param |
1691 |
|
@param |
1692 |
|
|
|
|
| 0% |
Uncovered Elements: 33 (33) |
Complexity: 9 |
Complexity Density: 0.43 |
|
1693 |
0 |
protected static void scanComplementFeatures(... |
1694 |
|
FeatureRenderer complementRenderer, |
1695 |
|
StructureMapping structureMapping, SequenceI seq, |
1696 |
|
Map<String, Map<Object, AtomSpecModel>> theMap, |
1697 |
|
String modelNumber) |
1698 |
|
{ |
1699 |
|
|
1700 |
|
|
1701 |
|
|
1702 |
0 |
for (int seqPos : structureMapping.getMapping().keySet()) |
1703 |
|
{ |
1704 |
|
|
1705 |
|
|
1706 |
|
|
1707 |
0 |
MappedFeatures mf = complementRenderer |
1708 |
|
.findComplementFeaturesAtResidue(seq, seqPos); |
1709 |
0 |
if (mf != null) |
1710 |
|
{ |
1711 |
0 |
for (SequenceFeature sf : mf.features) |
1712 |
|
{ |
1713 |
0 |
String type = sf.getType(); |
1714 |
|
|
1715 |
|
|
1716 |
|
|
1717 |
|
|
1718 |
0 |
if (JalviewChimeraBinding.CHIMERA_FEATURE_GROUP |
1719 |
|
.equals(sf.getFeatureGroup())) |
1720 |
|
{ |
1721 |
0 |
continue; |
1722 |
|
} |
1723 |
|
|
1724 |
|
|
1725 |
|
|
1726 |
|
|
1727 |
|
|
1728 |
0 |
List<int[]> mappedRanges = structureMapping |
1729 |
|
.getPDBResNumRanges(seqPos, seqPos); |
1730 |
|
|
1731 |
0 |
if (!mappedRanges.isEmpty()) |
1732 |
|
{ |
1733 |
0 |
String value = sf.getDescription(); |
1734 |
0 |
if (value == null || value.length() == 0) |
1735 |
|
{ |
1736 |
0 |
value = type; |
1737 |
|
} |
1738 |
0 |
float score = sf.getScore(); |
1739 |
0 |
if (score != 0f && !Float.isNaN(score)) |
1740 |
|
{ |
1741 |
0 |
value = Float.toString(score); |
1742 |
|
} |
1743 |
0 |
Map<Object, AtomSpecModel> featureValues = theMap.get(type); |
1744 |
0 |
if (featureValues == null) |
1745 |
|
{ |
1746 |
0 |
featureValues = new HashMap<>(); |
1747 |
0 |
theMap.put(type, featureValues); |
1748 |
|
} |
1749 |
0 |
for (int[] range : mappedRanges) |
1750 |
|
{ |
1751 |
0 |
addAtomSpecRange(featureValues, value, modelNumber, range[0], |
1752 |
|
range[1], structureMapping.getChain()); |
1753 |
|
} |
1754 |
|
} |
1755 |
|
} |
1756 |
|
} |
1757 |
|
} |
1758 |
|
} |
1759 |
|
|
1760 |
|
|
1761 |
|
|
1762 |
|
|
1763 |
|
|
1764 |
|
|
1765 |
|
@param |
1766 |
|
@param |
1767 |
|
@param |
1768 |
|
@param |
1769 |
|
@param |
1770 |
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 8 |
Complexity Density: 0.42 |
|
1771 |
0 |
protected static void scanSequenceFeatures(List<String> visibleFeatures,... |
1772 |
|
StructureMapping mapping, SequenceI seq, |
1773 |
|
Map<String, Map<Object, AtomSpecModel>> theMap, String modelId) |
1774 |
|
{ |
1775 |
0 |
List<SequenceFeature> sfs = seq.getFeatures().getPositionalFeatures( |
1776 |
|
visibleFeatures.toArray(new String[visibleFeatures.size()])); |
1777 |
0 |
for (SequenceFeature sf : sfs) |
1778 |
|
{ |
1779 |
0 |
String type = sf.getType(); |
1780 |
|
|
1781 |
|
|
1782 |
|
|
1783 |
|
|
1784 |
0 |
if (JalviewChimeraBinding.CHIMERA_FEATURE_GROUP |
1785 |
|
.equals(sf.getFeatureGroup())) |
1786 |
|
{ |
1787 |
0 |
continue; |
1788 |
|
} |
1789 |
|
|
1790 |
0 |
List<int[]> mappedRanges = mapping.getPDBResNumRanges(sf.getBegin(), |
1791 |
|
sf.getEnd()); |
1792 |
|
|
1793 |
0 |
if (!mappedRanges.isEmpty()) |
1794 |
|
{ |
1795 |
0 |
String value = sf.getDescription(); |
1796 |
0 |
if (value == null || value.length() == 0) |
1797 |
|
{ |
1798 |
0 |
value = type; |
1799 |
|
} |
1800 |
0 |
float score = sf.getScore(); |
1801 |
0 |
if (score != 0f && !Float.isNaN(score)) |
1802 |
|
{ |
1803 |
0 |
value = Float.toString(score); |
1804 |
|
} |
1805 |
0 |
Map<Object, AtomSpecModel> featureValues = theMap.get(type); |
1806 |
0 |
if (featureValues == null) |
1807 |
|
{ |
1808 |
0 |
featureValues = new HashMap<>(); |
1809 |
0 |
theMap.put(type, featureValues); |
1810 |
|
} |
1811 |
0 |
for (int[] range : mappedRanges) |
1812 |
|
{ |
1813 |
0 |
addAtomSpecRange(featureValues, value, modelId, range[0], |
1814 |
|
range[1], mapping.getChain()); |
1815 |
|
} |
1816 |
|
} |
1817 |
|
} |
1818 |
|
} |
1819 |
|
|
1820 |
|
|
1821 |
|
|
1822 |
|
|
1823 |
|
|
1824 |
|
|
1825 |
|
@return |
1826 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1827 |
32 |
public int getMappedStructureCount()... |
1828 |
|
{ |
1829 |
32 |
String[] files = getStructureFiles(); |
1830 |
32 |
return files == null ? 0 : files.length; |
1831 |
|
} |
1832 |
|
|
1833 |
|
|
1834 |
|
|
1835 |
|
|
1836 |
|
|
1837 |
|
|
1838 |
|
|
1839 |
|
@param |
1840 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1841 |
0 |
protected void startExternalViewerMonitor(Process p)... |
1842 |
|
{ |
1843 |
0 |
externalViewerMonitor = new Thread(new Runnable() |
1844 |
|
{ |
1845 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
1846 |
0 |
@Override... |
1847 |
|
public void run() |
1848 |
|
{ |
1849 |
0 |
try |
1850 |
|
{ |
1851 |
0 |
p.waitFor(); |
1852 |
0 |
JalviewStructureDisplayI display = getViewer(); |
1853 |
0 |
if (display != null) |
1854 |
|
{ |
1855 |
0 |
display.closeViewer(false); |
1856 |
|
} |
1857 |
|
} catch (InterruptedException e) |
1858 |
|
{ |
1859 |
|
|
1860 |
|
} |
1861 |
|
} |
1862 |
|
}); |
1863 |
0 |
externalViewerMonitor.start(); |
1864 |
|
} |
1865 |
|
|
1866 |
|
|
1867 |
|
|
1868 |
|
|
1869 |
|
|
1870 |
|
|
1871 |
|
@param |
1872 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1873 |
0 |
protected void startListening(String uri)... |
1874 |
|
{ |
1875 |
0 |
List<StructureCommandI> commands = getCommandGenerator() |
1876 |
|
.startNotifications(uri); |
1877 |
0 |
if (commands != null) |
1878 |
|
{ |
1879 |
0 |
executeCommands(commands, false, null); |
1880 |
|
} |
1881 |
|
} |
1882 |
|
|
1883 |
|
|
1884 |
|
|
1885 |
|
|
1886 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1887 |
7 |
protected void stopListening()... |
1888 |
|
{ |
1889 |
7 |
List<StructureCommandI> commands = getCommandGenerator() |
1890 |
|
.stopNotifications(); |
1891 |
7 |
if (commands != null) |
1892 |
|
{ |
1893 |
0 |
executeCommands(commands, false, null); |
1894 |
|
} |
1895 |
|
} |
1896 |
|
|
1897 |
|
|
1898 |
|
|
1899 |
|
|
1900 |
|
|
1901 |
|
|
1902 |
|
@param |
1903 |
|
@param |
1904 |
|
@return |
1905 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
1906 |
0 |
public int copyStructureAttributesToFeatures(String attName,... |
1907 |
|
AlignmentPanel alignmentPanel) |
1908 |
|
{ |
1909 |
0 |
StructureCommandI cmd = getCommandGenerator() |
1910 |
|
.getResidueAttributes(attName); |
1911 |
0 |
if (cmd == null) |
1912 |
|
{ |
1913 |
0 |
return 0; |
1914 |
|
} |
1915 |
0 |
List<String> residueAttributes = executeCommand(cmd, true); |
1916 |
|
|
1917 |
0 |
int featuresAdded = createFeaturesForAttributes(attName, |
1918 |
|
residueAttributes); |
1919 |
0 |
if (featuresAdded > 0) |
1920 |
|
{ |
1921 |
0 |
alignmentPanel.getFeatureRenderer().featuresAdded(); |
1922 |
|
} |
1923 |
0 |
return featuresAdded; |
1924 |
|
} |
1925 |
|
|
1926 |
|
|
1927 |
|
|
1928 |
|
|
1929 |
|
|
1930 |
|
|
1931 |
|
|
1932 |
|
|
1933 |
|
|
1934 |
|
@param |
1935 |
|
@param |
1936 |
|
@return |
1937 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1938 |
0 |
protected int createFeaturesForAttributes(String attName,... |
1939 |
|
List<String> residueAttributes) |
1940 |
|
{ |
1941 |
0 |
return 0; |
1942 |
|
} |
1943 |
|
} |