1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ext.jmol; |
22 |
|
|
23 |
|
import jalview.api.AlignmentViewPanel; |
24 |
|
import jalview.api.FeatureRenderer; |
25 |
|
import jalview.api.SequenceRenderer; |
26 |
|
import jalview.datamodel.AlignmentI; |
27 |
|
import jalview.datamodel.HiddenColumns; |
28 |
|
import jalview.datamodel.PDBEntry; |
29 |
|
import jalview.datamodel.SequenceI; |
30 |
|
import jalview.gui.IProgressIndicator; |
31 |
|
import jalview.io.DataSourceType; |
32 |
|
import jalview.io.StructureFile; |
33 |
|
import jalview.schemes.ColourSchemeI; |
34 |
|
import jalview.schemes.ResidueProperties; |
35 |
|
import jalview.structure.AtomSpec; |
36 |
|
import jalview.structure.StructureMappingcommandSet; |
37 |
|
import jalview.structure.StructureSelectionManager; |
38 |
|
import jalview.structures.models.AAStructureBindingModel; |
39 |
|
import jalview.util.MessageManager; |
40 |
|
|
41 |
|
import java.awt.Color; |
42 |
|
import java.awt.Container; |
43 |
|
import java.awt.event.ComponentEvent; |
44 |
|
import java.awt.event.ComponentListener; |
45 |
|
import java.io.File; |
46 |
|
import java.net.URL; |
47 |
|
import java.security.AccessControlException; |
48 |
|
import java.util.ArrayList; |
49 |
|
import java.util.BitSet; |
50 |
|
import java.util.Hashtable; |
51 |
|
import java.util.List; |
52 |
|
import java.util.Map; |
53 |
|
import java.util.Vector; |
54 |
|
|
55 |
|
import org.jmol.adapter.smarter.SmarterJmolAdapter; |
56 |
|
import org.jmol.api.JmolAppConsoleInterface; |
57 |
|
import org.jmol.api.JmolSelectionListener; |
58 |
|
import org.jmol.api.JmolStatusListener; |
59 |
|
import org.jmol.api.JmolViewer; |
60 |
|
import org.jmol.c.CBK; |
61 |
|
import org.jmol.script.T; |
62 |
|
import org.jmol.viewer.Viewer; |
63 |
|
|
|
|
| 48.3% |
Uncovered Elements: 362 (700) |
Complexity: 194 |
Complexity Density: 0.43 |
|
64 |
|
public abstract class JalviewJmolBinding extends AAStructureBindingModel |
65 |
|
implements JmolStatusListener, JmolSelectionListener, |
66 |
|
ComponentListener |
67 |
|
{ |
68 |
|
boolean allChainsSelected = false; |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
private boolean associateNewStructs = false; |
75 |
|
|
76 |
|
Vector<String> atomsPicked = new Vector<>(); |
77 |
|
|
78 |
|
private List<String> chainNames; |
79 |
|
|
80 |
|
Hashtable<String, String> chainFile; |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
int frameNo = 0; |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
String lastCommand; |
91 |
|
|
92 |
|
String lastMessage; |
93 |
|
|
94 |
|
boolean loadedInline; |
95 |
|
|
96 |
|
StringBuffer resetLastRes = new StringBuffer(); |
97 |
|
|
98 |
|
public Viewer viewer; |
99 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
10 |
public JalviewJmolBinding(StructureSelectionManager ssm,... |
101 |
|
PDBEntry[] pdbentry, SequenceI[][] sequenceIs, |
102 |
|
DataSourceType protocol) |
103 |
|
{ |
104 |
10 |
super(ssm, pdbentry, sequenceIs, protocol); |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
} |
113 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
114 |
0 |
public JalviewJmolBinding(StructureSelectionManager ssm,... |
115 |
|
SequenceI[][] seqs, Viewer theViewer) |
116 |
|
{ |
117 |
0 |
super(ssm, seqs); |
118 |
|
|
119 |
0 |
viewer = theViewer; |
120 |
0 |
viewer.setJmolStatusListener(this); |
121 |
0 |
viewer.addSelectionListener(this); |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
@return |
129 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
130 |
10 |
public String getViewerTitle()... |
131 |
|
{ |
132 |
10 |
return getViewerTitle("Jmol", true); |
133 |
|
} |
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
@param |
140 |
|
|
141 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.36 |
|
142 |
0 |
public void centerViewer(Vector<String> chainList)... |
143 |
|
{ |
144 |
0 |
StringBuilder cmd = new StringBuilder(128); |
145 |
0 |
int mlength, p; |
146 |
0 |
for (String lbl : chainList) |
147 |
|
{ |
148 |
0 |
mlength = 0; |
149 |
0 |
do |
150 |
|
{ |
151 |
0 |
p = mlength; |
152 |
0 |
mlength = lbl.indexOf(":", p); |
153 |
0 |
} while (p < mlength && mlength < (lbl.length() - 2)); |
154 |
|
|
155 |
0 |
cmd.append(":" + lbl.substring(mlength + 1) + " /" |
156 |
|
+ (1 + getModelNum(chainFile.get(lbl))) + " or "); |
157 |
|
} |
158 |
0 |
if (cmd.length() > 0) |
159 |
|
{ |
160 |
0 |
cmd.setLength(cmd.length() - 4); |
161 |
|
} |
162 |
0 |
evalStateCommand("select *;restrict " + cmd + ";cartoon;center " + cmd); |
163 |
|
} |
164 |
|
|
|
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
165 |
10 |
public void closeViewer()... |
166 |
|
{ |
167 |
|
|
168 |
10 |
getSsm().removeStructureViewerListener(this, this.getStructureFiles()); |
169 |
10 |
if (viewer != null) |
170 |
10 |
viewer.dispose(); |
171 |
10 |
lastCommand = null; |
172 |
10 |
viewer = null; |
173 |
10 |
releaseUIResources(); |
174 |
|
} |
175 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
176 |
0 |
@Override... |
177 |
|
public void colourByChain() |
178 |
|
{ |
179 |
0 |
colourBySequence = false; |
180 |
|
|
181 |
|
|
182 |
|
|
183 |
0 |
evalStateCommand("select *;color chain"); |
184 |
|
} |
185 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
186 |
0 |
@Override... |
187 |
|
public void colourByCharge() |
188 |
|
{ |
189 |
0 |
colourBySequence = false; |
190 |
0 |
evalStateCommand("select *;color white;select ASP,GLU;color red;" |
191 |
|
+ "select LYS,ARG;color blue;select CYS;color yellow"); |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
198 |
0 |
public void superposeStructures(AlignmentI alignment)... |
199 |
|
{ |
200 |
0 |
superposeStructures(alignment, -1, null); |
201 |
|
} |
202 |
|
|
203 |
|
|
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
@param |
208 |
|
|
209 |
|
|
210 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
211 |
0 |
public void superposeStructures(AlignmentI alignment, int refStructure)... |
212 |
|
{ |
213 |
0 |
superposeStructures(alignment, refStructure, null); |
214 |
|
} |
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
@param |
221 |
|
|
222 |
|
|
223 |
|
@param |
224 |
|
|
225 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
226 |
0 |
public void superposeStructures(AlignmentI alignment, int refStructure,... |
227 |
|
HiddenColumns hiddenCols) |
228 |
|
{ |
229 |
0 |
superposeStructures(new AlignmentI[] { alignment }, |
230 |
|
new int[] |
231 |
|
{ refStructure }, new HiddenColumns[] { hiddenCols }); |
232 |
|
} |
233 |
|
|
234 |
|
|
235 |
|
@inheritDoc |
236 |
|
|
|
|
| 76.4% |
Uncovered Elements: 34 (144) |
Complexity: 31 |
Complexity Density: 0.32 |
|
237 |
1 |
@Override... |
238 |
|
public String superposeStructures(AlignmentI[] _alignment, |
239 |
|
int[] _refStructure, HiddenColumns[] _hiddenCols) |
240 |
|
{ |
241 |
1 |
while (viewer.isScriptExecuting()) |
242 |
|
{ |
243 |
0 |
try |
244 |
|
{ |
245 |
0 |
Thread.sleep(10); |
246 |
|
} catch (InterruptedException i) |
247 |
|
{ |
248 |
|
} |
249 |
|
} |
250 |
|
|
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
|
255 |
1 |
String[] files = getStructureFiles(); |
256 |
1 |
if (!waitForFileLoad(files)) |
257 |
|
{ |
258 |
0 |
return null; |
259 |
|
} |
260 |
|
|
261 |
1 |
StringBuilder selectioncom = new StringBuilder(256); |
262 |
|
|
263 |
|
|
264 |
1 |
String nSeconds = " "; |
265 |
1 |
if (files.length > 10) |
266 |
|
{ |
267 |
0 |
nSeconds = " 0.005 "; |
268 |
|
} |
269 |
|
else |
270 |
|
{ |
271 |
1 |
nSeconds = " " + (2.0 / files.length) + " "; |
272 |
|
|
273 |
|
} |
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
|
279 |
1 |
for (int a = 0; a < _alignment.length; a++) |
280 |
|
{ |
281 |
1 |
int refStructure = _refStructure[a]; |
282 |
1 |
AlignmentI alignment = _alignment[a]; |
283 |
1 |
HiddenColumns hiddenCols = _hiddenCols[a]; |
284 |
1 |
if (a > 0 && selectioncom.length() > 0 && !selectioncom |
285 |
|
.substring(selectioncom.length() - 1).equals("|")) |
286 |
|
{ |
287 |
0 |
selectioncom.append("|"); |
288 |
|
} |
289 |
|
|
290 |
1 |
if (refStructure >= files.length) |
291 |
|
{ |
292 |
0 |
System.err.println( |
293 |
|
"Invalid reference structure value " + refStructure); |
294 |
0 |
refStructure = -1; |
295 |
|
} |
296 |
|
|
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
1 |
BitSet matched = new BitSet(); |
302 |
298 |
for (int m = 0; m < alignment.getWidth(); m++) |
303 |
|
{ |
304 |
297 |
if (hiddenCols == null || hiddenCols.isVisible(m)) |
305 |
|
{ |
306 |
297 |
matched.set(m); |
307 |
|
} |
308 |
|
} |
309 |
|
|
310 |
1 |
SuperposeData[] structures = new SuperposeData[files.length]; |
311 |
3 |
for (int f = 0; f < files.length; f++) |
312 |
|
{ |
313 |
2 |
structures[f] = new SuperposeData(alignment.getWidth()); |
314 |
|
} |
315 |
|
|
316 |
|
|
317 |
|
|
318 |
|
|
319 |
|
|
320 |
1 |
int candidateRefStructure = findSuperposableResidues(alignment, |
321 |
|
matched, structures); |
322 |
1 |
if (refStructure < 0) |
323 |
|
{ |
324 |
|
|
325 |
|
|
326 |
|
|
327 |
|
|
328 |
1 |
refStructure = candidateRefStructure; |
329 |
|
} |
330 |
|
|
331 |
1 |
String[] selcom = new String[files.length]; |
332 |
1 |
int nmatched = matched.cardinality(); |
333 |
1 |
if (nmatched < 4) |
334 |
|
{ |
335 |
0 |
return (MessageManager.formatMessage("label.insufficient_residues", |
336 |
|
nmatched)); |
337 |
|
} |
338 |
|
|
339 |
|
|
340 |
|
|
341 |
|
|
342 |
|
{ |
343 |
|
|
344 |
3 |
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) |
345 |
|
{ |
346 |
2 |
String chainCd = ":" + structures[pdbfnum].chain; |
347 |
2 |
int lpos = -1; |
348 |
2 |
boolean run = false; |
349 |
2 |
StringBuilder molsel = new StringBuilder(); |
350 |
2 |
molsel.append("{"); |
351 |
|
|
352 |
2 |
int nextColumnMatch = matched.nextSetBit(0); |
353 |
594 |
while (nextColumnMatch != -1) |
354 |
|
{ |
355 |
592 |
int pdbResNo = structures[pdbfnum].pdbResNo[nextColumnMatch]; |
356 |
592 |
if (lpos != pdbResNo - 1) |
357 |
|
{ |
358 |
|
|
359 |
2 |
if (lpos != -1) |
360 |
|
{ |
361 |
0 |
molsel.append(lpos); |
362 |
0 |
molsel.append(chainCd); |
363 |
0 |
molsel.append("|"); |
364 |
|
} |
365 |
2 |
run = false; |
366 |
|
} |
367 |
|
else |
368 |
|
{ |
369 |
|
|
370 |
590 |
if (!run) |
371 |
|
{ |
372 |
|
|
373 |
2 |
molsel.append(lpos); |
374 |
2 |
molsel.append("-"); |
375 |
|
} |
376 |
590 |
run = true; |
377 |
|
} |
378 |
592 |
lpos = pdbResNo; |
379 |
592 |
nextColumnMatch = matched.nextSetBit(nextColumnMatch + 1); |
380 |
|
} |
381 |
|
|
382 |
|
|
383 |
|
|
384 |
2 |
if (lpos != -1) |
385 |
|
{ |
386 |
2 |
molsel.append(lpos); |
387 |
2 |
molsel.append(chainCd); |
388 |
2 |
molsel.append("}"); |
389 |
|
} |
390 |
2 |
if (molsel.length() > 1) |
391 |
|
{ |
392 |
2 |
selcom[pdbfnum] = molsel.toString(); |
393 |
2 |
selectioncom.append("(("); |
394 |
2 |
selectioncom.append(selcom[pdbfnum].substring(1, |
395 |
|
selcom[pdbfnum].length() - 1)); |
396 |
2 |
selectioncom.append(" )& "); |
397 |
2 |
selectioncom.append(pdbfnum + 1); |
398 |
2 |
selectioncom.append(".1)"); |
399 |
2 |
if (pdbfnum < files.length - 1) |
400 |
|
{ |
401 |
1 |
selectioncom.append("|"); |
402 |
|
} |
403 |
|
} |
404 |
|
else |
405 |
|
{ |
406 |
0 |
selcom[pdbfnum] = null; |
407 |
|
} |
408 |
|
} |
409 |
|
} |
410 |
1 |
StringBuilder command = new StringBuilder(256); |
411 |
|
|
412 |
|
|
413 |
3 |
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) |
414 |
|
{ |
415 |
2 |
if (pdbfnum == refStructure || selcom[pdbfnum] == null |
416 |
|
|| selcom[refStructure] == null) |
417 |
|
{ |
418 |
1 |
continue; |
419 |
|
} |
420 |
1 |
command.append("echo "); |
421 |
1 |
command.append("\"Superposing ("); |
422 |
1 |
command.append(structures[pdbfnum].pdbId); |
423 |
1 |
command.append(") against reference ("); |
424 |
1 |
command.append(structures[refStructure].pdbId); |
425 |
1 |
command.append(")\";\ncompare " + nSeconds); |
426 |
1 |
command.append("{"); |
427 |
1 |
command.append(Integer.toString(1 + pdbfnum)); |
428 |
1 |
command.append(".1} {"); |
429 |
1 |
command.append(Integer.toString(1 + refStructure)); |
430 |
|
|
431 |
1 |
command.append( |
432 |
|
".1} SUBSET {(*.CA | *.P) and conformation=1} ATOMS "); |
433 |
|
|
434 |
|
|
435 |
|
|
436 |
|
|
437 |
|
|
438 |
1 |
command.append(selcom[pdbfnum]); |
439 |
1 |
command.append(selcom[refStructure]); |
440 |
1 |
command.append(" ROTATE TRANSLATE;\n"); |
441 |
|
} |
442 |
1 |
if (selectioncom.length() > 0) |
443 |
|
{ |
444 |
|
|
445 |
|
|
446 |
1 |
evalStateCommand("select *; cartoons off; backbone; select (" |
447 |
|
+ selectioncom.toString() + "); cartoons; "); |
448 |
|
|
449 |
1 |
String cmdString = command.toString(); |
450 |
|
|
451 |
|
|
452 |
1 |
evalStateCommand(cmdString); |
453 |
|
} |
454 |
|
} |
455 |
0 |
if (selectioncom.length() > 0) |
456 |
|
{ |
457 |
0 |
if (selectioncom.substring(selectioncom.length() - 1).equals("|")) |
458 |
|
{ |
459 |
0 |
selectioncom.setLength(selectioncom.length() - 1); |
460 |
|
} |
461 |
|
|
462 |
0 |
evalStateCommand("select *; cartoons off; backbone; select (" |
463 |
|
+ selectioncom.toString() + "); cartoons; "); |
464 |
|
|
465 |
|
|
466 |
|
} |
467 |
|
|
468 |
0 |
return null; |
469 |
|
} |
470 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
471 |
34 |
public void evalStateCommand(String command)... |
472 |
|
{ |
473 |
34 |
jmolHistory(false); |
474 |
34 |
if (lastCommand == null || !lastCommand.equals(command)) |
475 |
|
{ |
476 |
28 |
jmolScript(command + "\n"); |
477 |
|
} |
478 |
34 |
jmolHistory(true); |
479 |
33 |
lastCommand = command; |
480 |
|
} |
481 |
|
|
482 |
|
Thread colourby = null; |
483 |
|
|
484 |
|
|
485 |
|
|
486 |
|
@param |
487 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
488 |
9 |
@Override... |
489 |
|
protected void colourBySequence( |
490 |
|
final StructureMappingcommandSet[] colourBySequenceCommands) |
491 |
|
{ |
492 |
9 |
if (colourby != null) |
493 |
|
{ |
494 |
7 |
colourby.interrupt(); |
495 |
7 |
colourby = null; |
496 |
|
} |
497 |
9 |
colourby = new Thread(new Runnable() |
498 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
499 |
9 |
@Override... |
500 |
|
public void run() |
501 |
|
{ |
502 |
9 |
for (StructureMappingcommandSet cpdbbyseq : colourBySequenceCommands) |
503 |
|
{ |
504 |
11 |
for (String cbyseq : cpdbbyseq.commands) |
505 |
|
{ |
506 |
11 |
executeWhenReady(cbyseq); |
507 |
|
} |
508 |
|
} |
509 |
|
} |
510 |
|
}); |
511 |
9 |
colourby.start(); |
512 |
|
} |
513 |
|
|
514 |
|
|
515 |
|
@param |
516 |
|
@param |
517 |
|
@param |
518 |
|
@return |
519 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
520 |
9 |
@Override... |
521 |
|
protected StructureMappingcommandSet[] getColourBySequenceCommands( |
522 |
|
String[] files, SequenceRenderer sr, AlignmentViewPanel viewPanel) |
523 |
|
{ |
524 |
9 |
return JmolCommands.getColourBySequenceCommand(getSsm(), files, |
525 |
|
getSequence(), sr, viewPanel); |
526 |
|
} |
527 |
|
|
528 |
|
|
529 |
|
@param |
530 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
531 |
11 |
protected void executeWhenReady(String command)... |
532 |
|
{ |
533 |
11 |
evalStateCommand(command); |
534 |
|
} |
535 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
536 |
0 |
public void createImage(String file, String type, int quality)... |
537 |
|
{ |
538 |
0 |
System.out.println("JMOL CREATE IMAGE"); |
539 |
|
} |
540 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
541 |
0 |
@Override... |
542 |
|
public String createImage(String fileName, String type, |
543 |
|
Object textOrBytes, int quality) |
544 |
|
{ |
545 |
0 |
System.out.println("JMOL CREATE IMAGE"); |
546 |
0 |
return null; |
547 |
|
} |
548 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
549 |
0 |
@Override... |
550 |
|
public String eval(String strEval) |
551 |
|
{ |
552 |
|
|
553 |
|
|
554 |
0 |
return null; |
555 |
|
} |
556 |
|
|
557 |
|
|
558 |
|
|
559 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
560 |
0 |
@Override... |
561 |
|
public float[][] functionXY(String functionName, int x, int y) |
562 |
|
{ |
563 |
0 |
return null; |
564 |
|
} |
565 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
566 |
0 |
@Override... |
567 |
|
public float[][][] functionXYZ(String functionName, int nx, int ny, |
568 |
|
int nz) |
569 |
|
{ |
570 |
|
|
571 |
0 |
return null; |
572 |
|
} |
573 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
574 |
0 |
public Color getColour(int atomIndex, int pdbResNum, String chain,... |
575 |
|
String pdbfile) |
576 |
|
{ |
577 |
0 |
if (getModelNum(pdbfile) < 0) |
578 |
|
{ |
579 |
0 |
return null; |
580 |
|
} |
581 |
|
|
582 |
|
|
583 |
0 |
int colour = viewer.ms.at[atomIndex].atomPropertyInt(T.color); |
584 |
0 |
return new Color(colour); |
585 |
|
} |
586 |
|
|
587 |
|
|
588 |
|
|
589 |
|
|
590 |
|
|
591 |
|
|
592 |
|
public abstract void refreshPdbEntries(); |
593 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
594 |
0 |
private int getModelNum(String modelFileName)... |
595 |
|
{ |
596 |
0 |
String[] mfn = getStructureFiles(); |
597 |
0 |
if (mfn == null) |
598 |
|
{ |
599 |
0 |
return -1; |
600 |
|
} |
601 |
0 |
for (int i = 0; i < mfn.length; i++) |
602 |
|
{ |
603 |
0 |
if (mfn[i].equalsIgnoreCase(modelFileName)) |
604 |
|
{ |
605 |
0 |
return i; |
606 |
|
} |
607 |
|
} |
608 |
0 |
return -1; |
609 |
|
} |
610 |
|
|
611 |
|
|
612 |
|
|
613 |
|
|
614 |
|
|
615 |
|
|
616 |
|
private int _modelFileNameMap[]; |
617 |
|
|
618 |
|
|
619 |
|
|
620 |
|
|
|
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 10 |
Complexity Density: 0.36 |
|
621 |
0 |
public synchronized String[] getPdbFilex()... |
622 |
|
{ |
623 |
0 |
if (viewer == null) |
624 |
|
{ |
625 |
0 |
return new String[0]; |
626 |
|
} |
627 |
0 |
if (modelFileNames == null) |
628 |
|
{ |
629 |
0 |
List<String> mset = new ArrayList<>(); |
630 |
0 |
_modelFileNameMap = new int[viewer.ms.mc]; |
631 |
0 |
String m = viewer.ms.getModelFileName(0); |
632 |
0 |
if (m != null) |
633 |
|
{ |
634 |
0 |
String filePath = m; |
635 |
0 |
try |
636 |
|
{ |
637 |
0 |
filePath = new File(m).getAbsolutePath(); |
638 |
|
} catch (AccessControlException x) |
639 |
|
{ |
640 |
|
|
641 |
0 |
System.err.println( |
642 |
|
"jmolBinding: Using local file string from Jmol: " + m); |
643 |
|
} |
644 |
0 |
if (filePath.indexOf("/file:") != -1) |
645 |
|
{ |
646 |
|
|
647 |
0 |
filePath = m; |
648 |
|
} |
649 |
0 |
mset.add(filePath); |
650 |
0 |
_modelFileNameMap[0] = 0; |
651 |
|
} |
652 |
0 |
int j = 1; |
653 |
0 |
for (int i = 1; i < viewer.ms.mc; i++) |
654 |
|
{ |
655 |
0 |
m = viewer.ms.getModelFileName(i); |
656 |
0 |
String filePath = m; |
657 |
0 |
if (m != null) |
658 |
|
{ |
659 |
0 |
try |
660 |
|
{ |
661 |
0 |
filePath = new File(m).getAbsolutePath(); |
662 |
|
} catch (AccessControlException x) |
663 |
|
{ |
664 |
|
|
665 |
|
|
666 |
|
|
667 |
|
} |
668 |
|
} |
669 |
|
|
670 |
|
|
671 |
|
|
672 |
|
|
673 |
|
|
674 |
0 |
if (!mset.contains(filePath)) |
675 |
|
{ |
676 |
0 |
mset.add(filePath); |
677 |
0 |
_modelFileNameMap[j] = i; |
678 |
0 |
j++; |
679 |
|
} |
680 |
|
} |
681 |
0 |
modelFileNames = mset.toArray(new String[mset.size()]); |
682 |
|
} |
683 |
0 |
return modelFileNames; |
684 |
|
} |
685 |
|
|
|
|
| 95% |
Uncovered Elements: 1 (20) |
Complexity: 5 |
Complexity Density: 0.42 |
|
686 |
52 |
@Override... |
687 |
|
public synchronized String[] getStructureFiles() |
688 |
|
{ |
689 |
52 |
List<String> mset = new ArrayList<>(); |
690 |
52 |
if (viewer == null) |
691 |
|
{ |
692 |
2 |
return new String[0]; |
693 |
|
} |
694 |
|
|
695 |
50 |
if (modelFileNames == null) |
696 |
|
{ |
697 |
11 |
int modelCount = viewer.ms.mc; |
698 |
11 |
String filePath = null; |
699 |
23 |
for (int i = 0; i < modelCount; ++i) |
700 |
|
{ |
701 |
12 |
filePath = viewer.ms.getModelFileName(i); |
702 |
12 |
if (!mset.contains(filePath)) |
703 |
|
{ |
704 |
12 |
mset.add(filePath); |
705 |
|
} |
706 |
|
} |
707 |
11 |
modelFileNames = mset.toArray(new String[mset.size()]); |
708 |
|
} |
709 |
|
|
710 |
50 |
return modelFileNames; |
711 |
|
} |
712 |
|
|
713 |
|
|
714 |
|
|
715 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
716 |
0 |
@Override... |
717 |
|
public Map<String, Object> getRegistryInfo() |
718 |
|
{ |
719 |
|
|
720 |
0 |
return null; |
721 |
|
} |
722 |
|
|
723 |
|
|
724 |
|
|
725 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
726 |
0 |
public void handlePopupMenu(int x, int y)... |
727 |
|
{ |
728 |
|
|
729 |
|
|
730 |
|
} |
731 |
|
|
732 |
|
|
733 |
|
|
734 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
735 |
0 |
@Override... |
736 |
|
public void highlightAtoms(List<AtomSpec> atoms) |
737 |
|
{ |
738 |
0 |
if (atoms != null) |
739 |
|
{ |
740 |
0 |
if (resetLastRes.length() > 0) |
741 |
|
{ |
742 |
0 |
jmolScript(resetLastRes.toString()); |
743 |
0 |
resetLastRes.setLength(0); |
744 |
|
} |
745 |
0 |
for (AtomSpec atom : atoms) |
746 |
|
{ |
747 |
0 |
highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(), |
748 |
|
atom.getChain(), atom.getPdbFile()); |
749 |
|
} |
750 |
|
} |
751 |
|
} |
752 |
|
|
753 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 6 |
Complexity Density: 0.26 |
|
754 |
0 |
public void highlightAtom(int atomIndex, int pdbResNum, String chain,... |
755 |
|
String pdbfile) |
756 |
|
{ |
757 |
0 |
if (modelFileNames == null) |
758 |
|
{ |
759 |
0 |
return; |
760 |
|
} |
761 |
|
|
762 |
|
|
763 |
0 |
int mdlNum = 0; |
764 |
|
|
765 |
0 |
while (mdlNum < modelFileNames.length |
766 |
|
&& !pdbfile.equals(modelFileNames[mdlNum])) |
767 |
|
{ |
768 |
0 |
mdlNum++; |
769 |
|
} |
770 |
0 |
if (mdlNum == modelFileNames.length) |
771 |
|
{ |
772 |
0 |
return; |
773 |
|
} |
774 |
|
|
775 |
0 |
jmolHistory(false); |
776 |
|
|
777 |
0 |
StringBuilder cmd = new StringBuilder(64); |
778 |
0 |
cmd.append("select " + pdbResNum); |
779 |
|
|
780 |
0 |
resetLastRes.append("select " + pdbResNum); |
781 |
|
|
782 |
0 |
cmd.append(":"); |
783 |
0 |
resetLastRes.append(":"); |
784 |
0 |
if (!chain.equals(" ")) |
785 |
|
{ |
786 |
0 |
cmd.append(chain); |
787 |
0 |
resetLastRes.append(chain); |
788 |
|
} |
789 |
|
{ |
790 |
0 |
cmd.append(" /" + (mdlNum + 1)); |
791 |
0 |
resetLastRes.append("/" + (mdlNum + 1)); |
792 |
|
} |
793 |
0 |
cmd.append(";wireframe 100;" + cmd.toString() + " and not hetero;"); |
794 |
|
|
795 |
0 |
resetLastRes.append(";wireframe 0;" + resetLastRes.toString() |
796 |
|
+ " and not hetero; spacefill 0;"); |
797 |
|
|
798 |
0 |
cmd.append("spacefill 200;select none"); |
799 |
|
|
800 |
0 |
jmolScript(cmd.toString()); |
801 |
0 |
jmolHistory(true); |
802 |
|
|
803 |
|
} |
804 |
|
|
805 |
|
boolean debug = true; |
806 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 3 |
Complexity Density: 3 |
|
807 |
68 |
private void jmolHistory(boolean enable)... |
808 |
|
{ |
809 |
68 |
jmolScript("History " + ((debug || enable) ? "on" : "off")); |
810 |
|
} |
811 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
812 |
0 |
public void loadInline(String string)... |
813 |
|
{ |
814 |
0 |
loadedInline = true; |
815 |
|
|
816 |
|
|
817 |
|
|
818 |
|
|
819 |
|
|
820 |
|
|
821 |
|
|
822 |
|
|
823 |
0 |
viewer.openStringInline(string); |
824 |
|
} |
825 |
|
|
|
|
| 58.3% |
Uncovered Elements: 25 (60) |
Complexity: 17 |
Complexity Density: 0.47 |
|
826 |
1 |
public void mouseOverStructure(int atomIndex, String strInfo)... |
827 |
|
{ |
828 |
1 |
int pdbResNum; |
829 |
1 |
int alocsep = strInfo.indexOf("^"); |
830 |
1 |
int mdlSep = strInfo.indexOf("/"); |
831 |
1 |
int chainSeparator = strInfo.indexOf(":"), chainSeparator1 = -1; |
832 |
|
|
833 |
1 |
if (chainSeparator == -1) |
834 |
|
{ |
835 |
0 |
chainSeparator = strInfo.indexOf("."); |
836 |
0 |
if (mdlSep > -1 && mdlSep < chainSeparator) |
837 |
|
{ |
838 |
0 |
chainSeparator1 = chainSeparator; |
839 |
0 |
chainSeparator = mdlSep; |
840 |
|
} |
841 |
|
} |
842 |
|
|
843 |
1 |
if (alocsep != -1) |
844 |
|
{ |
845 |
0 |
pdbResNum = Integer.parseInt( |
846 |
|
strInfo.substring(strInfo.indexOf("]") + 1, alocsep)); |
847 |
|
|
848 |
|
} |
849 |
|
else |
850 |
|
{ |
851 |
1 |
pdbResNum = Integer.parseInt( |
852 |
|
strInfo.substring(strInfo.indexOf("]") + 1, chainSeparator)); |
853 |
|
} |
854 |
1 |
String chainId; |
855 |
|
|
856 |
1 |
if (strInfo.indexOf(":") > -1) |
857 |
|
{ |
858 |
1 |
chainId = strInfo.substring(strInfo.indexOf(":") + 1, |
859 |
|
strInfo.indexOf(".")); |
860 |
|
} |
861 |
|
else |
862 |
|
{ |
863 |
0 |
chainId = " "; |
864 |
|
} |
865 |
|
|
866 |
1 |
String pdbfilename = modelFileNames[frameNo]; |
867 |
|
|
868 |
1 |
if (mdlSep > -1) |
869 |
|
{ |
870 |
1 |
if (chainSeparator1 == -1) |
871 |
|
{ |
872 |
1 |
chainSeparator1 = strInfo.indexOf(".", mdlSep); |
873 |
|
} |
874 |
1 |
String mdlId = (chainSeparator1 > -1) |
875 |
|
? strInfo.substring(mdlSep + 1, chainSeparator1) |
876 |
|
: strInfo.substring(mdlSep + 1); |
877 |
1 |
try |
878 |
|
{ |
879 |
|
|
880 |
1 |
int mnumber = new Integer(mdlId).intValue() - 1; |
881 |
1 |
if (_modelFileNameMap != null) |
882 |
|
{ |
883 |
0 |
int _mp = _modelFileNameMap.length - 1; |
884 |
|
|
885 |
0 |
while (mnumber < _modelFileNameMap[_mp]) |
886 |
|
{ |
887 |
0 |
_mp--; |
888 |
|
} |
889 |
0 |
pdbfilename = modelFileNames[_mp]; |
890 |
|
} |
891 |
|
else |
892 |
|
{ |
893 |
1 |
if (mnumber >= 0 && mnumber < modelFileNames.length) |
894 |
|
{ |
895 |
1 |
pdbfilename = modelFileNames[mnumber]; |
896 |
|
} |
897 |
|
|
898 |
1 |
if (pdbfilename == null) |
899 |
|
{ |
900 |
0 |
pdbfilename = new File(viewer.ms.getModelFileName(mnumber)) |
901 |
|
.getAbsolutePath(); |
902 |
|
} |
903 |
|
} |
904 |
|
} catch (Exception e) |
905 |
|
{ |
906 |
|
} |
907 |
1 |
; |
908 |
|
} |
909 |
1 |
if (lastMessage == null || !lastMessage.equals(strInfo)) |
910 |
|
{ |
911 |
1 |
getSsm().mouseOverStructure(pdbResNum, chainId, pdbfilename); |
912 |
|
} |
913 |
|
|
914 |
1 |
lastMessage = strInfo; |
915 |
|
} |
916 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
917 |
0 |
public void notifyAtomHovered(int atomIndex, String strInfo, String data)... |
918 |
|
{ |
919 |
0 |
if (data != null) |
920 |
|
{ |
921 |
0 |
System.err.println("Ignoring additional hover info: " + data |
922 |
|
+ " (other info: '" + strInfo + "' pos " + atomIndex + ")"); |
923 |
|
} |
924 |
0 |
mouseOverStructure(atomIndex, strInfo); |
925 |
|
} |
926 |
|
|
927 |
|
|
928 |
|
|
929 |
|
|
930 |
|
|
931 |
|
|
932 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 6 |
Complexity Density: 0.3 |
|
933 |
0 |
public void notifyAtomPicked(int atomIndex, String strInfo,... |
934 |
|
String strData) |
935 |
|
{ |
936 |
|
|
937 |
|
|
938 |
|
|
939 |
|
|
940 |
0 |
if (strData != null) |
941 |
|
{ |
942 |
0 |
System.err.println("Ignoring additional pick data string " + strData); |
943 |
|
} |
944 |
0 |
int chainSeparator = strInfo.indexOf(":"); |
945 |
0 |
int p = 0; |
946 |
0 |
if (chainSeparator == -1) |
947 |
|
{ |
948 |
0 |
chainSeparator = strInfo.indexOf("."); |
949 |
|
} |
950 |
|
|
951 |
0 |
String picked = strInfo.substring(strInfo.indexOf("]") + 1, |
952 |
|
chainSeparator); |
953 |
0 |
String mdlString = ""; |
954 |
0 |
if ((p = strInfo.indexOf(":")) > -1) |
955 |
|
{ |
956 |
0 |
picked += strInfo.substring(p, strInfo.indexOf(".")); |
957 |
|
} |
958 |
|
|
959 |
0 |
if ((p = strInfo.indexOf("/")) > -1) |
960 |
|
{ |
961 |
0 |
mdlString += strInfo.substring(p, strInfo.indexOf(" #")); |
962 |
|
} |
963 |
0 |
picked = "((" + picked + ".CA" + mdlString + ")|(" + picked + ".P" |
964 |
|
+ mdlString + "))"; |
965 |
0 |
jmolHistory(false); |
966 |
|
|
967 |
0 |
if (!atomsPicked.contains(picked)) |
968 |
|
{ |
969 |
0 |
jmolScript("select " + picked + ";label %n %r:%c"); |
970 |
0 |
atomsPicked.addElement(picked); |
971 |
|
} |
972 |
|
else |
973 |
|
{ |
974 |
0 |
viewer.evalString("select " + picked + ";label off"); |
975 |
0 |
atomsPicked.removeElement(picked); |
976 |
|
} |
977 |
0 |
jmolHistory(true); |
978 |
|
|
979 |
|
|
980 |
|
|
981 |
|
|
982 |
|
|
983 |
|
|
984 |
|
|
985 |
|
|
986 |
|
} |
987 |
|
|
|
|
| 41.2% |
Uncovered Elements: 20 (34) |
Complexity: 14 |
Complexity Density: 0.44 |
|
988 |
359 |
@Override... |
989 |
|
public void notifyCallback(CBK type, Object[] data) |
990 |
|
{ |
991 |
359 |
try |
992 |
|
{ |
993 |
359 |
switch (type) |
994 |
|
{ |
995 |
11 |
case LOADSTRUCT: |
996 |
11 |
notifyFileLoaded((String) data[1], (String) data[2], |
997 |
|
(String) data[3], (String) data[4], |
998 |
|
((Integer) data[5]).intValue()); |
999 |
|
|
1000 |
11 |
break; |
1001 |
0 |
case PICK: |
1002 |
0 |
notifyAtomPicked(((Integer) data[2]).intValue(), (String) data[1], |
1003 |
|
(String) data[0]); |
1004 |
|
|
1005 |
|
|
1006 |
0 |
case HOVER: |
1007 |
0 |
notifyAtomHovered(((Integer) data[2]).intValue(), (String) data[1], |
1008 |
|
(String) data[0]); |
1009 |
0 |
break; |
1010 |
318 |
case SCRIPT: |
1011 |
318 |
notifyScriptTermination((String) data[2], |
1012 |
|
((Integer) data[3]).intValue()); |
1013 |
318 |
break; |
1014 |
22 |
case ECHO: |
1015 |
22 |
sendConsoleEcho((String) data[1]); |
1016 |
22 |
break; |
1017 |
0 |
case MESSAGE: |
1018 |
0 |
sendConsoleMessage( |
1019 |
0 |
(data == null) ? ((String) null) : (String) data[1]); |
1020 |
0 |
break; |
1021 |
0 |
case ERROR: |
1022 |
|
|
1023 |
0 |
break; |
1024 |
0 |
case SYNC: |
1025 |
0 |
case RESIZE: |
1026 |
0 |
refreshGUI(); |
1027 |
0 |
break; |
1028 |
8 |
case MEASURE: |
1029 |
|
|
1030 |
0 |
case CLICK: |
1031 |
0 |
default: |
1032 |
8 |
System.err.println( |
1033 |
|
"Unhandled callback " + type + " " + data[1].toString()); |
1034 |
8 |
break; |
1035 |
|
} |
1036 |
|
} catch (Exception e) |
1037 |
|
{ |
1038 |
0 |
System.err.println("Squashed Jmol callback handler error:"); |
1039 |
0 |
e.printStackTrace(); |
1040 |
|
} |
1041 |
|
} |
1042 |
|
|
|
|
| 66.7% |
Uncovered Elements: 4 (12) |
Complexity: 9 |
Complexity Density: 0.75 |
|
1043 |
403 |
@Override... |
1044 |
|
public boolean notifyEnabled(CBK callbackPick) |
1045 |
|
{ |
1046 |
403 |
switch (callbackPick) |
1047 |
|
{ |
1048 |
22 |
case ECHO: |
1049 |
11 |
case LOADSTRUCT: |
1050 |
8 |
case MEASURE: |
1051 |
0 |
case MESSAGE: |
1052 |
0 |
case PICK: |
1053 |
318 |
case SCRIPT: |
1054 |
0 |
case HOVER: |
1055 |
0 |
case ERROR: |
1056 |
359 |
return true; |
1057 |
44 |
default: |
1058 |
44 |
return false; |
1059 |
|
} |
1060 |
|
} |
1061 |
|
|
1062 |
|
|
1063 |
|
|
1064 |
|
|
1065 |
|
private long loadNotifiesHandled = 0; |
1066 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1067 |
5 |
public long getLoadNotifiesHandled()... |
1068 |
|
{ |
1069 |
5 |
return loadNotifiesHandled; |
1070 |
|
} |
1071 |
|
|
|
|
| 71.1% |
Uncovered Elements: 33 (114) |
Complexity: 26 |
Complexity Density: 0.36 |
|
1072 |
11 |
public void notifyFileLoaded(String fullPathName, String fileName2,... |
1073 |
|
String modelName, String errorMsg, int modelParts) |
1074 |
|
{ |
1075 |
11 |
if (errorMsg != null) |
1076 |
|
{ |
1077 |
0 |
fileLoadingError = errorMsg; |
1078 |
0 |
refreshGUI(); |
1079 |
0 |
return; |
1080 |
|
} |
1081 |
|
|
1082 |
|
|
1083 |
|
|
1084 |
|
|
1085 |
|
|
1086 |
|
|
1087 |
11 |
fileLoadingError = null; |
1088 |
11 |
String[] oldmodels = modelFileNames; |
1089 |
11 |
modelFileNames = null; |
1090 |
11 |
chainNames = new ArrayList<>(); |
1091 |
11 |
chainFile = new Hashtable<>(); |
1092 |
11 |
boolean notifyLoaded = false; |
1093 |
11 |
String[] modelfilenames = getStructureFiles(); |
1094 |
|
|
1095 |
11 |
if (oldmodels != null && oldmodels.length > 0) |
1096 |
|
{ |
1097 |
1 |
int oldm = 0; |
1098 |
2 |
for (int i = 0; i < oldmodels.length; i++) |
1099 |
|
{ |
1100 |
1 |
for (int n = 0; n < modelfilenames.length; n++) |
1101 |
|
{ |
1102 |
1 |
if (modelfilenames[n] == oldmodels[i]) |
1103 |
|
{ |
1104 |
1 |
oldmodels[i] = null; |
1105 |
1 |
break; |
1106 |
|
} |
1107 |
|
} |
1108 |
1 |
if (oldmodels[i] != null) |
1109 |
|
{ |
1110 |
0 |
oldm++; |
1111 |
|
} |
1112 |
|
} |
1113 |
1 |
if (oldm > 0) |
1114 |
|
{ |
1115 |
0 |
String[] oldmfn = new String[oldm]; |
1116 |
0 |
oldm = 0; |
1117 |
0 |
for (int i = 0; i < oldmodels.length; i++) |
1118 |
|
{ |
1119 |
0 |
if (oldmodels[i] != null) |
1120 |
|
{ |
1121 |
0 |
oldmfn[oldm++] = oldmodels[i]; |
1122 |
|
} |
1123 |
|
} |
1124 |
|
|
1125 |
|
|
1126 |
0 |
getSsm().removeStructureViewerListener(this, oldmfn); |
1127 |
|
} |
1128 |
|
} |
1129 |
11 |
refreshPdbEntries(); |
1130 |
23 |
for (int modelnum = 0; modelnum < modelfilenames.length; modelnum++) |
1131 |
|
{ |
1132 |
12 |
String fileName = modelfilenames[modelnum]; |
1133 |
12 |
boolean foundEntry = false; |
1134 |
12 |
StructureFile pdb = null; |
1135 |
12 |
String pdbfile = null; |
1136 |
|
|
1137 |
12 |
if (loadedInline) |
1138 |
|
{ |
1139 |
|
|
1140 |
|
|
1141 |
|
|
1142 |
0 |
pdbfile = viewer.getData( |
1143 |
|
"" + (1 + _modelFileNameMap[modelnum]) + ".0", "PDB"); |
1144 |
|
} |
1145 |
|
|
1146 |
|
|
1147 |
26 |
for (int pe = 0; pe < getPdbCount(); pe++) |
1148 |
|
{ |
1149 |
14 |
boolean matches = false; |
1150 |
14 |
addSequence(pe, getSequence()[pe]); |
1151 |
14 |
if (fileName == null) |
1152 |
|
{ |
1153 |
0 |
if (false) |
1154 |
|
|
1155 |
|
{ |
1156 |
0 |
pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe], |
1157 |
|
pdbfile, DataSourceType.PASTE, |
1158 |
|
getIProgressIndicator()); |
1159 |
0 |
getPdbEntry(modelnum).setFile("INLINE" + pdb.getId()); |
1160 |
0 |
matches = true; |
1161 |
0 |
foundEntry = true; |
1162 |
|
} |
1163 |
|
} |
1164 |
|
else |
1165 |
|
{ |
1166 |
14 |
File fl = new File(getPdbEntry(pe).getFile()); |
1167 |
14 |
matches = fl.equals(new File(fileName)); |
1168 |
14 |
if (matches) |
1169 |
|
{ |
1170 |
12 |
foundEntry = true; |
1171 |
|
|
1172 |
|
|
1173 |
|
|
1174 |
|
|
1175 |
|
|
1176 |
12 |
DataSourceType protocol = DataSourceType.URL; |
1177 |
12 |
try |
1178 |
|
{ |
1179 |
12 |
if (fl.exists()) |
1180 |
|
{ |
1181 |
12 |
protocol = DataSourceType.FILE; |
1182 |
|
} |
1183 |
|
} catch (Exception e) |
1184 |
|
{ |
1185 |
|
} catch (Error e) |
1186 |
|
{ |
1187 |
|
} |
1188 |
|
|
1189 |
12 |
pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe], |
1190 |
|
fileName, protocol, getIProgressIndicator()); |
1191 |
|
|
1192 |
|
|
1193 |
|
} |
1194 |
|
} |
1195 |
14 |
if (matches) |
1196 |
|
{ |
1197 |
|
|
1198 |
33 |
for (int i = 0; i < pdb.getChains().size(); i++) |
1199 |
|
{ |
1200 |
21 |
String chid = new String( |
1201 |
|
pdb.getId() + ":" + pdb.getChains().elementAt(i).id); |
1202 |
21 |
chainFile.put(chid, fileName); |
1203 |
21 |
chainNames.add(chid); |
1204 |
|
} |
1205 |
12 |
notifyLoaded = true; |
1206 |
|
} |
1207 |
|
} |
1208 |
|
|
1209 |
12 |
if (!foundEntry && associateNewStructs) |
1210 |
|
{ |
1211 |
|
|
1212 |
|
|
1213 |
|
|
1214 |
0 |
String pdbcontent = viewer.getData("/" + (modelnum + 1) + ".1", |
1215 |
|
"PDB"); |
1216 |
|
|
1217 |
|
|
1218 |
|
|
1219 |
|
|
1220 |
0 |
notifyLoaded = true; |
1221 |
|
|
1222 |
|
} |
1223 |
|
} |
1224 |
|
|
1225 |
|
|
1226 |
|
|
1227 |
|
|
1228 |
|
|
1229 |
|
|
1230 |
|
|
1231 |
11 |
if (!isLoadingFromArchive()) |
1232 |
|
{ |
1233 |
11 |
jmolScript( |
1234 |
|
"model *; select backbone;restrict;cartoon;wireframe off;spacefill off"); |
1235 |
|
} |
1236 |
|
|
1237 |
|
|
1238 |
11 |
getSsm().addStructureViewerListener(this); |
1239 |
11 |
if (notifyLoaded) |
1240 |
|
{ |
1241 |
11 |
FeatureRenderer fr = getFeatureRenderer(null); |
1242 |
11 |
if (fr != null) |
1243 |
|
{ |
1244 |
1 |
fr.featuresAdded(); |
1245 |
|
} |
1246 |
11 |
refreshGUI(); |
1247 |
11 |
loadNotifiesHandled++; |
1248 |
|
} |
1249 |
11 |
setLoadingFromArchive(false); |
1250 |
|
} |
1251 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1252 |
11 |
@Override... |
1253 |
|
public List<String> getChainNames() |
1254 |
|
{ |
1255 |
11 |
return chainNames; |
1256 |
|
} |
1257 |
|
|
1258 |
|
protected abstract IProgressIndicator getIProgressIndicator(); |
1259 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1260 |
0 |
public void notifyNewPickingModeMeasurement(int iatom, String strMeasure)... |
1261 |
|
{ |
1262 |
0 |
notifyAtomPicked(iatom, strMeasure, null); |
1263 |
|
} |
1264 |
|
|
1265 |
|
public abstract void notifyScriptTermination(String strStatus, |
1266 |
|
int msWalltime); |
1267 |
|
|
1268 |
|
|
1269 |
|
|
1270 |
|
|
1271 |
|
@param |
1272 |
|
|
1273 |
|
public abstract void sendConsoleEcho(String strEcho); |
1274 |
|
|
1275 |
|
|
1276 |
|
|
1277 |
|
|
1278 |
|
|
1279 |
|
|
1280 |
|
|
1281 |
|
|
1282 |
|
|
1283 |
|
|
1284 |
|
@param |
1285 |
|
|
1286 |
|
|
1287 |
|
|
1288 |
|
public abstract void sendConsoleMessage(String strStatus); |
1289 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1290 |
0 |
@Override... |
1291 |
|
public void setCallbackFunction(String callbackType, |
1292 |
|
String callbackFunction) |
1293 |
|
{ |
1294 |
0 |
System.err.println("Ignoring set-callback request to associate " |
1295 |
|
+ callbackType + " with function " + callbackFunction); |
1296 |
|
|
1297 |
|
} |
1298 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 3 |
Complexity Density: 0.23 |
|
1299 |
0 |
@Override... |
1300 |
|
public void setJalviewColourScheme(ColourSchemeI cs) |
1301 |
|
{ |
1302 |
0 |
colourBySequence = false; |
1303 |
|
|
1304 |
0 |
if (cs == null) |
1305 |
|
{ |
1306 |
0 |
return; |
1307 |
|
} |
1308 |
|
|
1309 |
0 |
jmolHistory(false); |
1310 |
0 |
StringBuilder command = new StringBuilder(128); |
1311 |
0 |
command.append("select *;color white;"); |
1312 |
0 |
List<String> residueSet = ResidueProperties.getResidues(isNucleotide(), |
1313 |
|
false); |
1314 |
0 |
for (String resName : residueSet) |
1315 |
|
{ |
1316 |
0 |
char res = resName.length() == 3 |
1317 |
|
? ResidueProperties.getSingleCharacterCode(resName) |
1318 |
|
: resName.charAt(0); |
1319 |
0 |
Color col = cs.findColour(res, 0, null, null, 0f); |
1320 |
0 |
command.append("select " + resName + ";color[" + col.getRed() + "," |
1321 |
|
+ col.getGreen() + "," + col.getBlue() + "];"); |
1322 |
|
} |
1323 |
|
|
1324 |
0 |
evalStateCommand(command.toString()); |
1325 |
0 |
jmolHistory(true); |
1326 |
|
} |
1327 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1328 |
0 |
public void showHelp()... |
1329 |
|
{ |
1330 |
0 |
showUrl("http://jmol.sourceforge.net/docs/JmolUserGuide/", "jmolHelp"); |
1331 |
|
} |
1332 |
|
|
1333 |
|
|
1334 |
|
|
1335 |
|
|
1336 |
|
@param |
1337 |
|
|
1338 |
|
public abstract void showUrl(String url, String target); |
1339 |
|
|
1340 |
|
|
1341 |
|
|
1342 |
|
|
1343 |
|
|
1344 |
|
|
1345 |
|
public abstract void refreshGUI(); |
1346 |
|
|
1347 |
|
|
1348 |
|
|
1349 |
|
|
1350 |
|
@param |
1351 |
|
|
1352 |
|
public abstract void showConsole(boolean show); |
1353 |
|
|
1354 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1355 |
92 |
public static Viewer getJmolData(JmolParser jmolParser)... |
1356 |
|
{ |
1357 |
92 |
return (Viewer) JmolViewer.allocateViewer(null, null, null, null, null, |
1358 |
|
"-x -o -n", jmolParser); |
1359 |
|
} |
1360 |
|
|
1361 |
|
|
1362 |
|
|
1363 |
|
|
1364 |
|
|
1365 |
|
@param |
1366 |
|
@param |
1367 |
|
|
1368 |
|
|
1369 |
|
@param |
1370 |
|
@param |
1371 |
|
@param |
1372 |
|
@param |
1373 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1374 |
0 |
public void allocateViewer(Container renderPanel, boolean jmolfileio,... |
1375 |
|
String htmlName, URL documentBase, URL codeBase, |
1376 |
|
String commandOptions) |
1377 |
|
{ |
1378 |
0 |
allocateViewer(renderPanel, jmolfileio, htmlName, documentBase, |
1379 |
|
codeBase, commandOptions, null, null); |
1380 |
|
} |
1381 |
|
|
1382 |
|
|
1383 |
|
|
1384 |
|
@param |
1385 |
|
@param |
1386 |
|
|
1387 |
|
|
1388 |
|
@param |
1389 |
|
@param |
1390 |
|
@param |
1391 |
|
@param |
1392 |
|
@param |
1393 |
|
|
1394 |
|
@param |
1395 |
|
|
1396 |
|
|
|
|
| 64.7% |
Uncovered Elements: 6 (17) |
Complexity: 5 |
Complexity Density: 0.45 |
|
1397 |
10 |
public void allocateViewer(Container renderPanel, boolean jmolfileio,... |
1398 |
|
String htmlName, URL documentBase, URL codeBase, |
1399 |
|
String commandOptions, final Container consolePanel, |
1400 |
|
String buttonsToShow) |
1401 |
|
{ |
1402 |
|
|
1403 |
10 |
System.err.println("Allocating Jmol Viewer: " + commandOptions); |
1404 |
|
|
1405 |
10 |
if (commandOptions == null) |
1406 |
|
{ |
1407 |
0 |
commandOptions = ""; |
1408 |
|
} |
1409 |
10 |
viewer = (Viewer) JmolViewer.allocateViewer(renderPanel, |
1410 |
10 |
(jmolfileio ? new SmarterJmolAdapter() : null), |
1411 |
|
htmlName + ((Object) this).toString(), documentBase, codeBase, |
1412 |
|
commandOptions, this); |
1413 |
|
|
1414 |
10 |
viewer.setJmolStatusListener(this); |
1415 |
|
|
1416 |
10 |
try { |
1417 |
10 |
console = createJmolConsole(consolePanel, buttonsToShow); |
1418 |
|
} catch (Throwable e) { |
1419 |
0 |
System.err.println("Could not create Jmol application console. " + e.getMessage()); |
1420 |
0 |
e.printStackTrace(); |
1421 |
|
} |
1422 |
10 |
if (consolePanel != null) |
1423 |
|
{ |
1424 |
10 |
consolePanel.addComponentListener(this); |
1425 |
|
|
1426 |
|
} |
1427 |
|
|
1428 |
|
} |
1429 |
|
|
1430 |
|
protected abstract JmolAppConsoleInterface createJmolConsole( |
1431 |
|
Container consolePanel, String buttonsToShow); |
1432 |
|
|
1433 |
|
|
1434 |
|
|
1435 |
|
|
1436 |
|
protected org.jmol.api.JmolAppConsoleInterface console = null; |
1437 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1438 |
0 |
@Override... |
1439 |
|
public void setBackgroundColour(java.awt.Color col) |
1440 |
|
{ |
1441 |
0 |
jmolHistory(false); |
1442 |
0 |
jmolScript("background [" + col.getRed() + "," |
1443 |
|
+ col.getGreen() + "," + col.getBlue() + "];"); |
1444 |
0 |
jmolHistory(true); |
1445 |
|
} |
1446 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
1447 |
107 |
private String jmolScript(String script)... |
1448 |
|
{ |
1449 |
|
|
1450 |
107 |
System.err.println(">>Jmol>> " + script); |
1451 |
|
|
1452 |
107 |
String s = viewer.scriptWait(script); |
1453 |
|
|
1454 |
106 |
System.err.println("<<Jmol<< " + s); |
1455 |
|
|
1456 |
106 |
return s; |
1457 |
|
} |
1458 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1459 |
0 |
@Override... |
1460 |
|
public int[] resizeInnerPanel(String data) |
1461 |
|
{ |
1462 |
|
|
1463 |
0 |
return null; |
1464 |
|
} |
1465 |
|
|
1466 |
|
|
1467 |
|
|
1468 |
|
|
|
|
| 28.6% |
Uncovered Elements: 5 (7) |
Complexity: 4 |
Complexity Density: 0.8 |
|
1469 |
10 |
protected void closeConsole()... |
1470 |
|
{ |
1471 |
10 |
if (console != null) |
1472 |
|
{ |
1473 |
0 |
try |
1474 |
|
{ |
1475 |
0 |
console.setVisible(false); |
1476 |
|
} catch (Error e) |
1477 |
|
{ |
1478 |
|
} catch (Exception x) |
1479 |
|
{ |
1480 |
|
} |
1481 |
0 |
; |
1482 |
0 |
console = null; |
1483 |
|
} |
1484 |
|
} |
1485 |
|
|
1486 |
|
|
1487 |
|
|
1488 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1489 |
0 |
@Override... |
1490 |
|
public void componentMoved(ComponentEvent e) |
1491 |
|
{ |
1492 |
|
} |
1493 |
|
|
1494 |
|
|
1495 |
|
|
1496 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1497 |
0 |
@Override... |
1498 |
|
public void componentResized(ComponentEvent e) |
1499 |
|
{ |
1500 |
|
} |
1501 |
|
|
1502 |
|
|
1503 |
|
|
1504 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1505 |
0 |
@Override... |
1506 |
|
public void componentShown(ComponentEvent e) |
1507 |
|
{ |
1508 |
0 |
showConsole(true); |
1509 |
|
} |
1510 |
|
|
1511 |
|
|
1512 |
|
|
1513 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1514 |
0 |
@Override... |
1515 |
|
public void componentHidden(ComponentEvent e) |
1516 |
|
{ |
1517 |
0 |
showConsole(false); |
1518 |
|
} |
1519 |
|
|
1520 |
|
} |