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 java.awt.Color; |
24 |
|
import java.util.ArrayList; |
25 |
|
import java.util.Arrays; |
26 |
|
import java.util.List; |
27 |
|
import java.util.Map; |
28 |
|
|
29 |
|
import jalview.api.AlignViewportI; |
30 |
|
import jalview.api.AlignmentViewPanel; |
31 |
|
import jalview.api.FeatureRenderer; |
32 |
|
import jalview.api.SequenceRenderer; |
33 |
|
import jalview.datamodel.AlignmentI; |
34 |
|
import jalview.datamodel.HiddenColumns; |
35 |
|
import jalview.datamodel.SequenceI; |
36 |
|
import jalview.renderer.seqfeatures.FeatureColourFinder; |
37 |
|
import jalview.structure.AtomSpecModel; |
38 |
|
import jalview.structure.StructureCommand; |
39 |
|
import jalview.structure.StructureCommandI; |
40 |
|
import jalview.structure.StructureCommandsBase; |
41 |
|
import jalview.structure.StructureMapping; |
42 |
|
import jalview.structure.StructureSelectionManager; |
43 |
|
import jalview.util.Comparison; |
44 |
|
import jalview.util.Platform; |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
@author |
50 |
|
|
51 |
|
|
|
|
| 72.8% |
Uncovered Elements: 69 (254) |
Complexity: 69 |
Complexity Density: 0.43 |
|
52 |
|
public class JmolCommands extends StructureCommandsBase |
53 |
|
{ |
54 |
|
private static final StructureCommand SHOW_BACKBONE = new StructureCommand( |
55 |
|
"select *; cartoons off; backbone"); |
56 |
|
|
57 |
|
private static final StructureCommand FOCUS_VIEW = new StructureCommand( |
58 |
|
"zoom 0"); |
59 |
|
|
60 |
|
private static final StructureCommand COLOUR_ALL_WHITE = new StructureCommand( |
61 |
|
"select *;color white;"); |
62 |
|
|
63 |
|
private static final StructureCommandI COLOUR_BY_CHARGE = new StructureCommand( |
64 |
|
"select *;color white;select ASP,GLU;color red;" |
65 |
|
+ "select LYS,ARG;color blue;select CYS;color yellow"); |
66 |
|
|
67 |
|
private static final StructureCommandI COLOUR_BY_CHAIN = new StructureCommand( |
68 |
|
"select *;color chain"); |
69 |
|
|
70 |
|
private static final String PIPE = "|"; |
71 |
|
|
72 |
|
private static final String HYPHEN = "-"; |
73 |
|
|
74 |
|
private static final String COLON = ":"; |
75 |
|
|
76 |
|
private static final String SLASH = "/"; |
77 |
|
|
78 |
|
|
79 |
|
@inheritDoc |
80 |
|
|
81 |
|
@return |
82 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
83 |
1 |
@Override... |
84 |
|
public int getModelStartNo() |
85 |
|
{ |
86 |
1 |
return 1; |
87 |
|
} |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
@param |
94 |
|
@return |
95 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
96 |
1390 |
protected String getColourString(Color c)... |
97 |
|
{ |
98 |
1390 |
return c == null ? null |
99 |
|
: String.format("[%d,%d,%d]", c.getRed(), c.getGreen(), |
100 |
|
c.getBlue()); |
101 |
|
} |
102 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
1 |
@Override... |
104 |
|
public StructureCommandI colourByChain() |
105 |
|
{ |
106 |
1 |
return COLOUR_BY_CHAIN; |
107 |
|
} |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
1 |
@Override... |
110 |
|
public List<StructureCommandI> colourByCharge() |
111 |
|
{ |
112 |
1 |
return Arrays.asList(COLOUR_BY_CHARGE); |
113 |
|
} |
114 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
115 |
0 |
@Override... |
116 |
|
public List<StructureCommandI> colourByResidues( |
117 |
|
Map<String, Color> colours) |
118 |
|
{ |
119 |
0 |
List<StructureCommandI> cmds = super.colourByResidues(colours); |
120 |
0 |
cmds.add(0, COLOUR_ALL_WHITE); |
121 |
0 |
return cmds; |
122 |
|
} |
123 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
124 |
1 |
@Override... |
125 |
|
public StructureCommandI setBackgroundColour(Color col) |
126 |
|
{ |
127 |
1 |
return new StructureCommand("background " + getColourString(col)); |
128 |
|
} |
129 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
130 |
1 |
@Override... |
131 |
|
public StructureCommandI focusView() |
132 |
|
{ |
133 |
1 |
return FOCUS_VIEW; |
134 |
|
} |
135 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
136 |
0 |
@Override... |
137 |
|
public List<StructureCommandI> showChains(List<String> toShow) |
138 |
|
{ |
139 |
0 |
StringBuilder atomSpec = new StringBuilder(128); |
140 |
0 |
boolean first = true; |
141 |
0 |
for (String chain : toShow) |
142 |
|
{ |
143 |
0 |
String[] tokens = chain.split(":"); |
144 |
0 |
if (tokens.length == 2) |
145 |
|
{ |
146 |
0 |
if (!first) |
147 |
|
{ |
148 |
0 |
atomSpec.append(" or "); |
149 |
|
} |
150 |
0 |
first = false; |
151 |
0 |
atomSpec.append(":").append(tokens[1]).append(" /") |
152 |
|
.append(tokens[0]); |
153 |
|
} |
154 |
|
} |
155 |
|
|
156 |
0 |
String spec = atomSpec.toString(); |
157 |
0 |
String command = "select *;restrict " + spec + ";cartoon;center " |
158 |
|
+ spec; |
159 |
0 |
return Arrays.asList(new StructureCommand(command)); |
160 |
|
} |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
@see |
181 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
|
182 |
2 |
@Override... |
183 |
|
public List<StructureCommandI> superposeStructures(AtomSpecModel refAtoms, |
184 |
|
AtomSpecModel atomSpec, AtomSpecType backbone) |
185 |
|
{ |
186 |
2 |
StringBuilder sb = new StringBuilder(64); |
187 |
2 |
String refModel = refAtoms.getModels().iterator().next(); |
188 |
2 |
String model2 = atomSpec.getModels().iterator().next(); |
189 |
2 |
sb.append(String.format("compare {%s.1} {%s.1}", model2, refModel)); |
190 |
2 |
sb.append(" SUBSET {(*.CA | *.P) and conformation=1} ATOMS {"); |
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
2 |
sb.append(getAtomSpec(atomSpec, backbone)).append("}{"); |
197 |
2 |
sb.append(getAtomSpec(refAtoms, backbone)).append("}"); |
198 |
2 |
sb.append(" ROTATE TRANSLATE "); |
199 |
2 |
sb.append(getCommandSeparator()); |
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
2 |
sb.append("select ") |
205 |
|
.append(getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY)) |
206 |
|
.append("|"); |
207 |
2 |
sb.append(getAtomSpec(refAtoms, AtomSpecType.RESIDUE_ONLY)) |
208 |
|
.append(getCommandSeparator()).append("cartoons"); |
209 |
2 |
return Arrays.asList(new StructureCommand(sb.toString())); |
210 |
|
} |
211 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
212 |
1 |
@Override... |
213 |
|
public List<StructureCommandI> centerViewOn(List<AtomSpecModel> residues) |
214 |
|
{ |
215 |
1 |
StringBuilder sb = new StringBuilder(64); |
216 |
1 |
sb.append("center "); |
217 |
1 |
for (AtomSpecModel ranges : residues) |
218 |
|
{ |
219 |
2 |
if (sb.length() > 9) |
220 |
|
{ |
221 |
1 |
sb.append(" or "); |
222 |
|
} |
223 |
2 |
sb.append(getAtomSpec(ranges, AtomSpecType.RESIDUE_ONLY)); |
224 |
|
} |
225 |
1 |
return Arrays.asList(new StructureCommand(sb.toString())); |
226 |
|
} |
227 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
228 |
0 |
@Override... |
229 |
|
public StructureCommandI openCommandFile(String path) |
230 |
|
{ |
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
|
235 |
0 |
return new StructureCommand("script " + path); |
236 |
|
} |
237 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
238 |
4 |
@Override... |
239 |
|
public StructureCommandI saveSession(String filepath) |
240 |
|
{ |
241 |
|
|
242 |
|
|
243 |
|
|
244 |
4 |
StructureCommand sc = new StructureCommand( |
245 |
|
"write STATE \"" + Platform.escapeBackslashes(filepath) + "\""); |
246 |
4 |
sc.setWaitNeeded(true); |
247 |
4 |
return sc; |
248 |
|
} |
249 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
250 |
1369 |
@Override... |
251 |
|
protected StructureCommandI colourResidues(String atomSpec, Color colour) |
252 |
|
{ |
253 |
1369 |
StringBuilder sb = new StringBuilder(atomSpec.length() + 20); |
254 |
1369 |
sb.append("select ").append(atomSpec).append(getCommandSeparator()) |
255 |
|
.append("color").append(getColourString(colour)); |
256 |
1369 |
return new StructureCommand(sb.toString()); |
257 |
|
} |
258 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
259 |
0 |
@Override... |
260 |
|
protected String getResidueSpec(String residue) |
261 |
|
{ |
262 |
0 |
return residue; |
263 |
|
} |
264 |
|
|
265 |
|
|
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
|
272 |
|
|
273 |
|
|
274 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 3 |
Complexity Density: 0.21 |
|
275 |
1390 |
@Override... |
276 |
|
public String getAtomSpec(AtomSpecModel model, AtomSpecType specType) |
277 |
|
{ |
278 |
1390 |
StringBuilder sb = new StringBuilder(128); |
279 |
|
|
280 |
1390 |
boolean first = true; |
281 |
1390 |
for (String modelNo : model.getModels()) |
282 |
|
{ |
283 |
1399 |
for (String chain : model.getChains(modelNo)) |
284 |
|
{ |
285 |
1418 |
for (int[] range : model.getRanges(modelNo, chain)) |
286 |
|
{ |
287 |
6443 |
if (!first) |
288 |
|
{ |
289 |
5054 |
sb.append(PIPE); |
290 |
|
} |
291 |
6443 |
first = false; |
292 |
6443 |
if (range[0] == range[1]) |
293 |
|
{ |
294 |
5554 |
sb.append(range[0]); |
295 |
|
} |
296 |
|
else |
297 |
|
{ |
298 |
889 |
sb.append(range[0]).append(HYPHEN).append(range[1]); |
299 |
|
} |
300 |
6443 |
sb.append(COLON).append(chain.trim()).append(SLASH); |
301 |
6443 |
sb.append(String.valueOf(modelNo)).append(".1"); |
302 |
|
} |
303 |
|
} |
304 |
|
} |
305 |
|
|
306 |
1390 |
return sb.toString(); |
307 |
|
} |
308 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
309 |
2 |
@Override... |
310 |
|
public List<StructureCommandI> showBackbone() |
311 |
|
{ |
312 |
2 |
return Arrays.asList(SHOW_BACKBONE); |
313 |
|
} |
314 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
315 |
13 |
@Override... |
316 |
|
public StructureCommandI loadFile(String file) |
317 |
|
{ |
318 |
|
|
319 |
|
|
320 |
13 |
return new StructureCommand( |
321 |
|
"load FILES \"" + escapeQuotedFilename(file) + "\""); |
322 |
|
} |
323 |
|
|
324 |
|
|
325 |
|
|
326 |
|
|
327 |
|
|
328 |
|
|
329 |
|
@param |
330 |
|
@return |
331 |
|
|
332 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
333 |
56 |
public static String escapeQuotedFilename(String file)... |
334 |
|
{ |
335 |
56 |
String prepend=""; |
336 |
56 |
if (file.startsWith("//") || file.startsWith("\\\\")) |
337 |
|
{ |
338 |
4 |
prepend = "file:"; |
339 |
|
} |
340 |
56 |
return prepend+Platform.escapeBackslashes(file); |
341 |
|
} |
342 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
343 |
0 |
@Override... |
344 |
|
public StructureCommandI restoreSession(String filePath) |
345 |
|
{ |
346 |
0 |
return new StructureCommand("restore STATE \"" |
347 |
|
+ escapeQuotedFilename(filePath) + "\""); |
348 |
|
} |
349 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.36 |
|
350 |
0 |
@Override... |
351 |
|
public List<StructureCommandI> showHetatms(List<String> toShow) |
352 |
|
{ |
353 |
|
|
354 |
|
|
355 |
0 |
StringBuilder sb = new StringBuilder(); |
356 |
0 |
sb.append("select hetero; cpk off;"); |
357 |
|
|
358 |
0 |
if (toShow != null && !toShow.isEmpty()) |
359 |
|
{ |
360 |
|
|
361 |
0 |
sb.append("select "); |
362 |
0 |
boolean or = false; |
363 |
0 |
for (String k : toShow) |
364 |
|
{ |
365 |
0 |
sb.append(or ? " or " : " "); |
366 |
0 |
sb.append(k); |
367 |
0 |
or = true; |
368 |
|
} |
369 |
|
|
370 |
0 |
sb.append("; cpk;"); |
371 |
|
} |
372 |
|
|
373 |
0 |
return Arrays.asList(new StructureCommand(sb.toString())); |
374 |
|
} |
375 |
|
|
376 |
|
|
377 |
|
|
378 |
|
|
379 |
|
|
380 |
|
@param |
381 |
|
@param |
382 |
|
@param |
383 |
|
@param |
384 |
|
@param |
385 |
|
@return |
386 |
|
|
|
|
| 75.3% |
Uncovered Elements: 19 (77) |
Complexity: 21 |
Complexity Density: 0.45 |
|
387 |
1 |
@Deprecated... |
388 |
|
public String[] colourBySequence(StructureSelectionManager ssm, |
389 |
|
String[] files, SequenceI[][] sequence, SequenceRenderer sr, |
390 |
|
AlignmentViewPanel viewPanel) |
391 |
|
{ |
392 |
|
|
393 |
|
|
394 |
1 |
FeatureRenderer fr = viewPanel.getFeatureRenderer(); |
395 |
1 |
FeatureColourFinder finder = new FeatureColourFinder(fr); |
396 |
1 |
AlignViewportI viewport = viewPanel.getAlignViewport(); |
397 |
1 |
HiddenColumns cs = viewport.getAlignment().getHiddenColumns(); |
398 |
1 |
AlignmentI al = viewport.getAlignment(); |
399 |
1 |
List<String> cset = new ArrayList<>(); |
400 |
|
|
401 |
3 |
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) |
402 |
|
{ |
403 |
2 |
StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); |
404 |
2 |
StringBuilder command = new StringBuilder(128); |
405 |
2 |
List<String> str = new ArrayList<>(); |
406 |
|
|
407 |
2 |
if (mapping == null || mapping.length < 1) |
408 |
|
{ |
409 |
0 |
continue; |
410 |
|
} |
411 |
|
|
412 |
4 |
for (int s = 0; s < sequence[pdbfnum].length; s++) |
413 |
|
{ |
414 |
4 |
for (int sp, m = 0; m < mapping.length; m++) |
415 |
|
{ |
416 |
? |
if (mapping[m].getSequence() == sequence[pdbfnum][s] |
417 |
|
&& (sp = al.findIndex(sequence[pdbfnum][s])) > -1) |
418 |
|
{ |
419 |
2 |
int lastPos = StructureMapping.UNASSIGNED_VALUE; |
420 |
2 |
SequenceI asp = al.getSequenceAt(sp); |
421 |
22 |
for (int r = 0; r < asp.getLength(); r++) |
422 |
|
{ |
423 |
|
|
424 |
20 |
if (Comparison.isGap(asp.getCharAt(r))) |
425 |
|
{ |
426 |
0 |
continue; |
427 |
|
} |
428 |
20 |
int pos = mapping[m].getPDBResNum(asp.findPosition(r)); |
429 |
|
|
430 |
20 |
if (pos == lastPos) |
431 |
|
{ |
432 |
0 |
continue; |
433 |
|
} |
434 |
20 |
if (pos == StructureMapping.UNASSIGNED_VALUE) |
435 |
|
{ |
436 |
|
|
437 |
0 |
if (command.length() > 0 |
438 |
|
&& command.charAt(command.length() - 1) != ';') |
439 |
|
{ |
440 |
0 |
command.append(";"); |
441 |
|
} |
442 |
|
|
443 |
0 |
lastPos = StructureMapping.UNASSIGNED_VALUE; |
444 |
0 |
continue; |
445 |
|
} |
446 |
|
|
447 |
20 |
lastPos = pos; |
448 |
|
|
449 |
20 |
Color col = sr.getResidueColour(sequence[pdbfnum][s], r, |
450 |
|
finder); |
451 |
|
|
452 |
|
|
453 |
|
|
454 |
|
|
455 |
20 |
if (!cs.isVisible(r)) |
456 |
|
{ |
457 |
6 |
col = Color.GRAY; |
458 |
|
} |
459 |
|
|
460 |
20 |
String newSelcom = (mapping[m].getChain() != " " |
461 |
|
? ":" + mapping[m].getChain() |
462 |
|
: "") + "/" + (pdbfnum + 1) + ".1" + ";color" |
463 |
|
+ getColourString(col); |
464 |
20 |
if (command.length() > newSelcom.length() && command |
465 |
|
.substring(command.length() - newSelcom.length()) |
466 |
|
.equals(newSelcom)) |
467 |
|
{ |
468 |
12 |
command = JmolCommands.condenseCommand(command, pos); |
469 |
12 |
continue; |
470 |
|
} |
471 |
|
|
472 |
|
|
473 |
|
|
474 |
8 |
if (command.length() > 0 |
475 |
|
&& command.charAt(command.length() - 1) != ';') |
476 |
|
{ |
477 |
6 |
command.append(";"); |
478 |
|
} |
479 |
|
|
480 |
8 |
if (command.length() > 51200) |
481 |
|
{ |
482 |
|
|
483 |
0 |
str.add(command.toString()); |
484 |
0 |
command.setLength(0); |
485 |
|
} |
486 |
8 |
command.append("select " + pos); |
487 |
8 |
command.append(newSelcom); |
488 |
|
} |
489 |
|
|
490 |
|
} |
491 |
|
} |
492 |
|
} |
493 |
|
{ |
494 |
|
|
495 |
2 |
str.add(command.toString()); |
496 |
2 |
command.setLength(0); |
497 |
|
} |
498 |
2 |
cset.addAll(str); |
499 |
|
|
500 |
|
} |
501 |
1 |
return cset.toArray(new String[cset.size()]); |
502 |
|
} |
503 |
|
|
504 |
|
|
505 |
|
|
506 |
|
|
507 |
|
@param |
508 |
|
@param |
509 |
|
@return |
510 |
|
|
|
|
| 80% |
Uncovered Elements: 4 (20) |
Complexity: 5 |
Complexity Density: 0.36 |
|
511 |
12 |
@Deprecated... |
512 |
|
private static StringBuilder condenseCommand(StringBuilder command, |
513 |
|
int pos) |
514 |
|
{ |
515 |
|
|
516 |
|
|
517 |
12 |
int p = command.length(), q = p; |
518 |
12 |
do |
519 |
|
{ |
520 |
74 |
p -= 6; |
521 |
74 |
if (p < 1) |
522 |
|
{ |
523 |
0 |
p = 0; |
524 |
|
} |
525 |
74 |
; |
526 |
? |
} while ((q = command.indexOf("select", p)) == -1 && p > 0); |
527 |
|
|
528 |
12 |
StringBuilder sb = new StringBuilder(command.substring(0, q + 7)); |
529 |
|
|
530 |
12 |
command = command.delete(0, q + 7); |
531 |
|
|
532 |
12 |
String start; |
533 |
|
|
534 |
12 |
if (command.indexOf("-") > -1) |
535 |
|
{ |
536 |
8 |
start = command.substring(0, command.indexOf("-")); |
537 |
|
} |
538 |
|
else |
539 |
|
{ |
540 |
4 |
start = command.substring(0, command.indexOf(":")); |
541 |
|
} |
542 |
|
|
543 |
12 |
sb.append(start + "-" + pos + command.substring(command.indexOf(":"))); |
544 |
|
|
545 |
12 |
return sb; |
546 |
|
} |
547 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
548 |
2 |
@Override... |
549 |
|
public StructureCommandI openSession(String filepath) |
550 |
|
{ |
551 |
2 |
return loadFile(filepath); |
552 |
|
} |
553 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
554 |
1 |
@Override... |
555 |
|
public StructureCommandI closeViewer() |
556 |
|
{ |
557 |
1 |
return null; |
558 |
|
} |
559 |
|
|
560 |
|
|
561 |
|
|
562 |
|
@param |
563 |
|
@param |
564 |
|
@return |
565 |
|
|
|
|
| 93.8% |
Uncovered Elements: 2 (32) |
Complexity: 10 |
Complexity Density: 0.56 |
|
566 |
290 |
public static boolean filePathMatch(String jmolFile,String jalviewFile)... |
567 |
|
{ |
568 |
290 |
if (jmolFile.equalsIgnoreCase(jalviewFile)) |
569 |
|
{ |
570 |
272 |
return true; |
571 |
|
} |
572 |
18 |
if (jmolFile.startsWith("file:") && (jalviewFile.startsWith("//") || jalviewFile.startsWith("\\\\"))) |
573 |
|
{ |
574 |
9 |
String jmolPath = jmolFile.substring(5); |
575 |
|
|
576 |
9 |
if (jmolPath.equalsIgnoreCase(jalviewFile)) |
577 |
|
{ |
578 |
3 |
return true; |
579 |
|
} |
580 |
6 |
if (jmolPath.startsWith("////")) |
581 |
|
{ |
582 |
|
|
583 |
2 |
jmolPath = jmolPath.replace("//", "/"); |
584 |
|
} |
585 |
6 |
if (jmolPath.equalsIgnoreCase(jalviewFile)) |
586 |
|
{ |
587 |
0 |
return true; |
588 |
|
} |
589 |
6 |
if (jmolPath.startsWith("\\\\\\")) |
590 |
|
{ |
591 |
|
|
592 |
2 |
jmolPath = jmolPath.replace("\\\\", "//"); |
593 |
|
} |
594 |
6 |
String jalviewPath = jalviewFile.replace("\\","/"); |
595 |
6 |
if (jmolPath.equalsIgnoreCase(jalviewPath)) |
596 |
|
{ |
597 |
4 |
return true; |
598 |
|
} |
599 |
2 |
jmolPath = jmolPath.replace("//", "/"); |
600 |
2 |
return jmolPath.equalsIgnoreCase(jalviewPath); |
601 |
|
|
602 |
|
} |
603 |
9 |
return false; |
604 |
|
} |
605 |
|
} |