1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.structure; |
22 |
|
|
23 |
|
import java.io.PrintStream; |
24 |
|
import java.util.ArrayList; |
25 |
|
import java.util.Arrays; |
26 |
|
import java.util.Collections; |
27 |
|
import java.util.Enumeration; |
28 |
|
import java.util.HashMap; |
29 |
|
import java.util.HashSet; |
30 |
|
import java.util.IdentityHashMap; |
31 |
|
import java.util.List; |
32 |
|
import java.util.Locale; |
33 |
|
import java.util.Map; |
34 |
|
import java.util.Set; |
35 |
|
import java.util.Vector; |
36 |
|
|
37 |
|
import jalview.analysis.AlignSeq; |
38 |
|
import jalview.api.StructureSelectionManagerProvider; |
39 |
|
import jalview.bin.Cache; |
40 |
|
import jalview.bin.Console; |
41 |
|
import jalview.commands.CommandI; |
42 |
|
import jalview.commands.EditCommand; |
43 |
|
import jalview.commands.OrderCommand; |
44 |
|
import jalview.datamodel.AlignedCodonFrame; |
45 |
|
import jalview.datamodel.AlignmentAnnotation; |
46 |
|
import jalview.datamodel.AlignmentI; |
47 |
|
import jalview.datamodel.Annotation; |
48 |
|
import jalview.datamodel.ContiguousI; |
49 |
|
import jalview.datamodel.HiddenColumns; |
50 |
|
import jalview.datamodel.PDBEntry; |
51 |
|
import jalview.datamodel.SearchResults; |
52 |
|
import jalview.datamodel.SearchResultsI; |
53 |
|
import jalview.datamodel.SequenceI; |
54 |
|
import jalview.ext.jmol.JmolParser; |
55 |
|
import jalview.gui.IProgressIndicator; |
56 |
|
import jalview.gui.Preferences; |
57 |
|
import jalview.io.AppletFormatAdapter; |
58 |
|
import jalview.io.DataSourceType; |
59 |
|
import jalview.io.StructureFile; |
60 |
|
import jalview.structure.StructureImportSettings.TFType; |
61 |
|
import jalview.util.Constants; |
62 |
|
import jalview.util.MapList; |
63 |
|
import jalview.util.MappingUtils; |
64 |
|
import jalview.util.MessageManager; |
65 |
|
import jalview.util.Platform; |
66 |
|
import jalview.ws.sifts.SiftsClient; |
67 |
|
import jalview.ws.sifts.SiftsException; |
68 |
|
import jalview.ws.sifts.SiftsSettings; |
69 |
|
import mc_view.Atom; |
70 |
|
import mc_view.PDBChain; |
71 |
|
import mc_view.PDBfile; |
72 |
|
|
|
|
| 53% |
Uncovered Elements: 388 (825) |
Complexity: 238 |
Complexity Density: 0.48 |
|
73 |
|
public class StructureSelectionManager |
74 |
|
{ |
75 |
|
public final static String NEWLINE = System.lineSeparator(); |
76 |
|
|
77 |
|
static IdentityHashMap<StructureSelectionManagerProvider, StructureSelectionManager> instances; |
78 |
|
|
79 |
|
private List<StructureMapping> mappings = new ArrayList<>(); |
80 |
|
|
81 |
|
private boolean processSecondaryStructure = false; |
82 |
|
|
83 |
|
private boolean secStructServices = false; |
84 |
|
|
85 |
|
private boolean addTempFacAnnot = false; |
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
private List<AlignedCodonFrame> seqmappings = new ArrayList<>(); |
91 |
|
|
92 |
|
private List<CommandListener> commandListeners = new ArrayList<>(); |
93 |
|
|
94 |
|
private List<SelectionListener> sel_listeners = new ArrayList<>(); |
95 |
|
|
96 |
|
|
97 |
|
@return |
98 |
|
|
99 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
0 |
public boolean isSecStructServices()... |
101 |
|
{ |
102 |
0 |
return secStructServices; |
103 |
|
} |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
@param |
109 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
53 |
public void setSecStructServices(boolean secStructServices)... |
111 |
|
{ |
112 |
53 |
this.secStructServices = secStructServices; |
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
@return |
119 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
0 |
public boolean isAddTempFacAnnot()... |
121 |
|
{ |
122 |
0 |
return addTempFacAnnot; |
123 |
|
} |
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
@param |
129 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
130 |
55 |
public void setAddTempFacAnnot(boolean addTempFacAnnot)... |
131 |
|
{ |
132 |
55 |
this.addTempFacAnnot = addTempFacAnnot; |
133 |
|
} |
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
@return |
138 |
|
|
139 |
|
|
140 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
141 |
0 |
public boolean isProcessSecondaryStructure()... |
142 |
|
{ |
143 |
0 |
return processSecondaryStructure; |
144 |
|
} |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
@param |
151 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
152 |
55 |
public void setProcessSecondaryStructure(boolean enable)... |
153 |
|
{ |
154 |
55 |
processSecondaryStructure = enable; |
155 |
|
} |
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
160 |
0 |
public void reportMapping()... |
161 |
|
{ |
162 |
0 |
if (mappings.isEmpty()) |
163 |
|
{ |
164 |
0 |
jalview.bin.Console |
165 |
|
.errPrintln("reportMapping: No PDB/Sequence mappings."); |
166 |
|
} |
167 |
|
else |
168 |
|
{ |
169 |
0 |
jalview.bin.Console.errPrintln( |
170 |
|
"reportMapping: There are " + mappings.size() + " mappings."); |
171 |
0 |
int i = 0; |
172 |
0 |
for (StructureMapping sm : mappings) |
173 |
|
{ |
174 |
0 |
jalview.bin.Console |
175 |
|
.errPrintln("mapping " + i++ + " : " + sm.pdbfile); |
176 |
|
} |
177 |
|
} |
178 |
|
} |
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
Map<String, String> pdbIdFileName = new HashMap<>(); |
185 |
|
|
186 |
|
Map<String, String> pdbFileNameId = new HashMap<>(); |
187 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
188 |
63 |
public void registerPDBFile(String idForFile, String absoluteFile)... |
189 |
|
{ |
190 |
63 |
pdbIdFileName.put(idForFile, absoluteFile); |
191 |
63 |
pdbFileNameId.put(absoluteFile, idForFile); |
192 |
|
} |
193 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
194 |
8 |
public String findIdForPDBFile(String idOrFile)... |
195 |
|
{ |
196 |
8 |
String id = pdbFileNameId.get(idOrFile); |
197 |
8 |
return id; |
198 |
|
} |
199 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
200 |
0 |
public String findFileForPDBId(String idOrFile)... |
201 |
|
{ |
202 |
0 |
String id = pdbIdFileName.get(idOrFile); |
203 |
0 |
return id; |
204 |
|
} |
205 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
206 |
15 |
public boolean isPDBFileRegistered(String idOrFile)... |
207 |
|
{ |
208 |
15 |
return pdbFileNameId.containsKey(idOrFile) |
209 |
|
|| pdbIdFileName.containsKey(idOrFile); |
210 |
|
} |
211 |
|
|
212 |
|
private static StructureSelectionManager nullProvider = null; |
213 |
|
|
|
|
| 92.6% |
Uncovered Elements: 2 (27) |
Complexity: 7 |
Complexity Density: 0.47 |
|
214 |
2254 |
public static StructureSelectionManager getStructureSelectionManager(... |
215 |
|
StructureSelectionManagerProvider context) |
216 |
|
{ |
217 |
2254 |
if (context == null) |
218 |
|
{ |
219 |
11 |
if (nullProvider == null) |
220 |
|
{ |
221 |
1 |
if (instances != null) |
222 |
|
{ |
223 |
0 |
throw new Error(MessageManager.getString( |
224 |
|
"error.implementation_error_structure_selection_manager_null"), |
225 |
|
new NullPointerException(MessageManager |
226 |
|
.getString("exception.ssm_context_is_null"))); |
227 |
|
} |
228 |
|
else |
229 |
|
{ |
230 |
1 |
nullProvider = new StructureSelectionManager(); |
231 |
|
} |
232 |
1 |
return nullProvider; |
233 |
|
} |
234 |
|
} |
235 |
2253 |
if (instances == null) |
236 |
|
{ |
237 |
5 |
instances = new java.util.IdentityHashMap<>(); |
238 |
|
} |
239 |
2253 |
StructureSelectionManager instance = instances.get(context); |
240 |
2253 |
if (instance == null) |
241 |
|
{ |
242 |
48 |
if (nullProvider != null) |
243 |
|
{ |
244 |
44 |
instance = nullProvider; |
245 |
|
} |
246 |
|
else |
247 |
|
{ |
248 |
4 |
instance = new StructureSelectionManager(); |
249 |
|
} |
250 |
48 |
instances.put(context, instance); |
251 |
|
} |
252 |
2253 |
return instance; |
253 |
|
} |
254 |
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
boolean relaySeqMappings = true; |
260 |
|
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
@param |
267 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
268 |
0 |
public void setRelaySeqMappings(boolean relay)... |
269 |
|
{ |
270 |
0 |
relaySeqMappings = relay; |
271 |
|
} |
272 |
|
|
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
@return |
277 |
|
|
278 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
279 |
0 |
public boolean isRelaySeqMappingsEnabled()... |
280 |
|
{ |
281 |
0 |
return relaySeqMappings; |
282 |
|
} |
283 |
|
|
284 |
|
Vector listeners = new Vector(); |
285 |
|
|
286 |
|
|
287 |
|
|
288 |
|
|
289 |
|
@param |
290 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
291 |
246 |
public void addStructureViewerListener(Object svl)... |
292 |
|
{ |
293 |
246 |
if (!listeners.contains(svl)) |
294 |
|
{ |
295 |
245 |
listeners.addElement(svl); |
296 |
|
} |
297 |
|
} |
298 |
|
|
299 |
|
|
300 |
|
|
301 |
|
|
302 |
|
|
303 |
|
@param |
304 |
|
@return |
305 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
306 |
1 |
public String alreadyMappedToFile(String pdbid)... |
307 |
|
{ |
308 |
1 |
for (StructureMapping sm : mappings) |
309 |
|
{ |
310 |
1 |
if (sm.getPdbId().equalsIgnoreCase(pdbid)) |
311 |
|
{ |
312 |
0 |
return sm.pdbfile; |
313 |
|
} |
314 |
|
} |
315 |
1 |
return null; |
316 |
|
} |
317 |
|
|
318 |
|
|
319 |
|
|
320 |
|
|
321 |
|
|
322 |
|
@param |
323 |
|
|
324 |
|
@param |
325 |
|
|
326 |
|
|
327 |
|
@param |
328 |
|
|
329 |
|
@param |
330 |
|
|
331 |
|
@return |
332 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
333 |
16 |
synchronized public StructureFile setMapping(SequenceI[] sequence,... |
334 |
|
String[] targetChains, String pdbFile, DataSourceType protocol, |
335 |
|
IProgressIndicator progress) |
336 |
|
{ |
337 |
16 |
return computeMapping(true, sequence, targetChains, pdbFile, protocol, |
338 |
|
progress, null, null, true); |
339 |
|
} |
340 |
|
|
341 |
|
|
342 |
|
|
343 |
|
|
344 |
|
|
345 |
|
|
346 |
|
@param |
347 |
|
|
348 |
|
@param |
349 |
|
|
350 |
|
@param |
351 |
|
|
352 |
|
|
353 |
|
@param |
354 |
|
|
355 |
|
@param |
356 |
|
|
357 |
|
@return |
358 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
359 |
3 |
synchronized public StructureFile setMapping(boolean forStructureView,... |
360 |
|
SequenceI[] sequenceArray, String[] targetChainIds, |
361 |
|
String pdbFile, DataSourceType sourceType, TFType tft, |
362 |
|
String paeFilename) |
363 |
|
{ |
364 |
3 |
return setMapping(forStructureView, sequenceArray, targetChainIds, |
365 |
|
pdbFile, sourceType, tft, paeFilename, true); |
366 |
|
} |
367 |
|
|
368 |
|
|
369 |
|
|
370 |
|
|
371 |
|
|
372 |
|
|
373 |
|
@param |
374 |
|
|
375 |
|
|
376 |
|
@param |
377 |
|
|
378 |
|
@param |
379 |
|
|
380 |
|
|
381 |
|
|
382 |
|
|
383 |
|
@param |
384 |
|
|
385 |
|
@param |
386 |
|
|
387 |
|
@param |
388 |
|
|
389 |
|
|
390 |
|
@param |
391 |
|
|
392 |
|
|
393 |
|
@param |
394 |
|
|
395 |
|
|
396 |
|
@return |
397 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
398 |
12 |
synchronized public StructureFile setMapping(boolean forStructureView,... |
399 |
|
SequenceI[] sequenceArray, String[] targetChainIds, |
400 |
|
String pdbFile, DataSourceType sourceType, TFType tft, |
401 |
|
String paeFilename, boolean doXferSettings) |
402 |
|
{ |
403 |
12 |
return computeMapping(forStructureView, sequenceArray, targetChainIds, |
404 |
|
pdbFile, sourceType, null, tft, paeFilename, doXferSettings); |
405 |
|
} |
406 |
|
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
|
|
412 |
|
@param |
413 |
|
|
414 |
|
|
415 |
|
@param |
416 |
|
|
417 |
|
@param |
418 |
|
|
419 |
|
|
420 |
|
|
421 |
|
|
422 |
|
@param |
423 |
|
|
424 |
|
@param |
425 |
|
|
426 |
|
@param |
427 |
|
|
428 |
|
|
429 |
|
@param |
430 |
|
|
431 |
|
|
432 |
|
@param |
433 |
|
|
434 |
|
|
435 |
|
@param |
436 |
|
|
437 |
|
|
438 |
|
@return |
439 |
|
|
|
|
| 63.1% |
Uncovered Elements: 76 (206) |
Complexity: 55 |
Complexity Density: 0.39 |
|
440 |
28 |
synchronized public StructureFile computeMapping(boolean forStructureView,... |
441 |
|
SequenceI[] sequenceArray, String[] targetChainIds, |
442 |
|
String pdbFile, DataSourceType sourceType, |
443 |
|
IProgressIndicator progress, TFType tft, String paeFilename, |
444 |
|
boolean doXferSettings) |
445 |
|
{ |
446 |
28 |
long progressSessionId = System.currentTimeMillis() * 3; |
447 |
|
|
448 |
|
|
449 |
|
|
450 |
|
|
451 |
|
|
452 |
|
|
453 |
28 |
boolean parseSecStr = processSecondaryStructure |
454 |
|
&& !isStructureFileProcessed(pdbFile, sequenceArray); |
455 |
|
|
456 |
28 |
StructureFile pdb = null; |
457 |
28 |
boolean isMapUsingSIFTs = SiftsSettings.isMapWithSifts(); |
458 |
28 |
try |
459 |
|
{ |
460 |
|
|
461 |
28 |
sourceType = AppletFormatAdapter.checkProtocol(pdbFile); |
462 |
28 |
pdb = new JmolParser(false, pdbFile, sourceType); |
463 |
28 |
if (paeFilename != null) |
464 |
|
{ |
465 |
6 |
pdb.setPAEMatrix(paeFilename); |
466 |
|
} |
467 |
28 |
pdb.setTemperatureFactorType(tft); |
468 |
28 |
pdb.addSettings(parseSecStr && processSecondaryStructure, |
469 |
|
parseSecStr && addTempFacAnnot, |
470 |
|
parseSecStr && secStructServices); |
471 |
|
|
472 |
28 |
boolean temp = pdb.getDoXferSettings(); |
473 |
28 |
pdb.setDoXferSettings(doXferSettings); |
474 |
28 |
pdb.doParse(); |
475 |
28 |
pdb.setDoXferSettings(temp); |
476 |
28 |
if (pdb.getId() != null && pdb.getId().trim().length() > 0 |
477 |
|
&& DataSourceType.FILE == sourceType) |
478 |
|
{ |
479 |
16 |
registerPDBFile(pdb.getId().trim(), pdbFile); |
480 |
|
} |
481 |
|
|
482 |
|
|
483 |
|
|
484 |
|
|
485 |
28 |
boolean isProtein = false; |
486 |
28 |
for (SequenceI s : sequenceArray) |
487 |
|
{ |
488 |
28 |
if (s.isProtein()) |
489 |
|
{ |
490 |
28 |
isProtein = true; |
491 |
28 |
break; |
492 |
|
} |
493 |
|
} |
494 |
28 |
isMapUsingSIFTs = isMapUsingSIFTs && pdb.isPPDBIdAvailable() |
495 |
|
&& !pdb.getId().startsWith("AF-") && isProtein; |
496 |
|
|
497 |
|
} catch (Exception ex) |
498 |
|
{ |
499 |
0 |
ex.printStackTrace(); |
500 |
0 |
return null; |
501 |
|
} |
502 |
|
|
503 |
|
|
504 |
|
|
505 |
28 |
SiftsClient siftsClient = null; |
506 |
28 |
try |
507 |
|
{ |
508 |
28 |
if (isMapUsingSIFTs) |
509 |
|
{ |
510 |
0 |
siftsClient = new SiftsClient(pdb); |
511 |
|
} |
512 |
|
} catch (SiftsException e) |
513 |
|
{ |
514 |
0 |
isMapUsingSIFTs = false; |
515 |
0 |
Console.error("SIFTS mapping failed", e); |
516 |
0 |
Console.error("Falling back on Needleman & Wunsch alignment"); |
517 |
0 |
siftsClient = null; |
518 |
|
} |
519 |
|
|
520 |
28 |
String targetChainId; |
521 |
60 |
for (int s = 0; s < sequenceArray.length; s++) |
522 |
|
{ |
523 |
32 |
boolean infChain = true; |
524 |
32 |
final SequenceI seq = sequenceArray[s]; |
525 |
32 |
SequenceI ds = seq; |
526 |
62 |
while (ds.getDatasetSequence() != null) |
527 |
|
{ |
528 |
30 |
ds = ds.getDatasetSequence(); |
529 |
|
} |
530 |
32 |
List <PDBEntry> putativePDBe = PDBEntryUtils.selectPutativePDBe(seq,ds, pdb); |
531 |
|
|
532 |
32 |
if (targetChainIds != null && targetChainIds[s] != null) |
533 |
|
{ |
534 |
3 |
infChain = false; |
535 |
3 |
targetChainId = targetChainIds[s]; |
536 |
|
} |
537 |
|
else { |
538 |
29 |
targetChainId = PDBEntryUtils.inferChainId(seq); |
539 |
|
} |
540 |
|
|
541 |
|
|
542 |
|
|
543 |
|
|
544 |
|
|
545 |
32 |
float max = -10; |
546 |
32 |
AlignSeq maxAlignseq = null; |
547 |
32 |
String maxChainId = " "; |
548 |
32 |
PDBChain maxChain = null; |
549 |
32 |
boolean first = true; |
550 |
32 |
PDBChain idLengthChain = null; |
551 |
32 |
for (PDBChain chain : pdb.getChains()) |
552 |
|
{ |
553 |
60 |
if (targetChainId.length() > 0 && !targetChainId.equals(chain.id) |
554 |
|
&& !infChain) |
555 |
|
{ |
556 |
6 |
continue; |
557 |
|
} |
558 |
54 |
PDBEntry putativeChain = null; |
559 |
? |
if (!putativePDBe.isEmpty() && (putativeChain = PDBEntryUtils |
560 |
|
.selectPutativePDBEntry(putativePDBe, chain)) == null) |
561 |
|
{ |
562 |
19 |
continue; |
563 |
|
} |
564 |
|
|
565 |
|
|
566 |
35 |
final String type = chain.isNa ? AlignSeq.DNA : AlignSeq.PEP; |
567 |
35 |
AlignSeq as = AlignSeq.doGlobalNWAlignment(seq, chain.sequence, |
568 |
|
type); |
569 |
|
|
570 |
35 |
if (as.s1str.length() == as.s2str.length()) |
571 |
|
{ |
572 |
31 |
idLengthChain = chain; |
573 |
|
} |
574 |
|
|
575 |
35 |
if (first || as.maxscore > max |
576 |
|
|| (as.maxscore == max && chain.id.equals(targetChainId))) |
577 |
|
{ |
578 |
33 |
first = false; |
579 |
33 |
maxChain = chain; |
580 |
33 |
max = as.maxscore; |
581 |
33 |
maxAlignseq = as; |
582 |
33 |
maxChainId = chain.id; |
583 |
|
} |
584 |
|
} |
585 |
32 |
if (maxChain == null) |
586 |
|
{ |
587 |
0 |
continue; |
588 |
|
} |
589 |
32 |
if (sourceType == DataSourceType.PASTE) |
590 |
|
{ |
591 |
16 |
pdbFile = "INLINE" + pdb.getId(); |
592 |
|
} |
593 |
32 |
List<StructureMapping> seqToStrucMapping = new ArrayList<>(); |
594 |
|
|
595 |
32 |
List<StructureMapping> foundSiftsMappings = new ArrayList<>(); |
596 |
32 |
String provider = null; |
597 |
32 |
if (isMapUsingSIFTs && seq.isProtein()) |
598 |
|
{ |
599 |
0 |
if (progress != null) |
600 |
|
{ |
601 |
0 |
progress.setProgressBar( |
602 |
|
MessageManager |
603 |
|
.getString("status.obtaining_mapping_with_sifts"), |
604 |
|
progressSessionId); |
605 |
|
} |
606 |
0 |
jalview.datamodel.Mapping sqmpping = maxAlignseq |
607 |
|
.getMappingFromS1(false); |
608 |
0 |
if (targetChainId != null && !targetChainId.trim().isEmpty()) |
609 |
|
{ |
610 |
0 |
StructureMapping siftsMapping; |
611 |
0 |
try |
612 |
|
{ |
613 |
0 |
siftsMapping = getStructureMapping(seq, pdbFile, targetChainId, |
614 |
|
pdb, maxChain, sqmpping, maxAlignseq, siftsClient); |
615 |
0 |
seqToStrucMapping.add(siftsMapping); |
616 |
0 |
maxChain.makeExactMapping(siftsMapping, seq); |
617 |
0 |
maxChain.transferRESNUMFeatures(seq, "IEA: SIFTS", |
618 |
|
pdb.getId().toLowerCase(Locale.ROOT)); |
619 |
0 |
maxChain.transferResidueAnnotation(siftsMapping, null); |
620 |
0 |
ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0)); |
621 |
0 |
foundSiftsMappings.add(siftsMapping); |
622 |
|
|
623 |
|
} catch (SiftsException e) |
624 |
|
{ |
625 |
0 |
Console.error(e.getMessage()); |
626 |
|
} |
627 |
|
} |
628 |
|
else |
629 |
|
{ |
630 |
0 |
for (PDBChain chain : pdb.getChains()) |
631 |
|
{ |
632 |
0 |
StructureMapping siftsMapping = null; |
633 |
0 |
try |
634 |
|
{ |
635 |
0 |
siftsMapping = getStructureMapping(seq, pdbFile, chain.id, |
636 |
|
pdb, chain, sqmpping, maxAlignseq, siftsClient); |
637 |
0 |
foundSiftsMappings.add(siftsMapping); |
638 |
0 |
chain.makeExactMapping(siftsMapping, seq); |
639 |
0 |
chain.transferRESNUMFeatures(seq, "IEA: SIFTS", |
640 |
|
pdb.getId().toLowerCase(Locale.ROOT)); |
641 |
|
|
642 |
0 |
chain.transferResidueAnnotation(siftsMapping, null); |
643 |
|
} catch (SiftsException e) |
644 |
|
{ |
645 |
0 |
jalview.bin.Console.errPrintln(e.getMessage()); |
646 |
|
} catch (Exception e) |
647 |
|
{ |
648 |
0 |
jalview.bin.Console.errPrintln( |
649 |
|
"Unexpected exception during SIFTS mapping - falling back to NW for this sequence/structure pair"); |
650 |
0 |
jalview.bin.Console.errPrintln(e.getMessage()); |
651 |
|
} |
652 |
|
} |
653 |
|
|
654 |
0 |
if (!foundSiftsMappings.isEmpty()) |
655 |
|
{ |
656 |
0 |
ds.addPDBId(sqmpping.getTo().getAllPDBEntries().get(0)); |
657 |
|
} |
658 |
|
} |
659 |
|
|
660 |
|
|
661 |
0 |
if (!foundSiftsMappings.isEmpty()) |
662 |
|
{ |
663 |
0 |
seqToStrucMapping.addAll(foundSiftsMappings); |
664 |
|
} |
665 |
|
} |
666 |
32 |
if (foundSiftsMappings.isEmpty()) |
667 |
|
{ |
668 |
|
|
669 |
|
|
670 |
|
|
671 |
32 |
if (idLengthChain != null && maxAlignseq.getS2Coverage() < 0.75) |
672 |
|
{ |
673 |
0 |
Console.info( |
674 |
|
"Assuming 3Dsi identity mapping between structure and sequence"); |
675 |
0 |
StructureMapping matchMapping = getIdMappings(seq, pdbFile, |
676 |
|
idLengthChain.id, idLengthChain, pdb); |
677 |
0 |
seqToStrucMapping.add(matchMapping); |
678 |
0 |
ds.addPDBId(idLengthChain.sequence.getAllPDBEntries().get(0)); |
679 |
0 |
Console.info("Mapping added."); |
680 |
|
} |
681 |
|
else |
682 |
|
{ |
683 |
32 |
if (maxAlignseq.getS1Coverage()<0.15 && maxAlignseq.getS2Coverage()<0.15) |
684 |
|
{ |
685 |
|
|
686 |
0 |
continue; |
687 |
|
} |
688 |
|
|
689 |
32 |
if (progress != null) |
690 |
|
{ |
691 |
0 |
progress.setProgressBar( |
692 |
|
MessageManager.getString( |
693 |
|
"status.obtaining_mapping_with_nw_alignment"), |
694 |
|
progressSessionId); |
695 |
|
} |
696 |
32 |
StructureMapping nwMapping = getNWMappings(seq, pdbFile, |
697 |
|
maxChainId, maxChain, pdb, maxAlignseq); |
698 |
32 |
seqToStrucMapping.add(nwMapping); |
699 |
32 |
ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0)); |
700 |
|
} |
701 |
|
} |
702 |
|
|
703 |
|
|
704 |
|
|
705 |
|
|
706 |
32 |
String ssAnnotDescriptionInPDB = null; |
707 |
32 |
String ssStructFilePathNameInPDB = pdb.getInFile(); |
708 |
|
|
709 |
|
|
710 |
32 |
AlignmentAnnotation[] ssAnnotationsInPDB = pdb.getSeqs().get(0) |
711 |
|
.getAnnotation(Constants.SS_ANNOTATION_LABEL); |
712 |
32 |
if (ssAnnotationsInPDB != null && ssAnnotationsInPDB.length > 0) |
713 |
|
{ |
714 |
16 |
ssAnnotDescriptionInPDB = ssAnnotationsInPDB[0].description; |
715 |
|
} |
716 |
|
|
717 |
|
|
718 |
|
|
719 |
32 |
if (ssStructFilePathNameInPDB != null |
720 |
|
&& seq.getDatasetSequence() != null) |
721 |
|
{ |
722 |
30 |
Vector<PDBEntry> pdbEntries = seq.getDatasetSequence() |
723 |
|
.getAllPDBEntries(); |
724 |
30 |
if (pdbEntries != null) |
725 |
|
{ |
726 |
30 |
for (PDBEntry pdbEntry : pdbEntries) |
727 |
|
{ |
728 |
30 |
if (pdbEntry.getFile() != null && ssStructFilePathNameInPDB |
729 |
|
.startsWith(pdbEntry.getFile())) |
730 |
|
{ |
731 |
14 |
provider = pdbEntry.getProvider(); |
732 |
14 |
break; |
733 |
|
} |
734 |
|
} |
735 |
|
|
736 |
30 |
if (provider != null) |
737 |
|
{ |
738 |
|
|
739 |
|
|
740 |
0 |
AlignmentAnnotation[] ssAnnotList = ds |
741 |
|
.getAnnotation(Constants.SS_ANNOTATION_LABEL); |
742 |
0 |
if (ssAnnotList != null) |
743 |
|
{ |
744 |
0 |
for (AlignmentAnnotation ssAnnot : ssAnnotList) |
745 |
|
{ |
746 |
|
|
747 |
|
|
748 |
0 |
if (ssAnnot |
749 |
|
.getProperty(Constants.SS_PROVIDER_PROPERTY) == null |
750 |
|
&& ssAnnot.description |
751 |
|
.equals(ssAnnotDescriptionInPDB)) |
752 |
|
{ |
753 |
0 |
ssAnnot.setProperty(Constants.SS_PROVIDER_PROPERTY, |
754 |
|
provider); |
755 |
|
} |
756 |
|
} |
757 |
|
} |
758 |
|
} |
759 |
|
} |
760 |
|
} |
761 |
|
|
762 |
32 |
if (forStructureView) |
763 |
|
{ |
764 |
23 |
for (StructureMapping sm : seqToStrucMapping) |
765 |
|
{ |
766 |
23 |
addStructureMapping(sm); |
767 |
|
} |
768 |
|
} |
769 |
32 |
if (progress != null) |
770 |
|
{ |
771 |
0 |
progress.setProgressBar(null, progressSessionId); |
772 |
|
} |
773 |
|
} |
774 |
28 |
return pdb; |
775 |
|
} |
776 |
|
|
777 |
|
|
778 |
|
|
779 |
|
|
780 |
|
|
781 |
|
@param |
782 |
|
@param |
783 |
|
@return |
784 |
|
|
|
|
| 90% |
Uncovered Elements: 2 (20) |
Complexity: 5 |
Complexity Density: 0.42 |
|
785 |
15 |
private boolean isStructureFileProcessed(String pdbFile,... |
786 |
|
SequenceI[] sequenceArray) |
787 |
|
{ |
788 |
15 |
boolean processed = false; |
789 |
15 |
if (isPDBFileRegistered(pdbFile)) |
790 |
|
{ |
791 |
6 |
for (SequenceI sq : sequenceArray) |
792 |
|
{ |
793 |
6 |
SequenceI ds = sq; |
794 |
12 |
while (ds.getDatasetSequence() != null) |
795 |
|
{ |
796 |
6 |
ds = ds.getDatasetSequence(); |
797 |
|
} |
798 |
6 |
; |
799 |
6 |
if (ds.getAnnotation() != null) |
800 |
|
{ |
801 |
4 |
for (AlignmentAnnotation ala : ds.getAnnotation()) |
802 |
|
{ |
803 |
|
|
804 |
|
|
805 |
|
|
806 |
8 |
if (PDBfile.isCalcIdForFile(ala, findIdForPDBFile(pdbFile))) |
807 |
|
{ |
808 |
0 |
processed = true; |
809 |
|
} |
810 |
|
} |
811 |
|
} |
812 |
|
} |
813 |
|
} |
814 |
15 |
return processed; |
815 |
|
} |
816 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
817 |
30 |
public void addStructureMapping(StructureMapping sm)... |
818 |
|
{ |
819 |
30 |
if (!mappings.contains(sm)) |
820 |
|
{ |
821 |
29 |
mappings.add(sm); |
822 |
|
} |
823 |
|
} |
824 |
|
|
825 |
|
|
826 |
|
|
827 |
|
|
828 |
|
|
829 |
|
@param |
830 |
|
@param |
831 |
|
@param |
832 |
|
@param |
833 |
|
@param |
834 |
|
@param |
835 |
|
@param |
836 |
|
@param |
837 |
|
|
838 |
|
@return |
839 |
|
@throws |
840 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
841 |
0 |
private StructureMapping getStructureMapping(SequenceI seq,... |
842 |
|
String pdbFile, String targetChainId, StructureFile pdb, |
843 |
|
PDBChain maxChain, jalview.datamodel.Mapping sqmpping, |
844 |
|
AlignSeq maxAlignseq, SiftsClient siftsClient) |
845 |
|
throws SiftsException |
846 |
|
{ |
847 |
0 |
StructureMapping curChainMapping = siftsClient |
848 |
|
.getSiftsStructureMapping(seq, pdbFile, targetChainId); |
849 |
0 |
try |
850 |
|
{ |
851 |
0 |
PDBChain chain = pdb.findChain(targetChainId); |
852 |
0 |
if (chain != null) |
853 |
|
{ |
854 |
0 |
chain.transferResidueAnnotation(curChainMapping, null); |
855 |
|
} |
856 |
|
} catch (Exception e) |
857 |
|
{ |
858 |
0 |
e.printStackTrace(); |
859 |
|
} |
860 |
0 |
return curChainMapping; |
861 |
|
} |
862 |
|
|
863 |
|
|
864 |
|
|
865 |
|
@param |
866 |
|
@param |
867 |
|
@param |
868 |
|
@param |
869 |
|
@param |
870 |
|
@param |
871 |
|
@return |
872 |
|
|
873 |
|
|
|
|
| 97.4% |
Uncovered Elements: 1 (39) |
Complexity: 6 |
Complexity Density: 0.18 |
|
874 |
32 |
private StructureMapping getNWMappings(SequenceI seq, String pdbFile,... |
875 |
|
String maxChainId, PDBChain maxChain, StructureFile pdb, |
876 |
|
AlignSeq maxAlignseq) |
877 |
|
{ |
878 |
32 |
final StringBuilder mappingDetails = new StringBuilder(128); |
879 |
32 |
mappingDetails.append(NEWLINE) |
880 |
|
.append("Sequence \u27f7 Structure mapping details"); |
881 |
32 |
mappingDetails.append(NEWLINE); |
882 |
32 |
mappingDetails |
883 |
|
.append("Method: inferred with Needleman & Wunsch alignment"); |
884 |
32 |
mappingDetails.append(NEWLINE).append("PDB Sequence is :") |
885 |
|
.append(NEWLINE).append("Sequence = ") |
886 |
|
.append(maxChain.sequence.getSequenceAsString()); |
887 |
32 |
mappingDetails.append(NEWLINE).append("No of residues = ") |
888 |
|
.append(maxChain.residues.size()).append(NEWLINE) |
889 |
|
.append(NEWLINE); |
890 |
32 |
PrintStream ps = new PrintStream(System.out) |
891 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
892 |
32 |
@Override... |
893 |
|
public void print(String x) |
894 |
|
{ |
895 |
32 |
mappingDetails.append(x); |
896 |
|
} |
897 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
898 |
0 |
@Override... |
899 |
|
public void println() |
900 |
|
{ |
901 |
0 |
mappingDetails.append(NEWLINE); |
902 |
|
} |
903 |
|
}; |
904 |
|
|
905 |
32 |
maxAlignseq.printAlignment(ps); |
906 |
|
|
907 |
32 |
mappingDetails.append(NEWLINE).append("PDB start/end "); |
908 |
32 |
mappingDetails.append(String.valueOf(maxAlignseq.seq2start)) |
909 |
|
.append(" "); |
910 |
32 |
mappingDetails.append(String.valueOf(maxAlignseq.seq2end)); |
911 |
32 |
mappingDetails.append(NEWLINE).append("SEQ start/end "); |
912 |
32 |
mappingDetails |
913 |
|
.append(String |
914 |
|
.valueOf(maxAlignseq.seq1start + (seq.getStart() - 1))) |
915 |
|
.append(" "); |
916 |
32 |
mappingDetails.append( |
917 |
|
String.valueOf(maxAlignseq.seq1end + (seq.getStart() - 1))); |
918 |
32 |
mappingDetails.append(NEWLINE); |
919 |
32 |
maxChain.makeExactMapping(maxAlignseq, seq); |
920 |
32 |
jalview.datamodel.Mapping sqmpping = maxAlignseq |
921 |
|
.getMappingFromS1(false); |
922 |
32 |
maxChain.transferRESNUMFeatures(seq, null, |
923 |
|
pdb.getId().toLowerCase(Locale.ROOT)); |
924 |
|
|
925 |
32 |
HashMap<Integer, int[]> mapping = new HashMap<>(); |
926 |
32 |
int resNum = -10000; |
927 |
32 |
int index = 0; |
928 |
32 |
char insCode = ' '; |
929 |
|
|
930 |
32 |
do |
931 |
|
{ |
932 |
3481 |
Atom tmp = maxChain.atoms.elementAt(index); |
933 |
3481 |
if ((resNum != tmp.resNumber || insCode != tmp.insCode) |
934 |
|
&& tmp.alignmentMapping != -1) |
935 |
|
{ |
936 |
3480 |
resNum = tmp.resNumber; |
937 |
3480 |
insCode = tmp.insCode; |
938 |
3480 |
if (tmp.alignmentMapping >= -1) |
939 |
|
{ |
940 |
3480 |
mapping.put(tmp.alignmentMapping + 1, |
941 |
|
new int[] |
942 |
|
{ tmp.resNumber, tmp.atomIndex }); |
943 |
|
} |
944 |
|
} |
945 |
|
|
946 |
3481 |
index++; |
947 |
3481 |
} while (index < maxChain.atoms.size()); |
948 |
|
|
949 |
32 |
StructureMapping nwMapping = new StructureMapping(seq, pdbFile, |
950 |
|
pdb.getId(), maxChainId, mapping, mappingDetails.toString()); |
951 |
32 |
maxChain.transferResidueAnnotation(nwMapping, sqmpping); |
952 |
32 |
return nwMapping; |
953 |
|
} |
954 |
|
|
955 |
|
|
956 |
|
|
957 |
|
@param |
958 |
|
@param |
959 |
|
@param |
960 |
|
@param |
961 |
|
@param |
962 |
|
@return |
963 |
|
|
964 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 6 |
Complexity Density: 0.21 |
|
965 |
0 |
private StructureMapping getIdMappings(SequenceI seq, String pdbFile,... |
966 |
|
String identityChainId, PDBChain identityChain, StructureFile pdb) |
967 |
|
{ |
968 |
0 |
final StringBuilder mappingDetails = new StringBuilder(128); |
969 |
0 |
mappingDetails.append(NEWLINE) |
970 |
|
.append("Sequence \u27f7 Structure mapping details"); |
971 |
0 |
mappingDetails.append(NEWLINE); |
972 |
0 |
mappingDetails.append("Method: Matching length 1:1"); |
973 |
0 |
mappingDetails.append(NEWLINE).append("PDB Sequence is :") |
974 |
|
.append(NEWLINE).append("Sequence = ") |
975 |
|
.append(identityChain.sequence.getSequenceAsString()); |
976 |
0 |
mappingDetails.append(NEWLINE).append("No of residues = ") |
977 |
|
.append(identityChain.residues.size()).append(NEWLINE) |
978 |
|
.append(NEWLINE); |
979 |
|
|
980 |
0 |
mappingDetails.append(NEWLINE) |
981 |
|
.append("Aligned Sequence is: " + seq.getDisplayId(true)); |
982 |
0 |
mappingDetails.append(NEWLINE) |
983 |
|
.append("Sequence = " + seq.getSequenceAsString()); |
984 |
|
|
985 |
0 |
int from = Math.max(seq.getStart(),identityChain.sequence.getStart()); |
986 |
0 |
int to = Math.min(seq.getEnd(), identityChain.sequence.getEnd()); |
987 |
0 |
jalview.datamodel.Mapping sqmpping = new jalview.datamodel.Mapping(seq, |
988 |
|
new MapList(new int[] |
989 |
|
{ from,to }, |
990 |
|
new int[] |
991 |
|
{ from,to }, |
992 |
|
1, 1)); |
993 |
0 |
identityChain.mapChainWith(sqmpping, seq); |
994 |
|
|
995 |
0 |
identityChain.transferRESNUMFeatures(seq, null, |
996 |
|
pdb.getId().toLowerCase(Locale.ROOT)); |
997 |
|
|
998 |
|
|
999 |
|
|
1000 |
0 |
HashMap<Integer, int[]> mapping = new HashMap<>(); |
1001 |
0 |
int resNum = -10000; |
1002 |
0 |
int index = 0; |
1003 |
0 |
char insCode = ' '; |
1004 |
|
|
1005 |
0 |
do |
1006 |
|
{ |
1007 |
0 |
Atom tmp = identityChain.atoms.elementAt(index); |
1008 |
0 |
if ((resNum != tmp.resNumber || insCode != tmp.insCode) |
1009 |
|
&& tmp.alignmentMapping != -1) |
1010 |
|
{ |
1011 |
0 |
resNum = tmp.resNumber; |
1012 |
0 |
insCode = tmp.insCode; |
1013 |
0 |
if (tmp.alignmentMapping >= -1) |
1014 |
|
{ |
1015 |
0 |
mapping.put(tmp.alignmentMapping + 1, |
1016 |
|
new int[] |
1017 |
|
{ tmp.resNumber, tmp.atomIndex }); |
1018 |
|
} |
1019 |
|
} |
1020 |
|
|
1021 |
0 |
index++; |
1022 |
0 |
} while (index < identityChain.atoms.size()); |
1023 |
|
|
1024 |
0 |
StructureMapping idMapping = new StructureMapping(seq, pdbFile, |
1025 |
|
pdb.getId(), identityChainId, mapping, |
1026 |
|
mappingDetails.toString()); |
1027 |
0 |
identityChain.transferResidueAnnotation(idMapping, sqmpping); |
1028 |
0 |
return idMapping; |
1029 |
|
} |
1030 |
|
|
|
|
| 94.4% |
Uncovered Elements: 2 (36) |
Complexity: 9 |
Complexity Density: 0.45 |
|
1031 |
248 |
public void removeStructureViewerListener(Object svl, String[] pdbfiles)... |
1032 |
|
{ |
1033 |
248 |
listeners.removeElement(svl); |
1034 |
248 |
if (svl instanceof SequenceListener) |
1035 |
|
{ |
1036 |
424 |
for (int i = 0; i < listeners.size(); i++) |
1037 |
|
{ |
1038 |
178 |
if (listeners.elementAt(i) instanceof StructureListener) |
1039 |
|
{ |
1040 |
4 |
((StructureListener) listeners.elementAt(i)) |
1041 |
|
.releaseReferences(svl); |
1042 |
|
} |
1043 |
|
} |
1044 |
|
} |
1045 |
|
|
1046 |
248 |
if (pdbfiles == null) |
1047 |
|
{ |
1048 |
246 |
return; |
1049 |
|
} |
1050 |
|
|
1051 |
|
|
1052 |
|
|
1053 |
|
|
1054 |
|
|
1055 |
2 |
List<String> pdbs = new ArrayList<>(Arrays.asList(pdbfiles)); |
1056 |
|
|
1057 |
2 |
StructureListener sl; |
1058 |
6 |
for (int i = 0; i < listeners.size(); i++) |
1059 |
|
{ |
1060 |
4 |
if (listeners.elementAt(i) instanceof StructureListener) |
1061 |
|
{ |
1062 |
1 |
sl = (StructureListener) listeners.elementAt(i); |
1063 |
1 |
for (String pdbfile : sl.getStructureFiles()) |
1064 |
|
{ |
1065 |
2 |
pdbs.remove(pdbfile); |
1066 |
|
} |
1067 |
|
} |
1068 |
|
} |
1069 |
|
|
1070 |
|
|
1071 |
|
|
1072 |
|
|
1073 |
|
|
1074 |
2 |
if (pdbs.size() > 0) |
1075 |
|
{ |
1076 |
1 |
List<StructureMapping> tmp = new ArrayList<>(); |
1077 |
1 |
for (StructureMapping sm : mappings) |
1078 |
|
{ |
1079 |
2 |
if (!pdbs.contains(sm.pdbfile)) |
1080 |
|
{ |
1081 |
0 |
tmp.add(sm); |
1082 |
|
} |
1083 |
|
} |
1084 |
|
|
1085 |
1 |
mappings = tmp; |
1086 |
|
} |
1087 |
|
} |
1088 |
|
|
1089 |
|
|
1090 |
|
|
1091 |
|
|
1092 |
|
@param |
1093 |
|
@param |
1094 |
|
|
1095 |
|
@param |
1096 |
|
@param |
1097 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 5 |
Complexity Density: 0.31 |
|
1098 |
0 |
public void highlightPositionsOn(SequenceI sequenceRef, int[][] is,... |
1099 |
|
Object source) |
1100 |
|
{ |
1101 |
0 |
boolean hasSequenceListeners = handlingVamsasMo |
1102 |
|
|| !seqmappings.isEmpty(); |
1103 |
0 |
SearchResultsI results = null; |
1104 |
0 |
ArrayList<Integer> listOfPositions = new ArrayList<Integer>(); |
1105 |
0 |
for (int[] s_e : is) |
1106 |
|
{ |
1107 |
0 |
for (int p = s_e[0]; p <= s_e[1]; listOfPositions.add(p++)) |
1108 |
0 |
; |
1109 |
|
} |
1110 |
0 |
int seqpos[] = new int[listOfPositions.size()]; |
1111 |
0 |
int i = 0; |
1112 |
0 |
for (Integer p : listOfPositions) |
1113 |
|
{ |
1114 |
0 |
seqpos[i++] = p; |
1115 |
|
} |
1116 |
|
|
1117 |
0 |
for (i = 0; i < listeners.size(); i++) |
1118 |
|
{ |
1119 |
0 |
Object listener = listeners.elementAt(i); |
1120 |
0 |
if (listener == source) |
1121 |
|
{ |
1122 |
|
|
1123 |
|
|
1124 |
0 |
continue; |
1125 |
|
} |
1126 |
0 |
if (listener instanceof StructureListener) |
1127 |
|
{ |
1128 |
0 |
highlightStructure((StructureListener) listener, sequenceRef, |
1129 |
|
seqpos); |
1130 |
|
} |
1131 |
|
|
1132 |
|
} |
1133 |
|
} |
1134 |
|
|
1135 |
|
|
1136 |
|
|
1137 |
|
|
1138 |
|
@param |
1139 |
|
@param |
1140 |
|
@param |
1141 |
|
@return |
1142 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1143 |
1 |
public String mouseOverStructure(int pdbResNum, String chain,... |
1144 |
|
String pdbfile) |
1145 |
|
{ |
1146 |
1 |
AtomSpec atomSpec = new AtomSpec(pdbfile, chain, pdbResNum, 0); |
1147 |
1 |
List<AtomSpec> atoms = Collections.singletonList(atomSpec); |
1148 |
1 |
return mouseOverStructure(atoms); |
1149 |
|
} |
1150 |
|
|
1151 |
|
|
1152 |
|
|
1153 |
|
|
1154 |
|
@param |
1155 |
|
|
|
|
| 78.6% |
Uncovered Elements: 6 (28) |
Complexity: 7 |
Complexity Density: 0.44 |
|
1156 |
1 |
public String mouseOverStructure(List<AtomSpec> atoms)... |
1157 |
|
{ |
1158 |
1 |
if (listeners == null) |
1159 |
|
{ |
1160 |
|
|
1161 |
0 |
return null; |
1162 |
|
} |
1163 |
1 |
boolean hasSequenceListener = false; |
1164 |
3 |
for (int i = 0; i < listeners.size(); i++) |
1165 |
|
{ |
1166 |
2 |
if (listeners.elementAt(i) instanceof SequenceListener) |
1167 |
|
{ |
1168 |
1 |
hasSequenceListener = true; |
1169 |
|
} |
1170 |
|
} |
1171 |
1 |
if (!hasSequenceListener) |
1172 |
|
{ |
1173 |
0 |
return null; |
1174 |
|
} |
1175 |
|
|
1176 |
1 |
SearchResultsI results = findAlignmentPositionsForStructurePositions( |
1177 |
|
atoms); |
1178 |
1 |
String result = null; |
1179 |
1 |
for (Object li : listeners) |
1180 |
|
{ |
1181 |
2 |
if (li instanceof SequenceListener) |
1182 |
|
{ |
1183 |
1 |
String s = ((SequenceListener) li).highlightSequence(results); |
1184 |
1 |
if (s != null) |
1185 |
|
{ |
1186 |
0 |
result = s; |
1187 |
|
} |
1188 |
|
} |
1189 |
|
} |
1190 |
1 |
return result; |
1191 |
|
} |
1192 |
|
|
1193 |
|
|
1194 |
|
|
1195 |
|
|
1196 |
|
|
1197 |
|
|
1198 |
|
@param |
1199 |
|
@return |
1200 |
|
|
|
|
| 88.9% |
Uncovered Elements: 2 (18) |
Complexity: 5 |
Complexity Density: 0.36 |
|
1201 |
1 |
public SearchResultsI findAlignmentPositionsForStructurePositions(... |
1202 |
|
List<AtomSpec> atoms) |
1203 |
|
{ |
1204 |
1 |
SearchResultsI results = new SearchResults(); |
1205 |
1 |
for (AtomSpec atom : atoms) |
1206 |
|
{ |
1207 |
1 |
SequenceI lastseq = null; |
1208 |
1 |
int lastipos = -1; |
1209 |
1 |
for (StructureMapping sm : mappings) |
1210 |
|
{ |
1211 |
2 |
if (sm.pdbfile.equals(atom.getPdbFile()) |
1212 |
|
&& sm.pdbchain.equals(atom.getChain())) |
1213 |
|
{ |
1214 |
1 |
int indexpos = sm.getSeqPos(atom.getPdbResNum()); |
1215 |
1 |
if (lastipos != indexpos || lastseq != sm.sequence) |
1216 |
|
{ |
1217 |
1 |
results.appendResult(sm.sequence, indexpos, indexpos); |
1218 |
1 |
lastipos = indexpos; |
1219 |
1 |
lastseq = sm.sequence; |
1220 |
|
|
1221 |
1 |
for (AlignedCodonFrame acf : seqmappings) |
1222 |
|
{ |
1223 |
0 |
acf.markMappedRegion(sm.sequence, indexpos, results); |
1224 |
|
} |
1225 |
|
} |
1226 |
|
} |
1227 |
|
} |
1228 |
|
} |
1229 |
1 |
return results; |
1230 |
|
} |
1231 |
|
|
1232 |
|
|
1233 |
|
|
1234 |
|
|
1235 |
|
@param |
1236 |
|
|
1237 |
|
@param |
1238 |
|
|
1239 |
|
@param |
1240 |
|
|
1241 |
|
|
1242 |
|
|
|
|
| 0% |
Uncovered Elements: 48 (48) |
Complexity: 15 |
Complexity Density: 0.62 |
|
1243 |
0 |
public void mouseOverSequence(SequenceI seq, int indexpos, int seqPos,... |
1244 |
|
VamsasSource source) |
1245 |
|
{ |
1246 |
0 |
boolean hasSequenceListeners = handlingVamsasMo |
1247 |
|
|| !seqmappings.isEmpty(); |
1248 |
0 |
SearchResultsI results = null; |
1249 |
0 |
if (seqPos == -1) |
1250 |
|
{ |
1251 |
0 |
seqPos = seq.findPosition(indexpos); |
1252 |
|
} |
1253 |
0 |
for (int i = 0; i < listeners.size(); i++) |
1254 |
|
{ |
1255 |
0 |
Object listener = listeners.elementAt(i); |
1256 |
0 |
if (listener == source) |
1257 |
|
{ |
1258 |
|
|
1259 |
|
|
1260 |
0 |
continue; |
1261 |
|
} |
1262 |
0 |
if (listener instanceof StructureListener) |
1263 |
|
{ |
1264 |
0 |
highlightStructure((StructureListener) listener, seq, seqPos); |
1265 |
|
} |
1266 |
|
else |
1267 |
|
{ |
1268 |
0 |
if (listener instanceof SequenceListener) |
1269 |
|
{ |
1270 |
0 |
final SequenceListener seqListener = (SequenceListener) listener; |
1271 |
0 |
if (hasSequenceListeners |
1272 |
|
&& seqListener.getVamsasSource() != source) |
1273 |
|
{ |
1274 |
0 |
if (relaySeqMappings) |
1275 |
|
{ |
1276 |
0 |
if (results == null) |
1277 |
|
{ |
1278 |
0 |
results = MappingUtils.buildSearchResults(seq, seqPos, |
1279 |
|
seqmappings); |
1280 |
|
} |
1281 |
0 |
if (handlingVamsasMo) |
1282 |
|
{ |
1283 |
0 |
results.addResult(seq, seqPos, seqPos); |
1284 |
|
|
1285 |
|
} |
1286 |
0 |
if (!results.isEmpty()) |
1287 |
|
{ |
1288 |
0 |
seqListener.highlightSequence(results); |
1289 |
|
} |
1290 |
|
} |
1291 |
|
} |
1292 |
|
} |
1293 |
0 |
else if (listener instanceof VamsasListener && !handlingVamsasMo) |
1294 |
|
{ |
1295 |
0 |
((VamsasListener) listener).mouseOverSequence(seq, indexpos, |
1296 |
|
source); |
1297 |
|
} |
1298 |
0 |
else if (listener instanceof SecondaryStructureListener) |
1299 |
|
{ |
1300 |
0 |
((SecondaryStructureListener) listener).mouseOverSequence(seq, |
1301 |
|
indexpos, seqPos); |
1302 |
|
} |
1303 |
|
} |
1304 |
|
} |
1305 |
|
} |
1306 |
|
|
1307 |
|
|
1308 |
|
|
1309 |
|
|
1310 |
|
|
1311 |
|
@param |
1312 |
|
@param |
1313 |
|
@param |
1314 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 7 |
Complexity Density: 0.64 |
|
1315 |
0 |
public void highlightStructure(StructureListener sl, SequenceI seq,... |
1316 |
|
int... positions) |
1317 |
|
{ |
1318 |
0 |
if (!sl.isListeningFor(seq)) |
1319 |
|
{ |
1320 |
0 |
return; |
1321 |
|
} |
1322 |
0 |
int atomNo; |
1323 |
0 |
List<AtomSpec> atoms = new ArrayList<>(); |
1324 |
0 |
for (StructureMapping sm : mappings) |
1325 |
|
{ |
1326 |
0 |
if (sm.sequence == seq || sm.sequence == seq.getDatasetSequence() |
1327 |
|
|| (sm.sequence.getDatasetSequence() != null && sm.sequence |
1328 |
|
.getDatasetSequence() == seq.getDatasetSequence())) |
1329 |
|
{ |
1330 |
0 |
for (int index : positions) |
1331 |
|
{ |
1332 |
0 |
atomNo = sm.getAtomNum(index); |
1333 |
|
|
1334 |
0 |
if (atomNo > 0) |
1335 |
|
{ |
1336 |
0 |
atoms.add(new AtomSpec(sm.pdbfile, sm.pdbchain, |
1337 |
|
sm.getPDBResNum(index), atomNo)); |
1338 |
|
} |
1339 |
|
} |
1340 |
|
} |
1341 |
|
} |
1342 |
0 |
sl.highlightAtoms(atoms); |
1343 |
|
} |
1344 |
|
|
|
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 12 |
Complexity Density: 0.57 |
|
1345 |
0 |
public void highlightStructureRegionsFor(StructureListener sl,... |
1346 |
|
SequenceI[] seqs, int... columns) |
1347 |
|
{ |
1348 |
0 |
List<SequenceI> to_highlight = new ArrayList<SequenceI>(); |
1349 |
0 |
for (SequenceI seq : seqs) |
1350 |
|
{ |
1351 |
0 |
if (sl.isListeningFor(seq)) |
1352 |
|
{ |
1353 |
0 |
to_highlight.add(seq); |
1354 |
|
} |
1355 |
|
} |
1356 |
0 |
if (to_highlight.size() == 0) |
1357 |
|
{ |
1358 |
0 |
return; |
1359 |
|
} |
1360 |
0 |
List<AtomSpec> atoms = new ArrayList<>(); |
1361 |
0 |
for (SequenceI seq : to_highlight) |
1362 |
|
{ |
1363 |
0 |
int atomNo; |
1364 |
0 |
for (StructureMapping sm : mappings) |
1365 |
|
{ |
1366 |
0 |
if (sm.sequence == seq || sm.sequence == seq.getDatasetSequence() |
1367 |
|
|| (sm.sequence.getDatasetSequence() != null && sm.sequence |
1368 |
|
.getDatasetSequence() == seq.getDatasetSequence())) |
1369 |
|
{ |
1370 |
|
|
1371 |
0 |
for (int i = 0; i < columns.length; i += 2) |
1372 |
|
{ |
1373 |
0 |
ContiguousI positions = seq.findPositions(columns[i] + 1, |
1374 |
|
columns[i + 1] + 1); |
1375 |
0 |
if (positions == null) |
1376 |
|
{ |
1377 |
0 |
continue; |
1378 |
|
} |
1379 |
0 |
for (int index = positions.getBegin(); index <= positions |
1380 |
|
.getEnd(); index++) |
1381 |
|
{ |
1382 |
|
|
1383 |
0 |
atomNo = sm.getAtomNum(index); |
1384 |
|
|
1385 |
0 |
if (atomNo > 0) |
1386 |
|
{ |
1387 |
0 |
atoms.add(new AtomSpec(sm.pdbfile, sm.pdbchain, |
1388 |
|
sm.getPDBResNum(index), atomNo)); |
1389 |
|
} |
1390 |
|
} |
1391 |
|
} |
1392 |
|
} |
1393 |
|
} |
1394 |
0 |
if (atoms.size() > 0) |
1395 |
|
{ |
1396 |
0 |
sl.highlightAtoms(atoms); |
1397 |
|
} |
1398 |
|
} |
1399 |
|
} |
1400 |
|
|
1401 |
|
|
1402 |
|
|
1403 |
|
|
1404 |
|
|
1405 |
|
boolean handlingVamsasMo = false; |
1406 |
|
|
1407 |
|
long lastmsg = 0; |
1408 |
|
|
1409 |
|
|
1410 |
|
|
1411 |
|
|
1412 |
|
@param |
1413 |
|
@param |
1414 |
|
|
1415 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
1416 |
0 |
public void mouseOverVamsasSequence(SequenceI sequenceI, int position,... |
1417 |
|
VamsasSource source) |
1418 |
|
{ |
1419 |
0 |
handlingVamsasMo = true; |
1420 |
0 |
long msg = sequenceI.hashCode() * (1 + position); |
1421 |
0 |
if (lastmsg != msg) |
1422 |
|
{ |
1423 |
0 |
lastmsg = msg; |
1424 |
0 |
mouseOverSequence(sequenceI, position, -1, source); |
1425 |
|
} |
1426 |
0 |
handlingVamsasMo = false; |
1427 |
|
} |
1428 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1429 |
0 |
public Annotation[] colourSequenceFromStructure(SequenceI seq,... |
1430 |
|
String pdbid) |
1431 |
|
{ |
1432 |
0 |
return null; |
1433 |
|
|
1434 |
|
|
1435 |
|
|
1436 |
|
|
1437 |
|
|
1438 |
|
|
1439 |
|
|
1440 |
|
|
1441 |
|
|
1442 |
|
|
1443 |
|
|
1444 |
|
|
1445 |
|
|
1446 |
|
|
1447 |
|
|
1448 |
|
|
1449 |
|
|
1450 |
|
|
1451 |
|
|
1452 |
|
|
1453 |
|
|
1454 |
|
|
1455 |
|
|
1456 |
|
|
1457 |
|
|
1458 |
|
|
1459 |
|
|
1460 |
|
|
1461 |
|
|
1462 |
|
} |
1463 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1464 |
0 |
public void structureSelectionChanged()... |
1465 |
|
{ |
1466 |
|
} |
1467 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1468 |
0 |
public void sequenceSelectionChanged()... |
1469 |
|
{ |
1470 |
|
} |
1471 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
1472 |
1194 |
public void sequenceColoursChanged(Object source)... |
1473 |
|
{ |
1474 |
1194 |
StructureListener sl; |
1475 |
6101 |
for (int i = 0; i < listeners.size(); i++) |
1476 |
|
{ |
1477 |
4907 |
if (listeners.elementAt(i) instanceof StructureListener) |
1478 |
|
{ |
1479 |
46 |
sl = (StructureListener) listeners.elementAt(i); |
1480 |
46 |
sl.updateColours(source); |
1481 |
|
} |
1482 |
|
} |
1483 |
|
} |
1484 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
1485 |
33 |
public StructureMapping[] getMapping(String pdbfile)... |
1486 |
|
{ |
1487 |
33 |
List<StructureMapping> tmp = new ArrayList<>(); |
1488 |
33 |
for (StructureMapping sm : mappings) |
1489 |
|
{ |
1490 |
67 |
if (sm.pdbfile.equals(pdbfile)) |
1491 |
|
{ |
1492 |
33 |
tmp.add(sm); |
1493 |
|
} |
1494 |
|
} |
1495 |
33 |
return tmp.toArray(new StructureMapping[tmp.size()]); |
1496 |
|
} |
1497 |
|
|
1498 |
|
|
1499 |
|
|
1500 |
|
|
1501 |
|
|
1502 |
|
@param |
1503 |
|
@param |
1504 |
|
@return |
1505 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 6 |
Complexity Density: 0.55 |
|
1506 |
0 |
public String printMappings(String pdbfile, List<SequenceI> seqs)... |
1507 |
|
{ |
1508 |
0 |
if (pdbfile == null || seqs == null || seqs.isEmpty()) |
1509 |
|
{ |
1510 |
0 |
return ""; |
1511 |
|
} |
1512 |
|
|
1513 |
0 |
StringBuilder sb = new StringBuilder(64); |
1514 |
0 |
for (StructureMapping sm : mappings) |
1515 |
|
{ |
1516 |
0 |
if (Platform.pathEquals(sm.pdbfile, pdbfile) |
1517 |
|
&& seqs.contains(sm.sequence)) |
1518 |
|
{ |
1519 |
0 |
sb.append(sm.mappingDetails); |
1520 |
0 |
sb.append(NEWLINE); |
1521 |
|
|
1522 |
0 |
sb.append("====================="); |
1523 |
0 |
sb.append(NEWLINE); |
1524 |
|
} |
1525 |
|
} |
1526 |
0 |
sb.append(NEWLINE); |
1527 |
|
|
1528 |
0 |
return sb.toString(); |
1529 |
|
} |
1530 |
|
|
1531 |
|
|
1532 |
|
|
1533 |
|
|
1534 |
|
@param |
1535 |
|
|
|
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 4 |
Complexity Density: 1 |
|
1536 |
4 |
public void deregisterMapping(AlignedCodonFrame acf)... |
1537 |
|
{ |
1538 |
4 |
if (acf != null) |
1539 |
|
{ |
1540 |
4 |
boolean removed = seqmappings.remove(acf); |
1541 |
4 |
if (removed && seqmappings.isEmpty()) |
1542 |
|
{ |
1543 |
1 |
jalview.bin.Console.outPrintln("All mappings removed"); |
1544 |
|
} |
1545 |
|
} |
1546 |
|
} |
1547 |
|
|
1548 |
|
|
1549 |
|
|
1550 |
|
|
1551 |
|
@param |
1552 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1553 |
282 |
public void registerMappings(List<AlignedCodonFrame> mappings)... |
1554 |
|
{ |
1555 |
282 |
if (mappings != null) |
1556 |
|
{ |
1557 |
282 |
for (AlignedCodonFrame acf : mappings) |
1558 |
|
{ |
1559 |
13 |
registerMapping(acf); |
1560 |
|
} |
1561 |
|
} |
1562 |
|
} |
1563 |
|
|
1564 |
|
|
1565 |
|
|
1566 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 3 |
Complexity Density: 1 |
|
1567 |
22 |
public void registerMapping(AlignedCodonFrame acf)... |
1568 |
|
{ |
1569 |
22 |
if (acf != null) |
1570 |
|
{ |
1571 |
22 |
if (!seqmappings.contains(acf)) |
1572 |
|
{ |
1573 |
14 |
seqmappings.add(acf); |
1574 |
|
} |
1575 |
|
} |
1576 |
|
} |
1577 |
|
|
1578 |
|
|
1579 |
|
|
1580 |
|
|
1581 |
|
|
|
|
| 75% |
Uncovered Elements: 8 (32) |
Complexity: 9 |
Complexity Density: 0.56 |
|
1582 |
140 |
public void resetAll()... |
1583 |
|
{ |
1584 |
140 |
if (mappings != null) |
1585 |
|
{ |
1586 |
140 |
mappings.clear(); |
1587 |
|
} |
1588 |
140 |
if (seqmappings != null) |
1589 |
|
{ |
1590 |
140 |
seqmappings.clear(); |
1591 |
|
} |
1592 |
140 |
if (sel_listeners != null) |
1593 |
|
{ |
1594 |
140 |
sel_listeners.clear(); |
1595 |
|
} |
1596 |
140 |
if (listeners != null) |
1597 |
|
{ |
1598 |
140 |
listeners.clear(); |
1599 |
|
} |
1600 |
140 |
if (commandListeners != null) |
1601 |
|
{ |
1602 |
140 |
commandListeners.clear(); |
1603 |
|
} |
1604 |
140 |
if (view_listeners != null) |
1605 |
|
{ |
1606 |
140 |
view_listeners.clear(); |
1607 |
|
} |
1608 |
140 |
if (pdbFileNameId != null) |
1609 |
|
{ |
1610 |
140 |
pdbFileNameId.clear(); |
1611 |
|
} |
1612 |
140 |
if (pdbIdFileName != null) |
1613 |
|
{ |
1614 |
140 |
pdbIdFileName.clear(); |
1615 |
|
} |
1616 |
|
} |
1617 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1618 |
242 |
public void addSelectionListener(SelectionListener selecter)... |
1619 |
|
{ |
1620 |
242 |
if (!sel_listeners.contains(selecter)) |
1621 |
|
{ |
1622 |
242 |
sel_listeners.add(selecter); |
1623 |
|
} |
1624 |
|
} |
1625 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1626 |
246 |
public void removeSelectionListener(SelectionListener toremove)... |
1627 |
|
{ |
1628 |
246 |
if (sel_listeners.contains(toremove)) |
1629 |
|
{ |
1630 |
123 |
sel_listeners.remove(toremove); |
1631 |
|
} |
1632 |
|
} |
1633 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1634 |
19 |
public synchronized void sendSelection(... |
1635 |
|
jalview.datamodel.SequenceGroup selection, |
1636 |
|
jalview.datamodel.ColumnSelection colsel, HiddenColumns hidden, |
1637 |
|
SelectionSource source) |
1638 |
|
{ |
1639 |
19 |
for (SelectionListener slis : sel_listeners) |
1640 |
|
{ |
1641 |
54 |
if (slis != source) |
1642 |
|
{ |
1643 |
54 |
slis.selection(selection, colsel, hidden, source); |
1644 |
|
} |
1645 |
|
} |
1646 |
|
} |
1647 |
|
|
1648 |
|
Vector<AlignmentViewPanelListener> view_listeners = new Vector<>(); |
1649 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 5 |
Complexity Density: 0.71 |
|
1650 |
0 |
public synchronized void sendViewPosition(... |
1651 |
|
jalview.api.AlignmentViewPanel source, int startRes, int endRes, |
1652 |
|
int startSeq, int endSeq) |
1653 |
|
{ |
1654 |
|
|
1655 |
0 |
if (view_listeners != null && view_listeners.size() > 0) |
1656 |
|
{ |
1657 |
0 |
Enumeration<AlignmentViewPanelListener> listeners = view_listeners |
1658 |
|
.elements(); |
1659 |
0 |
while (listeners.hasMoreElements()) |
1660 |
|
{ |
1661 |
0 |
AlignmentViewPanelListener slis = listeners.nextElement(); |
1662 |
0 |
if (slis != source) |
1663 |
|
{ |
1664 |
0 |
slis.viewPosition(startRes, endRes, startSeq, endSeq, source); |
1665 |
|
} |
1666 |
0 |
; |
1667 |
|
} |
1668 |
|
} |
1669 |
|
} |
1670 |
|
|
1671 |
|
|
1672 |
|
|
1673 |
|
|
1674 |
|
@param |
1675 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
1676 |
0 |
public static void release(StructureSelectionManagerProvider jalviewLite)... |
1677 |
|
{ |
1678 |
|
|
1679 |
|
{ |
1680 |
0 |
if (instances == null) |
1681 |
|
{ |
1682 |
0 |
return; |
1683 |
|
} |
1684 |
0 |
StructureSelectionManager mnger = (instances.get(jalviewLite)); |
1685 |
0 |
if (mnger != null) |
1686 |
|
{ |
1687 |
0 |
instances.remove(jalviewLite); |
1688 |
0 |
try |
1689 |
|
{ |
1690 |
|
|
1691 |
|
|
1692 |
|
|
1693 |
|
|
1694 |
|
} catch (Throwable x) |
1695 |
|
{ |
1696 |
|
} |
1697 |
|
} |
1698 |
|
} |
1699 |
|
} |
1700 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 3 |
Complexity Density: 1.5 |
|
1701 |
47 |
public void registerPDBEntry(PDBEntry pdbentry)... |
1702 |
|
{ |
1703 |
47 |
if (pdbentry.getFile() != null |
1704 |
|
&& pdbentry.getFile().trim().length() > 0) |
1705 |
|
{ |
1706 |
47 |
registerPDBFile(pdbentry.getId(), pdbentry.getFile()); |
1707 |
|
} |
1708 |
|
} |
1709 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1710 |
2 |
public void addCommandListener(CommandListener cl)... |
1711 |
|
{ |
1712 |
2 |
if (!commandListeners.contains(cl)) |
1713 |
|
{ |
1714 |
2 |
commandListeners.add(cl); |
1715 |
|
} |
1716 |
|
} |
1717 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1718 |
0 |
public boolean hasCommandListener(CommandListener cl)... |
1719 |
|
{ |
1720 |
0 |
return this.commandListeners.contains(cl); |
1721 |
|
} |
1722 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1723 |
123 |
public boolean removeCommandListener(CommandListener l)... |
1724 |
|
{ |
1725 |
123 |
return commandListeners.remove(l); |
1726 |
|
} |
1727 |
|
|
1728 |
|
|
1729 |
|
|
1730 |
|
|
1731 |
|
|
1732 |
|
@param |
1733 |
|
|
1734 |
|
@param |
1735 |
|
|
1736 |
|
@param |
1737 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1738 |
0 |
public void commandPerformed(CommandI command, boolean undo,... |
1739 |
|
VamsasSource source) |
1740 |
|
{ |
1741 |
0 |
for (CommandListener listener : commandListeners) |
1742 |
|
{ |
1743 |
0 |
listener.mirrorCommand(command, undo, this, source); |
1744 |
|
} |
1745 |
|
} |
1746 |
|
|
1747 |
|
|
1748 |
|
|
1749 |
|
|
1750 |
|
|
1751 |
|
|
1752 |
|
@param |
1753 |
|
@param |
1754 |
|
@param |
1755 |
|
@param |
1756 |
|
@return |
1757 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
1758 |
0 |
public CommandI mapCommand(CommandI command, boolean undo,... |
1759 |
|
final AlignmentI mapTo, char gapChar) |
1760 |
|
{ |
1761 |
0 |
if (command instanceof EditCommand) |
1762 |
|
{ |
1763 |
0 |
return MappingUtils.mapEditCommand((EditCommand) command, undo, mapTo, |
1764 |
|
gapChar, seqmappings); |
1765 |
|
} |
1766 |
0 |
else if (command instanceof OrderCommand) |
1767 |
|
{ |
1768 |
0 |
return MappingUtils.mapOrderCommand((OrderCommand) command, undo, |
1769 |
|
mapTo, seqmappings); |
1770 |
|
} |
1771 |
0 |
return null; |
1772 |
|
} |
1773 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1774 |
15 |
public List<AlignedCodonFrame> getSequenceMappings()... |
1775 |
|
{ |
1776 |
15 |
return seqmappings; |
1777 |
|
} |
1778 |
|
|
1779 |
|
|
1780 |
|
|
1781 |
|
|
1782 |
|
|
1783 |
|
@param |
1784 |
|
@param |
1785 |
|
|
1786 |
|
@param |
1787 |
|
|
1788 |
|
|
|
|
| 66.7% |
Uncovered Elements: 4 (12) |
Complexity: 4 |
Complexity Density: 0.67 |
|
1789 |
8 |
public void highlightPositionsOnMany(SequenceI[] sequencesArray, int[] is,... |
1790 |
|
Object source) |
1791 |
|
{ |
1792 |
16 |
for (int i = 0; i < listeners.size(); i++) |
1793 |
|
{ |
1794 |
8 |
Object listener = listeners.elementAt(i); |
1795 |
8 |
if (listener == source) |
1796 |
|
{ |
1797 |
|
|
1798 |
|
|
1799 |
0 |
continue; |
1800 |
|
} |
1801 |
8 |
if (listener instanceof StructureListener) |
1802 |
|
{ |
1803 |
0 |
highlightStructureRegionsFor((StructureListener) listener, |
1804 |
|
sequencesArray, is); |
1805 |
|
} |
1806 |
|
} |
1807 |
|
} |
1808 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1809 |
0 |
public Map<String, String> getPdbFileNameIdMap()... |
1810 |
|
{ |
1811 |
0 |
return pdbFileNameId; |
1812 |
|
} |
1813 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1814 |
0 |
public Map<String, String> getPdbIdFileNameMap()... |
1815 |
|
{ |
1816 |
0 |
return pdbIdFileName; |
1817 |
|
} |
1818 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1819 |
53 |
public static void doConfigureStructurePrefs(... |
1820 |
|
StructureSelectionManager ssm) |
1821 |
|
{ |
1822 |
53 |
doConfigureStructurePrefs(ssm, |
1823 |
|
Cache.getDefault(Preferences.ADD_SS_ANN, true), |
1824 |
|
Cache.getDefault(Preferences.ADD_TEMPFACT_ANN, true), |
1825 |
|
Cache.getDefault(Preferences.STRUCT_FROM_PDB, true), |
1826 |
|
Cache.getDefault(Preferences.USE_RNAVIEW, false)); |
1827 |
|
} |
1828 |
|
|
|
|
| 55.6% |
Uncovered Elements: 4 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
1829 |
53 |
public static void doConfigureStructurePrefs(... |
1830 |
|
StructureSelectionManager ssm, boolean add_ss_ann, |
1831 |
|
boolean add_tempfact_ann, boolean struct_from_pdb, |
1832 |
|
boolean use_rnaview) |
1833 |
|
{ |
1834 |
53 |
if (add_ss_ann) |
1835 |
|
{ |
1836 |
53 |
ssm.setAddTempFacAnnot(add_tempfact_ann); |
1837 |
53 |
ssm.setProcessSecondaryStructure(struct_from_pdb); |
1838 |
|
|
1839 |
53 |
ssm.setSecStructServices(use_rnaview); |
1840 |
|
} |
1841 |
|
else |
1842 |
|
{ |
1843 |
0 |
ssm.setAddTempFacAnnot(false); |
1844 |
0 |
ssm.setProcessSecondaryStructure(false); |
1845 |
0 |
ssm.setSecStructServices(false); |
1846 |
|
} |
1847 |
|
} |
1848 |
|
|
1849 |
|
} |