1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import jalview.analysis.AlignmentUtils; |
24 |
|
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; |
25 |
|
import jalview.api.AlignViewportI; |
26 |
|
import jalview.api.AlignmentViewPanel; |
27 |
|
import jalview.api.FeatureColourI; |
28 |
|
import jalview.api.FeatureSettingsModelI; |
29 |
|
import jalview.api.FeaturesDisplayedI; |
30 |
|
import jalview.api.ViewStyleI; |
31 |
|
import jalview.bin.Cache; |
32 |
|
import jalview.commands.CommandI; |
33 |
|
import jalview.datamodel.AlignedCodonFrame; |
34 |
|
import jalview.datamodel.Alignment; |
35 |
|
import jalview.datamodel.AlignmentI; |
36 |
|
import jalview.datamodel.ColumnSelection; |
37 |
|
import jalview.datamodel.HiddenColumns; |
38 |
|
import jalview.datamodel.SearchResults; |
39 |
|
import jalview.datamodel.SearchResultsI; |
40 |
|
import jalview.datamodel.SequenceGroup; |
41 |
|
import jalview.datamodel.SequenceI; |
42 |
|
import jalview.renderer.ResidueShader; |
43 |
|
import jalview.schemes.ColourSchemeI; |
44 |
|
import jalview.schemes.ColourSchemeProperty; |
45 |
|
import jalview.schemes.ResidueColourScheme; |
46 |
|
import jalview.schemes.UserColourScheme; |
47 |
|
import jalview.structure.SelectionSource; |
48 |
|
import jalview.structure.StructureSelectionManager; |
49 |
|
import jalview.structure.VamsasSource; |
50 |
|
import jalview.util.MessageManager; |
51 |
|
import jalview.util.dialogrunner.RunResponse; |
52 |
|
import jalview.viewmodel.AlignmentViewport; |
53 |
|
import jalview.ws.params.AutoCalcSetting; |
54 |
|
|
55 |
|
import java.awt.Container; |
56 |
|
import java.awt.Dimension; |
57 |
|
import java.awt.Font; |
58 |
|
import java.awt.FontMetrics; |
59 |
|
import java.awt.Rectangle; |
60 |
|
import java.util.Hashtable; |
61 |
|
import java.util.Iterator; |
62 |
|
import java.util.List; |
63 |
|
|
64 |
|
import javax.swing.JInternalFrame; |
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
@author |
70 |
|
@version |
71 |
|
|
|
|
| 58.4% |
Uncovered Elements: 166 (399) |
Complexity: 116 |
Complexity Density: 0.47 |
|
72 |
|
public class AlignViewport extends AlignmentViewport |
73 |
|
implements SelectionSource |
74 |
|
{ |
75 |
|
Font font; |
76 |
|
|
77 |
|
boolean cursorMode = false; |
78 |
|
|
79 |
|
boolean antiAlias = false; |
80 |
|
|
81 |
|
private Rectangle explodedGeometry; |
82 |
|
|
83 |
|
String viewName; |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
private boolean gatherViewsHere = false; |
93 |
|
|
94 |
|
private AnnotationColumnChooser annotationColumnSelectionState; |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
@param |
100 |
|
|
101 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
102 |
33 |
public AlignViewport(AlignmentI al)... |
103 |
|
{ |
104 |
33 |
super(al); |
105 |
33 |
init(); |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
@param |
112 |
|
@param |
113 |
|
|
114 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
115 |
0 |
public AlignViewport(AlignmentI al, String seqsetid)... |
116 |
|
{ |
117 |
0 |
this(al, seqsetid, null); |
118 |
|
} |
119 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 7 |
Complexity Density: 0.88 |
|
120 |
0 |
public AlignViewport(AlignmentI al, String seqsetid, String viewid)... |
121 |
|
{ |
122 |
0 |
super(al); |
123 |
0 |
sequenceSetID = seqsetid; |
124 |
0 |
viewId = viewid; |
125 |
|
|
126 |
0 |
if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null) |
127 |
|
{ |
128 |
0 |
Cache.log.debug( |
129 |
|
"Setting viewport's sequence set id : " + sequenceSetID); |
130 |
|
} |
131 |
0 |
if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null) |
132 |
|
{ |
133 |
0 |
Cache.log.debug("Setting viewport's view id : " + viewId); |
134 |
|
} |
135 |
0 |
init(); |
136 |
|
|
137 |
|
} |
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
@param |
143 |
|
|
144 |
|
@param |
145 |
|
|
146 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
147 |
25 |
public AlignViewport(AlignmentI al, HiddenColumns hiddenColumns)... |
148 |
|
{ |
149 |
25 |
super(al); |
150 |
25 |
if (hiddenColumns != null) |
151 |
|
{ |
152 |
25 |
al.setHiddenColumns(hiddenColumns); |
153 |
|
} |
154 |
25 |
init(); |
155 |
|
} |
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
@param |
161 |
|
@param |
162 |
|
@param |
163 |
|
|
164 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
165 |
0 |
public AlignViewport(AlignmentI al, HiddenColumns hiddenColumns,... |
166 |
|
String seqsetid) |
167 |
|
{ |
168 |
0 |
this(al, hiddenColumns, seqsetid, null); |
169 |
|
} |
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
@param |
175 |
|
@param |
176 |
|
@param |
177 |
|
|
178 |
|
@param |
179 |
|
|
180 |
|
|
|
|
| 62.5% |
Uncovered Elements: 6 (16) |
Complexity: 8 |
Complexity Density: 0.8 |
|
181 |
186 |
public AlignViewport(AlignmentI al, HiddenColumns hiddenColumns,... |
182 |
|
String seqsetid, String viewid) |
183 |
|
{ |
184 |
186 |
super(al); |
185 |
186 |
sequenceSetID = seqsetid; |
186 |
186 |
viewId = viewid; |
187 |
|
|
188 |
186 |
if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null) |
189 |
|
{ |
190 |
0 |
Cache.log.debug( |
191 |
|
"Setting viewport's sequence set id : " + sequenceSetID); |
192 |
|
} |
193 |
186 |
if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null) |
194 |
|
{ |
195 |
0 |
Cache.log.debug("Setting viewport's view id : " + viewId); |
196 |
|
} |
197 |
|
|
198 |
186 |
if (hiddenColumns != null) |
199 |
|
{ |
200 |
0 |
al.setHiddenColumns(hiddenColumns); |
201 |
|
} |
202 |
186 |
init(); |
203 |
|
} |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
|
208 |
244 |
private void applyViewProperties()... |
209 |
|
{ |
210 |
244 |
antiAlias = Cache.getDefault("ANTI_ALIAS", false); |
211 |
|
|
212 |
244 |
viewStyle.setShowJVSuffix(Cache.getDefault("SHOW_JVSUFFIX", true)); |
213 |
244 |
setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true)); |
214 |
|
|
215 |
244 |
setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false)); |
216 |
244 |
setCentreColumnLabels(Cache.getDefault("CENTRE_COLUMN_LABELS", false)); |
217 |
244 |
autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true); |
218 |
|
|
219 |
244 |
setPadGaps(Cache.getDefault("PAD_GAPS", true)); |
220 |
244 |
setShowNPFeats(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true)); |
221 |
244 |
setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true)); |
222 |
244 |
viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true)); |
223 |
244 |
viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false)); |
224 |
244 |
viewStyle.setShowUnconserved( |
225 |
|
Cache.getDefault("SHOW_UNCONSERVED", false)); |
226 |
244 |
sortByTree = Cache.getDefault("SORT_BY_TREE", false); |
227 |
244 |
followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true); |
228 |
244 |
sortAnnotationsBy = SequenceAnnotationOrder |
229 |
|
.valueOf(Cache.getDefault(Preferences.SORT_ANNOTATIONS, |
230 |
|
SequenceAnnotationOrder.NONE.name())); |
231 |
244 |
showAutocalculatedAbove = Cache |
232 |
|
.getDefault(Preferences.SHOW_AUTOCALC_ABOVE, false); |
233 |
244 |
viewStyle.setScaleProteinAsCdna( |
234 |
|
Cache.getDefault(Preferences.SCALE_PROTEIN_TO_CDNA, true)); |
235 |
|
} |
236 |
|
|
|
|
| 82% |
Uncovered Elements: 9 (50) |
Complexity: 10 |
Complexity Density: 0.29 |
|
237 |
244 |
void init()... |
238 |
|
{ |
239 |
244 |
applyViewProperties(); |
240 |
|
|
241 |
244 |
String fontName = Cache.getDefault("FONT_NAME", "SansSerif"); |
242 |
244 |
String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + ""); |
243 |
244 |
String fontSize = Cache.getDefault("FONT_SIZE", "10"); |
244 |
|
|
245 |
244 |
int style = 0; |
246 |
|
|
247 |
244 |
if (fontStyle.equals("bold")) |
248 |
|
{ |
249 |
0 |
style = 1; |
250 |
|
} |
251 |
244 |
else if (fontStyle.equals("italic")) |
252 |
|
{ |
253 |
0 |
style = 2; |
254 |
|
} |
255 |
|
|
256 |
244 |
setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true); |
257 |
|
|
258 |
244 |
alignment |
259 |
|
.setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0)); |
260 |
|
|
261 |
|
|
262 |
|
|
263 |
244 |
if (hconsensus == null && !isDataset) |
264 |
|
{ |
265 |
244 |
if (!alignment.isNucleotide()) |
266 |
|
{ |
267 |
206 |
showConservation = Cache.getDefault("SHOW_CONSERVATION", true); |
268 |
206 |
showQuality = Cache.getDefault("SHOW_QUALITY", true); |
269 |
206 |
showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION", |
270 |
|
false); |
271 |
|
} |
272 |
244 |
showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM", |
273 |
|
true); |
274 |
244 |
showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false); |
275 |
244 |
normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO", |
276 |
|
false); |
277 |
244 |
showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false); |
278 |
244 |
showConsensus = Cache.getDefault("SHOW_IDENTITY", true); |
279 |
|
|
280 |
244 |
showOccupancy = Cache.getDefault(Preferences.SHOW_OCCUPANCY, true); |
281 |
|
} |
282 |
244 |
initAutoAnnotation(); |
283 |
244 |
String colourProperty = alignment.isNucleotide() |
284 |
|
? Preferences.DEFAULT_COLOUR_NUC |
285 |
|
: Preferences.DEFAULT_COLOUR_PROT; |
286 |
244 |
String schemeName = Cache.getProperty(colourProperty); |
287 |
244 |
if (schemeName == null) |
288 |
|
{ |
289 |
|
|
290 |
236 |
schemeName = Cache.getDefault(Preferences.DEFAULT_COLOUR, |
291 |
|
ResidueColourScheme.NONE); |
292 |
|
} |
293 |
244 |
ColourSchemeI colourScheme = ColourSchemeProperty |
294 |
|
.getColourScheme(alignment, schemeName); |
295 |
244 |
residueShading = new ResidueShader(colourScheme); |
296 |
|
|
297 |
244 |
if (colourScheme instanceof UserColourScheme) |
298 |
|
{ |
299 |
0 |
residueShading = new ResidueShader( |
300 |
|
UserDefinedColours.loadDefaultColours()); |
301 |
0 |
residueShading.setThreshold(0, isIgnoreGapsConsensus()); |
302 |
|
} |
303 |
|
|
304 |
244 |
if (residueShading != null) |
305 |
|
{ |
306 |
244 |
residueShading.setConsensus(hconsensus); |
307 |
|
} |
308 |
|
} |
309 |
|
|
310 |
|
boolean validCharWidth; |
311 |
|
|
312 |
|
|
313 |
|
@inheritDoc |
314 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
315 |
392 |
@Override... |
316 |
|
public void setFont(Font f, boolean setGrid) |
317 |
|
{ |
318 |
392 |
font = f; |
319 |
|
|
320 |
392 |
Container c = new Container(); |
321 |
|
|
322 |
392 |
if (setGrid) |
323 |
|
{ |
324 |
319 |
FontMetrics fm = c.getFontMetrics(font); |
325 |
319 |
int ww = fm.charWidth('M'); |
326 |
319 |
setCharHeight(fm.getHeight()); |
327 |
319 |
setCharWidth(ww); |
328 |
|
} |
329 |
392 |
viewStyle.setFontName(font.getName()); |
330 |
392 |
viewStyle.setFontStyle(font.getStyle()); |
331 |
392 |
viewStyle.setFontSize(font.getSize()); |
332 |
|
|
333 |
392 |
validCharWidth = true; |
334 |
|
} |
335 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
336 |
73 |
@Override... |
337 |
|
public void setViewStyle(ViewStyleI settingsForView) |
338 |
|
{ |
339 |
73 |
super.setViewStyle(settingsForView); |
340 |
73 |
setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(), |
341 |
|
viewStyle.getFontSize()), false); |
342 |
|
} |
343 |
|
|
344 |
|
|
345 |
|
|
346 |
|
|
347 |
|
@return |
348 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
349 |
8864 |
public Font getFont()... |
350 |
|
{ |
351 |
8864 |
return font; |
352 |
|
} |
353 |
|
|
354 |
|
|
355 |
|
|
356 |
|
|
357 |
|
@param |
358 |
|
|
359 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
360 |
335 |
@Override... |
361 |
|
public void setAlignment(AlignmentI align) |
362 |
|
{ |
363 |
335 |
replaceMappings(align); |
364 |
335 |
super.setAlignment(align); |
365 |
|
} |
366 |
|
|
367 |
|
|
368 |
|
|
369 |
|
|
370 |
|
|
371 |
|
@param |
372 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
373 |
338 |
public void replaceMappings(AlignmentI align)... |
374 |
|
{ |
375 |
|
|
376 |
|
|
377 |
|
|
378 |
|
|
379 |
338 |
deregisterMappings(); |
380 |
|
|
381 |
|
|
382 |
|
|
383 |
|
|
384 |
338 |
if (align != null) |
385 |
|
{ |
386 |
247 |
StructureSelectionManager ssm = StructureSelectionManager |
387 |
|
.getStructureSelectionManager(Desktop.instance); |
388 |
247 |
ssm.registerMappings(align.getCodonFrames()); |
389 |
|
} |
390 |
|
|
391 |
|
|
392 |
|
|
393 |
|
|
394 |
338 |
if (alignment != null && align != null) |
395 |
|
{ |
396 |
3 |
alignment.setCodonFrames(align.getCodonFrames()); |
397 |
|
} |
398 |
|
} |
399 |
|
|
|
|
| 92.9% |
Uncovered Elements: 1 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
400 |
338 |
protected void deregisterMappings()... |
401 |
|
{ |
402 |
338 |
AlignmentI al = getAlignment(); |
403 |
338 |
if (al != null) |
404 |
|
{ |
405 |
94 |
List<AlignedCodonFrame> mappings = al.getCodonFrames(); |
406 |
94 |
if (mappings != null) |
407 |
|
{ |
408 |
94 |
StructureSelectionManager ssm = StructureSelectionManager |
409 |
|
.getStructureSelectionManager(Desktop.instance); |
410 |
94 |
for (AlignedCodonFrame acf : mappings) |
411 |
|
{ |
412 |
6 |
if (noReferencesTo(acf)) |
413 |
|
{ |
414 |
3 |
ssm.deregisterMapping(acf); |
415 |
|
} |
416 |
|
} |
417 |
|
} |
418 |
|
} |
419 |
|
} |
420 |
|
|
421 |
|
|
422 |
|
|
423 |
|
|
424 |
|
@return |
425 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
426 |
29 |
@Override... |
427 |
|
public char getGapCharacter() |
428 |
|
{ |
429 |
29 |
return getAlignment().getGapCharacter(); |
430 |
|
} |
431 |
|
|
432 |
|
|
433 |
|
|
434 |
|
|
435 |
|
@param |
436 |
|
|
437 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
438 |
0 |
public void setGapCharacter(char gap)... |
439 |
|
{ |
440 |
0 |
if (getAlignment() != null) |
441 |
|
{ |
442 |
0 |
getAlignment().setGapCharacter(gap); |
443 |
|
} |
444 |
|
} |
445 |
|
|
446 |
|
|
447 |
|
|
448 |
|
|
449 |
|
@param |
450 |
|
|
451 |
|
|
452 |
|
@return |
453 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
454 |
0 |
public Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly)... |
455 |
|
{ |
456 |
0 |
int start = 0; |
457 |
0 |
int end = 0; |
458 |
0 |
if (selectedRegionOnly && selectionGroup != null) |
459 |
|
{ |
460 |
0 |
start = selectionGroup.getStartRes(); |
461 |
0 |
end = selectionGroup.getEndRes() + 1; |
462 |
|
} |
463 |
|
else |
464 |
|
{ |
465 |
0 |
end = alignment.getWidth(); |
466 |
|
} |
467 |
0 |
return (alignment.getHiddenColumns().getVisContigsIterator(start, end, |
468 |
|
false)); |
469 |
|
} |
470 |
|
|
471 |
|
|
472 |
|
|
473 |
|
|
474 |
|
@return |
475 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
476 |
1 |
public long[] getUndoRedoHash()... |
477 |
|
{ |
478 |
|
|
479 |
1 |
if (historyList == null || redoList == null) |
480 |
|
{ |
481 |
0 |
return new long[] { -1, -1 }; |
482 |
|
} |
483 |
1 |
return new long[] { historyList.hashCode(), this.redoList.hashCode() }; |
484 |
|
} |
485 |
|
|
486 |
|
|
487 |
|
|
488 |
|
|
489 |
|
|
490 |
|
@param |
491 |
|
|
492 |
|
@return |
493 |
|
|
494 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 5 |
Complexity Density: 0.56 |
|
495 |
0 |
public boolean isUndoRedoHashModified(long[] undoredo)... |
496 |
|
{ |
497 |
0 |
if (undoredo == null) |
498 |
|
{ |
499 |
0 |
return true; |
500 |
|
} |
501 |
0 |
long[] cstate = getUndoRedoHash(); |
502 |
0 |
if (cstate.length != undoredo.length) |
503 |
|
{ |
504 |
0 |
return true; |
505 |
|
} |
506 |
|
|
507 |
0 |
for (int i = 0; i < cstate.length; i++) |
508 |
|
{ |
509 |
0 |
if (cstate[i] != undoredo[i]) |
510 |
|
{ |
511 |
0 |
return true; |
512 |
|
} |
513 |
|
} |
514 |
0 |
return false; |
515 |
|
} |
516 |
|
|
517 |
|
public boolean followSelection = true; |
518 |
|
|
519 |
|
|
520 |
|
@return |
521 |
|
|
522 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
523 |
0 |
public boolean getFollowSelection()... |
524 |
|
{ |
525 |
0 |
return followSelection; |
526 |
|
} |
527 |
|
|
528 |
|
|
529 |
|
|
530 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
531 |
13 |
@Override... |
532 |
|
public void sendSelection() |
533 |
|
{ |
534 |
13 |
jalview.structure.StructureSelectionManager |
535 |
|
.getStructureSelectionManager(Desktop.instance) |
536 |
|
.sendSelection(new SequenceGroup(getSelectionGroup()), |
537 |
|
new ColumnSelection(getColumnSelection()), |
538 |
|
new HiddenColumns(getAlignment().getHiddenColumns()), |
539 |
|
this); |
540 |
|
} |
541 |
|
|
542 |
|
|
543 |
|
|
544 |
|
|
545 |
|
|
546 |
|
@param |
547 |
|
@return |
548 |
|
|
549 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 4 |
Complexity Density: 0.8 |
|
550 |
247 |
public AlignmentPanel getAlignPanel()... |
551 |
|
{ |
552 |
247 |
AlignmentPanel[] aps = PaintRefresher |
553 |
|
.getAssociatedPanels(this.getSequenceSetId()); |
554 |
453 |
for (int p = 0; aps != null && p < aps.length; p++) |
555 |
|
{ |
556 |
265 |
if (aps[p].av == this) |
557 |
|
{ |
558 |
59 |
return aps[p]; |
559 |
|
} |
560 |
|
} |
561 |
188 |
return null; |
562 |
|
} |
563 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
564 |
12 |
public boolean getSortByTree()... |
565 |
|
{ |
566 |
12 |
return sortByTree; |
567 |
|
} |
568 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
569 |
0 |
public void setSortByTree(boolean sort)... |
570 |
|
{ |
571 |
0 |
sortByTree = sort; |
572 |
|
} |
573 |
|
|
574 |
|
|
575 |
|
|
576 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
577 |
1659 |
@Override... |
578 |
|
public StructureSelectionManager getStructureSelectionManager() |
579 |
|
{ |
580 |
1659 |
return StructureSelectionManager |
581 |
|
.getStructureSelectionManager(Desktop.instance); |
582 |
|
} |
583 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
584 |
1435 |
@Override... |
585 |
|
public boolean isNormaliseSequenceLogo() |
586 |
|
{ |
587 |
1435 |
return normaliseSequenceLogo; |
588 |
|
} |
589 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
590 |
22 |
public void setNormaliseSequenceLogo(boolean state)... |
591 |
|
{ |
592 |
22 |
normaliseSequenceLogo = state; |
593 |
|
} |
594 |
|
|
595 |
|
|
596 |
|
|
597 |
|
@return |
598 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
599 |
33007 |
@Override... |
600 |
|
public boolean isValidCharWidth() |
601 |
|
{ |
602 |
33007 |
return validCharWidth; |
603 |
|
} |
604 |
|
|
605 |
|
private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<>(); |
606 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
607 |
3 |
public AutoCalcSetting getCalcIdSettingsFor(String calcId)... |
608 |
|
{ |
609 |
3 |
return calcIdParams.get(calcId); |
610 |
|
} |
611 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
612 |
0 |
public void setCalcIdSettingsFor(String calcId, AutoCalcSetting settings,... |
613 |
|
boolean needsUpdate) |
614 |
|
{ |
615 |
0 |
calcIdParams.put(calcId, settings); |
616 |
|
|
617 |
|
|
618 |
|
|
619 |
0 |
if (needsUpdate) |
620 |
|
{ |
621 |
0 |
Cache.log.debug("trigger update for " + calcId); |
622 |
|
} |
623 |
|
} |
624 |
|
|
625 |
|
|
626 |
|
|
627 |
|
|
628 |
|
|
629 |
|
|
630 |
|
|
631 |
|
|
632 |
|
|
633 |
|
|
634 |
|
|
635 |
|
|
636 |
|
|
637 |
|
|
638 |
|
|
639 |
|
@param |
640 |
|
@param |
641 |
|
@param |
642 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 4 |
Complexity Density: 0.57 |
|
643 |
0 |
@Override... |
644 |
|
public void mirrorCommand(CommandI command, boolean undo, |
645 |
|
StructureSelectionManager ssm, VamsasSource source) |
646 |
|
{ |
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
|
651 |
0 |
if (source instanceof AlignViewportI |
652 |
|
&& ((AlignViewportI) source).getCodingComplement() == this) |
653 |
|
{ |
654 |
|
|
655 |
|
} |
656 |
|
else |
657 |
|
{ |
658 |
0 |
return; |
659 |
|
} |
660 |
|
|
661 |
0 |
CommandI mappedCommand = ssm.mapCommand(command, undo, getAlignment(), |
662 |
|
getGapCharacter()); |
663 |
0 |
if (mappedCommand != null) |
664 |
|
{ |
665 |
0 |
AlignmentI[] views = getAlignPanel().alignFrame.getViewAlignments(); |
666 |
0 |
mappedCommand.doCommand(views); |
667 |
0 |
getAlignPanel().alignmentChanged(); |
668 |
|
} |
669 |
|
} |
670 |
|
|
671 |
|
|
672 |
|
|
673 |
|
|
674 |
|
|
675 |
|
|
676 |
|
@param |
677 |
|
@param |
678 |
|
|
|
|
| 63.6% |
Uncovered Elements: 4 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
679 |
1 |
public void addAlignment(AlignmentI toAdd, String title)... |
680 |
|
{ |
681 |
|
|
682 |
|
|
683 |
|
|
684 |
|
|
685 |
|
|
686 |
|
|
687 |
|
|
688 |
|
|
689 |
|
|
690 |
|
|
691 |
|
|
692 |
|
|
693 |
|
|
694 |
|
|
695 |
1 |
toAdd.setDataset(null); |
696 |
|
|
697 |
|
|
698 |
|
|
699 |
|
|
700 |
|
|
701 |
1 |
getAlignment().realiseMappings(toAdd.getSequences()); |
702 |
|
|
703 |
|
|
704 |
|
|
705 |
|
|
706 |
|
|
707 |
1 |
if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) |
708 |
|
{ |
709 |
1 |
if (AlignmentUtils.isMappable(toAdd, getAlignment())) |
710 |
|
{ |
711 |
0 |
openLinkedAlignment(toAdd, title); |
712 |
0 |
return; |
713 |
|
} |
714 |
|
} |
715 |
1 |
alignmentDataAdded(toAdd); |
716 |
|
} |
717 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
718 |
1 |
private void alignmentDataAdded(AlignmentI toAdd)... |
719 |
|
{ |
720 |
|
|
721 |
|
|
722 |
|
|
723 |
|
|
724 |
|
|
725 |
|
|
726 |
1 |
AlignmentI al = getAlignment(); |
727 |
1 |
String gap = String.valueOf(al.getGapCharacter()); |
728 |
5 |
for (int i = 0; i < toAdd.getHeight(); i++) |
729 |
|
{ |
730 |
4 |
SequenceI seq = toAdd.getSequenceAt(i); |
731 |
|
|
732 |
|
|
733 |
|
|
734 |
|
|
735 |
|
|
736 |
|
|
737 |
|
|
738 |
4 |
if (true ) |
739 |
|
{ |
740 |
4 |
al.addSequence(seq); |
741 |
|
} |
742 |
|
} |
743 |
|
|
744 |
1 |
ranges.setEndSeq(getAlignment().getHeight()); |
745 |
1 |
firePropertyChange("alignment", null, getAlignment().getSequences()); |
746 |
|
} |
747 |
|
|
748 |
|
|
749 |
|
|
750 |
|
|
751 |
|
|
752 |
|
|
753 |
|
|
754 |
|
@param |
755 |
|
@param |
756 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
757 |
0 |
protected void openLinkedAlignment(AlignmentI al, String title)... |
758 |
|
{ |
759 |
0 |
String[] options = new String[] { MessageManager.getString("action.no"), |
760 |
|
MessageManager.getString("label.split_window"), |
761 |
|
MessageManager.getString("label.new_window"), }; |
762 |
0 |
final String question = JvSwingUtils.wrapTooltip(true, |
763 |
|
MessageManager.getString("label.open_split_window?")); |
764 |
0 |
final AlignViewport us = this; |
765 |
0 |
JvOptionPane.newOptionDialog(Desktop.desktop) |
766 |
|
.response(new RunResponse(1) |
767 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
768 |
0 |
@Override... |
769 |
|
public void run() |
770 |
|
{ |
771 |
0 |
us.openLinkedAlignmentAs(al, title, true); |
772 |
|
} |
773 |
|
}).response(new RunResponse(2) |
774 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
775 |
0 |
@Override... |
776 |
|
public void run() |
777 |
|
{ |
778 |
0 |
us.openLinkedAlignmentAs(al, title, false); |
779 |
|
} |
780 |
|
}).defaultResponse(new Runnable() |
781 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
782 |
0 |
@Override... |
783 |
|
public void run() |
784 |
|
{ |
785 |
0 |
alignmentDataAdded(al); |
786 |
|
} |
787 |
|
}).showDialog(question, |
788 |
|
MessageManager.getString("label.open_split_window"), |
789 |
|
JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null, |
790 |
|
options, options[0]); |
791 |
|
} |
792 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 7 |
Complexity Density: 0.47 |
|
793 |
0 |
protected void openLinkedAlignmentAs(AlignmentI al, String title,... |
794 |
|
boolean newWindowOrSplitPane) |
795 |
|
{ |
796 |
|
|
797 |
|
|
798 |
|
|
799 |
|
|
800 |
0 |
AlignmentI thisAlignment = newWindowOrSplitPane |
801 |
|
? new Alignment(getAlignment()) |
802 |
|
: getAlignment(); |
803 |
0 |
AlignmentI protein = al.isNucleotide() ? thisAlignment : al; |
804 |
0 |
final AlignmentI cdna = al.isNucleotide() ? al : thisAlignment; |
805 |
|
|
806 |
|
|
807 |
|
|
808 |
|
|
809 |
|
|
810 |
|
|
811 |
|
|
812 |
0 |
al.setDataset(null); |
813 |
0 |
AlignmentUtils.mapProteinAlignmentToCdna(protein, cdna); |
814 |
|
|
815 |
|
|
816 |
|
|
817 |
|
|
818 |
|
|
819 |
0 |
AlignFrame newAlignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH, |
820 |
|
AlignFrame.DEFAULT_HEIGHT); |
821 |
0 |
newAlignFrame.setTitle(title); |
822 |
0 |
newAlignFrame.setStatus(MessageManager |
823 |
|
.formatMessage("label.successfully_loaded_file", new Object[] |
824 |
|
{ title })); |
825 |
|
|
826 |
|
|
827 |
|
|
828 |
|
|
829 |
|
|
830 |
|
|
831 |
|
|
832 |
|
|
833 |
0 |
if (!newWindowOrSplitPane) |
834 |
|
{ |
835 |
0 |
Desktop.addInternalFrame(newAlignFrame, title, |
836 |
|
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); |
837 |
|
} |
838 |
|
|
839 |
0 |
try |
840 |
|
{ |
841 |
0 |
newAlignFrame.setMaximum( |
842 |
|
jalview.bin.Cache.getDefault("SHOW_FULLSCREEN", false)); |
843 |
|
} catch (java.beans.PropertyVetoException ex) |
844 |
|
{ |
845 |
|
} |
846 |
|
|
847 |
0 |
if (newWindowOrSplitPane) |
848 |
|
{ |
849 |
0 |
al.alignAs(thisAlignment); |
850 |
0 |
protein = openSplitFrame(newAlignFrame, thisAlignment); |
851 |
|
} |
852 |
|
} |
853 |
|
|
854 |
|
|
855 |
|
|
856 |
|
|
857 |
|
|
858 |
|
@param |
859 |
|
|
860 |
|
@param |
861 |
|
|
862 |
|
@return |
863 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
864 |
0 |
protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,... |
865 |
|
AlignmentI complement) |
866 |
|
{ |
867 |
|
|
868 |
|
|
869 |
|
|
870 |
|
|
871 |
|
|
872 |
0 |
AlignFrame copyMe = new AlignFrame(complement, AlignFrame.DEFAULT_WIDTH, |
873 |
|
AlignFrame.DEFAULT_HEIGHT); |
874 |
0 |
copyMe.setTitle(getAlignPanel().alignFrame.getTitle()); |
875 |
|
|
876 |
0 |
AlignmentI al = newAlignFrame.viewport.getAlignment(); |
877 |
0 |
final AlignFrame proteinFrame = al.isNucleotide() ? copyMe |
878 |
|
: newAlignFrame; |
879 |
0 |
final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame : copyMe; |
880 |
0 |
cdnaFrame.setVisible(true); |
881 |
0 |
proteinFrame.setVisible(true); |
882 |
0 |
String linkedTitle = MessageManager |
883 |
|
.getString("label.linked_view_title"); |
884 |
|
|
885 |
|
|
886 |
|
|
887 |
|
|
888 |
0 |
JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame); |
889 |
0 |
Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1); |
890 |
|
|
891 |
0 |
return proteinFrame.viewport.getAlignment(); |
892 |
|
} |
893 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
894 |
7 |
public AnnotationColumnChooser getAnnotationColumnSelectionState()... |
895 |
|
{ |
896 |
7 |
return annotationColumnSelectionState; |
897 |
|
} |
898 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
899 |
1 |
public void setAnnotationColumnSelectionState(... |
900 |
|
AnnotationColumnChooser currentAnnotationColumnSelectionState) |
901 |
|
{ |
902 |
1 |
this.annotationColumnSelectionState = currentAnnotationColumnSelectionState; |
903 |
|
} |
904 |
|
|
|
|
| 50% |
Uncovered Elements: 4 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
905 |
188 |
@Override... |
906 |
|
public void setIdWidth(int i) |
907 |
|
{ |
908 |
188 |
super.setIdWidth(i); |
909 |
188 |
AlignmentPanel ap = getAlignPanel(); |
910 |
188 |
if (ap != null) |
911 |
|
{ |
912 |
|
|
913 |
0 |
Dimension idw = getAlignPanel().getIdPanel().getIdCanvas() |
914 |
|
.getPreferredSize(); |
915 |
0 |
idw.width = i; |
916 |
0 |
getAlignPanel().getIdPanel().getIdCanvas().setPreferredSize(idw); |
917 |
|
} |
918 |
|
} |
919 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
920 |
27 |
public Rectangle getExplodedGeometry()... |
921 |
|
{ |
922 |
27 |
return explodedGeometry; |
923 |
|
} |
924 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
925 |
57 |
public void setExplodedGeometry(Rectangle explodedPosition)... |
926 |
|
{ |
927 |
57 |
this.explodedGeometry = explodedPosition; |
928 |
|
} |
929 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
930 |
91 |
public boolean isGatherViewsHere()... |
931 |
|
{ |
932 |
91 |
return gatherViewsHere; |
933 |
|
} |
934 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
935 |
140 |
public void setGatherViewsHere(boolean gatherViewsHere)... |
936 |
|
{ |
937 |
140 |
this.gatherViewsHere = gatherViewsHere; |
938 |
|
} |
939 |
|
|
940 |
|
|
941 |
|
|
942 |
|
|
943 |
|
|
|
|
| 44.4% |
Uncovered Elements: 5 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
944 |
451 |
public void scrollComplementaryAlignment()... |
945 |
|
{ |
946 |
|
|
947 |
|
|
948 |
|
|
949 |
|
|
950 |
|
|
951 |
451 |
SearchResultsI sr = new SearchResults(); |
952 |
451 |
int verticalOffset = findComplementScrollTarget(sr); |
953 |
451 |
if (!sr.isEmpty()) |
954 |
|
{ |
955 |
|
|
956 |
0 |
final AlignmentPanel complementPanel = ((AlignViewport) getCodingComplement()) |
957 |
|
.getAlignPanel(); |
958 |
0 |
complementPanel.setToScrollComplementPanel(false); |
959 |
0 |
complementPanel.scrollToCentre(sr, verticalOffset); |
960 |
0 |
complementPanel.setToScrollComplementPanel(true); |
961 |
|
} |
962 |
|
} |
963 |
|
|
964 |
|
|
965 |
|
|
966 |
|
|
967 |
|
@param |
968 |
|
@return |
969 |
|
|
|
|
| 81.2% |
Uncovered Elements: 3 (16) |
Complexity: 5 |
Complexity Density: 0.5 |
|
970 |
6 |
protected boolean noReferencesTo(AlignedCodonFrame acf)... |
971 |
|
{ |
972 |
6 |
AlignFrame[] frames = Desktop.getAlignFrames(); |
973 |
6 |
if (frames == null) |
974 |
|
{ |
975 |
0 |
return true; |
976 |
|
} |
977 |
6 |
for (AlignFrame af : frames) |
978 |
|
{ |
979 |
12 |
if (!af.isClosed()) |
980 |
|
{ |
981 |
12 |
for (AlignmentViewPanel ap : af.getAlignPanels()) |
982 |
|
{ |
983 |
12 |
AlignmentI al = ap.getAlignment(); |
984 |
12 |
if (al != null && al.getCodonFrames().contains(acf)) |
985 |
|
{ |
986 |
3 |
return false; |
987 |
|
} |
988 |
|
} |
989 |
|
} |
990 |
|
} |
991 |
3 |
return true; |
992 |
|
} |
993 |
|
|
994 |
|
|
995 |
|
|
996 |
|
|
997 |
|
|
998 |
|
|
999 |
|
|
1000 |
|
@param |
1001 |
|
|
|
|
| 76.9% |
Uncovered Elements: 6 (26) |
Complexity: 5 |
Complexity Density: 0.28 |
|
1002 |
10 |
@Override... |
1003 |
|
public void applyFeaturesStyle(FeatureSettingsModelI featureSettings) |
1004 |
|
{ |
1005 |
10 |
if (featureSettings == null) |
1006 |
|
{ |
1007 |
0 |
return; |
1008 |
|
} |
1009 |
|
|
1010 |
10 |
FeatureRenderer fr = getAlignPanel().getSeqPanel().seqCanvas |
1011 |
|
.getFeatureRenderer(); |
1012 |
10 |
fr.findAllFeatures(true); |
1013 |
10 |
List<String> renderOrder = fr.getRenderOrder(); |
1014 |
10 |
FeaturesDisplayedI displayed = fr.getFeaturesDisplayed(); |
1015 |
10 |
displayed.clear(); |
1016 |
|
|
1017 |
|
|
1018 |
|
|
1019 |
|
|
1020 |
|
|
1021 |
|
|
1022 |
10 |
for (String type : renderOrder) |
1023 |
|
{ |
1024 |
10 |
FeatureColourI preferredColour = featureSettings |
1025 |
|
.getFeatureColour(type); |
1026 |
10 |
if (preferredColour != null) |
1027 |
|
{ |
1028 |
0 |
fr.setColour(type, preferredColour); |
1029 |
|
} |
1030 |
10 |
if (featureSettings.isFeatureDisplayed(type)) |
1031 |
|
{ |
1032 |
10 |
displayed.setVisible(type); |
1033 |
|
} |
1034 |
|
} |
1035 |
|
|
1036 |
|
|
1037 |
|
|
1038 |
|
|
1039 |
10 |
for (String group : fr.getFeatureGroups()) |
1040 |
|
{ |
1041 |
10 |
fr.setGroupVisibility(group, featureSettings.isGroupDisplayed(group)); |
1042 |
|
} |
1043 |
|
|
1044 |
|
|
1045 |
|
|
1046 |
|
|
1047 |
10 |
if (featureSettings.optimiseOrder()) |
1048 |
|
{ |
1049 |
|
|
1050 |
|
} |
1051 |
|
else |
1052 |
|
{ |
1053 |
10 |
fr.orderFeatures(featureSettings); |
1054 |
|
} |
1055 |
10 |
fr.setTransparency(featureSettings.getTransparency()); |
1056 |
|
} |
1057 |
|
} |