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 java.awt.BorderLayout; |
24 |
|
import java.awt.Color; |
25 |
|
import java.awt.Component; |
26 |
|
import java.awt.Rectangle; |
27 |
|
import java.awt.Toolkit; |
28 |
|
import java.awt.datatransfer.Clipboard; |
29 |
|
import java.awt.datatransfer.DataFlavor; |
30 |
|
import java.awt.datatransfer.StringSelection; |
31 |
|
import java.awt.datatransfer.Transferable; |
32 |
|
import java.awt.dnd.DnDConstants; |
33 |
|
import java.awt.dnd.DropTargetDragEvent; |
34 |
|
import java.awt.dnd.DropTargetDropEvent; |
35 |
|
import java.awt.dnd.DropTargetEvent; |
36 |
|
import java.awt.dnd.DropTargetListener; |
37 |
|
import java.awt.event.ActionEvent; |
38 |
|
import java.awt.event.ActionListener; |
39 |
|
import java.awt.event.FocusAdapter; |
40 |
|
import java.awt.event.FocusEvent; |
41 |
|
import java.awt.event.ItemEvent; |
42 |
|
import java.awt.event.ItemListener; |
43 |
|
import java.awt.event.KeyAdapter; |
44 |
|
import java.awt.event.KeyEvent; |
45 |
|
import java.awt.event.MouseEvent; |
46 |
|
import java.awt.print.PageFormat; |
47 |
|
import java.awt.print.PrinterJob; |
48 |
|
import java.beans.PropertyChangeEvent; |
49 |
|
import java.io.File; |
50 |
|
import java.io.FileWriter; |
51 |
|
import java.io.IOException; |
52 |
|
import java.io.OutputStreamWriter; |
53 |
|
import java.io.PrintWriter; |
54 |
|
import java.net.URL; |
55 |
|
import java.util.ArrayList; |
56 |
|
import java.util.Arrays; |
57 |
|
import java.util.Deque; |
58 |
|
import java.util.Enumeration; |
59 |
|
import java.util.HashMap; |
60 |
|
import java.util.Hashtable; |
61 |
|
import java.util.List; |
62 |
|
import java.util.Locale; |
63 |
|
import java.util.Map; |
64 |
|
import java.util.Vector; |
65 |
|
|
66 |
|
import javax.swing.ButtonGroup; |
67 |
|
import javax.swing.JCheckBoxMenuItem; |
68 |
|
import javax.swing.JComponent; |
69 |
|
import javax.swing.JEditorPane; |
70 |
|
import javax.swing.JInternalFrame; |
71 |
|
import javax.swing.JLabel; |
72 |
|
import javax.swing.JLayeredPane; |
73 |
|
import javax.swing.JMenu; |
74 |
|
import javax.swing.JMenuItem; |
75 |
|
import javax.swing.JPanel; |
76 |
|
import javax.swing.JProgressBar; |
77 |
|
import javax.swing.JScrollPane; |
78 |
|
import javax.swing.SwingUtilities; |
79 |
|
|
80 |
|
import ext.vamsas.ServiceHandle; |
81 |
|
import jalview.analysis.AlignmentSorter; |
82 |
|
import jalview.analysis.AlignmentUtils; |
83 |
|
import jalview.analysis.CrossRef; |
84 |
|
import jalview.analysis.Dna; |
85 |
|
import jalview.analysis.GeneticCodeI; |
86 |
|
import jalview.analysis.ParseProperties; |
87 |
|
import jalview.analysis.SequenceIdMatcher; |
88 |
|
import jalview.api.AlignExportSettingsI; |
89 |
|
import jalview.api.AlignViewControllerGuiI; |
90 |
|
import jalview.api.AlignViewControllerI; |
91 |
|
import jalview.api.AlignViewportI; |
92 |
|
import jalview.api.AlignmentViewPanel; |
93 |
|
import jalview.api.FeatureSettingsControllerI; |
94 |
|
import jalview.api.FeatureSettingsModelI; |
95 |
|
import jalview.api.SplitContainerI; |
96 |
|
import jalview.api.ViewStyleI; |
97 |
|
import jalview.api.analysis.SimilarityParamsI; |
98 |
|
import jalview.bin.Cache; |
99 |
|
import jalview.bin.Console; |
100 |
|
import jalview.bin.Jalview; |
101 |
|
import jalview.bin.groovy.JalviewObjectI; |
102 |
|
import jalview.commands.CommandI; |
103 |
|
import jalview.commands.EditCommand; |
104 |
|
import jalview.commands.EditCommand.Action; |
105 |
|
import jalview.commands.OrderCommand; |
106 |
|
import jalview.commands.RemoveGapColCommand; |
107 |
|
import jalview.commands.RemoveGapsCommand; |
108 |
|
import jalview.commands.SlideSequencesCommand; |
109 |
|
import jalview.commands.TrimRegionCommand; |
110 |
|
import jalview.datamodel.AlignExportSettingsAdapter; |
111 |
|
import jalview.datamodel.AlignedCodonFrame; |
112 |
|
import jalview.datamodel.Alignment; |
113 |
|
import jalview.datamodel.AlignmentAnnotation; |
114 |
|
import jalview.datamodel.AlignmentExportData; |
115 |
|
import jalview.datamodel.AlignmentI; |
116 |
|
import jalview.datamodel.AlignmentOrder; |
117 |
|
import jalview.datamodel.AlignmentView; |
118 |
|
import jalview.datamodel.ColumnSelection; |
119 |
|
import jalview.datamodel.ContactMatrixI; |
120 |
|
import jalview.datamodel.HiddenColumns; |
121 |
|
import jalview.datamodel.PDBEntry; |
122 |
|
import jalview.datamodel.SeqCigar; |
123 |
|
import jalview.datamodel.Sequence; |
124 |
|
import jalview.datamodel.SequenceGroup; |
125 |
|
import jalview.datamodel.SequenceI; |
126 |
|
import jalview.gui.ColourMenuHelper.ColourChangeListener; |
127 |
|
import jalview.gui.ViewSelectionMenu.ViewSetProvider; |
128 |
|
import jalview.io.AlignmentProperties; |
129 |
|
import jalview.io.AnnotationFile; |
130 |
|
import jalview.io.BackupFiles; |
131 |
|
import jalview.io.BioJsHTMLOutput; |
132 |
|
import jalview.io.DataSourceType; |
133 |
|
import jalview.io.FileFormat; |
134 |
|
import jalview.io.FileFormatI; |
135 |
|
import jalview.io.FileFormats; |
136 |
|
import jalview.io.FileLoader; |
137 |
|
import jalview.io.FileParse; |
138 |
|
import jalview.io.FormatAdapter; |
139 |
|
import jalview.io.HtmlSvgOutput; |
140 |
|
import jalview.io.IdentifyFile; |
141 |
|
import jalview.io.JPredFile; |
142 |
|
import jalview.io.JalviewFileChooser; |
143 |
|
import jalview.io.JalviewFileView; |
144 |
|
import jalview.io.JnetAnnotationMaker; |
145 |
|
import jalview.io.NewickFile; |
146 |
|
import jalview.io.ScoreMatrixFile; |
147 |
|
import jalview.io.TCoffeeScoreFile; |
148 |
|
import jalview.io.exceptions.ImageOutputException; |
149 |
|
import jalview.io.vcf.VCFLoader; |
150 |
|
import jalview.jbgui.GAlignFrame; |
151 |
|
import jalview.project.Jalview2XML; |
152 |
|
import jalview.schemes.ColourSchemeI; |
153 |
|
import jalview.schemes.ColourSchemes; |
154 |
|
import jalview.schemes.ResidueColourScheme; |
155 |
|
import jalview.schemes.TCoffeeColourScheme; |
156 |
|
import jalview.util.Constants; |
157 |
|
import jalview.util.HttpUtils; |
158 |
|
import jalview.util.ImageMaker.TYPE; |
159 |
|
import jalview.util.MessageManager; |
160 |
|
import jalview.util.Platform; |
161 |
|
import jalview.util.imagemaker.BitmapImageSizing; |
162 |
|
import jalview.viewmodel.AlignmentViewport; |
163 |
|
import jalview.viewmodel.ViewportRanges; |
164 |
|
import jalview.ws.DBRefFetcher; |
165 |
|
import jalview.ws.DBRefFetcher.FetchFinishedListenerI; |
166 |
|
import jalview.ws.jws1.Discoverer; |
167 |
|
import jalview.ws.jws2.Jws2Discoverer; |
168 |
|
import jalview.ws.jws2.jabaws2.Jws2Instance; |
169 |
|
import jalview.ws.seqfetcher.DbSourceProxy; |
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
@author |
175 |
|
@version |
176 |
|
|
177 |
|
@SuppressWarnings("serial") |
|
|
| 32.5% |
Uncovered Elements: 1,920 (2,843) |
Complexity: 743 |
Complexity Density: 0.39 |
|
178 |
|
public class AlignFrame extends GAlignFrame implements DropTargetListener, |
179 |
|
IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener |
180 |
|
{ |
181 |
|
|
182 |
|
public static final int DEFAULT_WIDTH = 700; |
183 |
|
|
184 |
|
public static final int DEFAULT_HEIGHT = 500; |
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
public AlignmentPanel alignPanel; |
190 |
|
|
191 |
|
AlignViewport viewport; |
192 |
|
|
193 |
|
public AlignViewControllerI avc; |
194 |
|
|
195 |
|
List<AlignmentPanel> alignPanels = new ArrayList<>(); |
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
FileFormatI currentFileFormat = null; |
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
205 |
|
String fileName = null; |
206 |
|
|
207 |
|
File fileObject; |
208 |
|
|
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
@param |
213 |
|
@param |
214 |
|
@param |
215 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
216 |
357 |
public AlignFrame(AlignmentI al, int width, int height)... |
217 |
|
{ |
218 |
357 |
this(al, null, width, height); |
219 |
|
} |
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
|
@param |
226 |
|
@param |
227 |
|
@param |
228 |
|
@param |
229 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
230 |
0 |
public AlignFrame(AlignmentI al, int width, int height,... |
231 |
|
String sequenceSetId) |
232 |
|
{ |
233 |
0 |
this(al, null, width, height, sequenceSetId); |
234 |
|
} |
235 |
|
|
236 |
|
|
237 |
|
|
238 |
|
|
239 |
|
|
240 |
|
@param |
241 |
|
@param |
242 |
|
@param |
243 |
|
@param |
244 |
|
@param |
245 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
246 |
85 |
public AlignFrame(AlignmentI al, int width, int height,... |
247 |
|
String sequenceSetId, String viewId) |
248 |
|
{ |
249 |
85 |
this(al, null, width, height, sequenceSetId, viewId); |
250 |
|
} |
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
|
255 |
|
@param |
256 |
|
|
257 |
|
@param |
258 |
|
|
259 |
|
@param |
260 |
|
|
261 |
|
@param |
262 |
|
|
263 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
264 |
357 |
public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width,... |
265 |
|
int height) |
266 |
|
{ |
267 |
357 |
this(al, hiddenColumns, width, height, null); |
268 |
|
} |
269 |
|
|
270 |
|
|
271 |
|
|
272 |
|
|
273 |
|
|
274 |
|
@param |
275 |
|
@param |
276 |
|
@param |
277 |
|
@param |
278 |
|
@param |
279 |
|
|
280 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
281 |
357 |
public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width,... |
282 |
|
int height, String sequenceSetId) |
283 |
|
{ |
284 |
357 |
this(al, hiddenColumns, width, height, sequenceSetId, null); |
285 |
|
} |
286 |
|
|
287 |
|
|
288 |
|
|
289 |
|
|
290 |
|
|
291 |
|
@param |
292 |
|
@param |
293 |
|
@param |
294 |
|
@param |
295 |
|
@param |
296 |
|
|
297 |
|
@param |
298 |
|
|
299 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
300 |
442 |
public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width,... |
301 |
|
int height, String sequenceSetId, String viewId) |
302 |
|
{ |
303 |
442 |
setSize(width, height); |
304 |
|
|
305 |
442 |
if (al.getDataset() == null) |
306 |
|
{ |
307 |
342 |
al.setDataset(null); |
308 |
|
} |
309 |
|
|
310 |
442 |
viewport = new AlignViewport(al, hiddenColumns, sequenceSetId, viewId); |
311 |
|
|
312 |
442 |
alignPanel = new AlignmentPanel(this, viewport); |
313 |
|
|
314 |
442 |
addAlignmentPanel(alignPanel, true); |
315 |
442 |
init(); |
316 |
|
} |
317 |
|
|
|
|
| 84.6% |
Uncovered Elements: 2 (13) |
Complexity: 4 |
Complexity Density: 0.44 |
|
318 |
5 |
public AlignFrame(AlignmentI al, SequenceI[] hiddenSeqs,... |
319 |
|
HiddenColumns hiddenColumns, int width, int height) |
320 |
|
{ |
321 |
5 |
setSize(width, height); |
322 |
|
|
323 |
5 |
if (al.getDataset() == null) |
324 |
|
{ |
325 |
5 |
al.setDataset(null); |
326 |
|
} |
327 |
|
|
328 |
5 |
viewport = new AlignViewport(al, hiddenColumns); |
329 |
|
|
330 |
5 |
if (hiddenSeqs != null && hiddenSeqs.length > 0) |
331 |
|
{ |
332 |
5 |
viewport.hideSequence(hiddenSeqs); |
333 |
|
} |
334 |
5 |
alignPanel = new AlignmentPanel(this, viewport); |
335 |
5 |
addAlignmentPanel(alignPanel, true); |
336 |
5 |
init(); |
337 |
|
} |
338 |
|
|
339 |
|
|
340 |
|
|
341 |
|
|
342 |
|
@param |
343 |
|
|
344 |
|
@param |
345 |
|
|
346 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
347 |
5 |
public AlignFrame(AlignmentPanel ap)... |
348 |
|
{ |
349 |
5 |
viewport = ap.av; |
350 |
5 |
alignPanel = ap; |
351 |
5 |
addAlignmentPanel(ap, false); |
352 |
5 |
init(); |
353 |
|
} |
354 |
|
|
355 |
|
|
356 |
|
|
357 |
|
|
358 |
|
|
|
|
| 88.5% |
Uncovered Elements: 6 (52) |
Complexity: 11 |
Complexity Density: 0.32 |
|
359 |
452 |
void init()... |
360 |
|
{ |
361 |
452 |
setFrameIcon(null); |
362 |
|
|
363 |
|
|
364 |
|
|
365 |
452 |
if (!Jalview.isHeadlessMode()) |
366 |
|
{ |
367 |
389 |
progressBar = new ProgressBar(this.statusPanel, this.statusBar); |
368 |
|
} |
369 |
|
|
370 |
452 |
avc = new jalview.controller.AlignViewController(this, viewport, |
371 |
|
alignPanel); |
372 |
452 |
if (viewport.getAlignmentConservationAnnotation() == null) |
373 |
|
{ |
374 |
|
|
375 |
82 |
conservationMenuItem.setEnabled(false); |
376 |
82 |
modifyConservation.setEnabled(false); |
377 |
|
|
378 |
|
|
379 |
|
|
380 |
|
} |
381 |
|
|
382 |
452 |
String sortby = Cache.getDefault("SORT_ALIGNMENT", "No sort"); |
383 |
|
|
384 |
452 |
if (sortby.equals("Id")) |
385 |
|
{ |
386 |
0 |
sortIDMenuItem_actionPerformed(null); |
387 |
|
} |
388 |
452 |
else if (sortby.equals("Pairwise Identity")) |
389 |
|
{ |
390 |
0 |
sortPairwiseMenuItem_actionPerformed(null); |
391 |
|
} |
392 |
|
|
393 |
452 |
this.alignPanel.av |
394 |
|
.setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); |
395 |
|
|
396 |
452 |
setMenusFromViewport(viewport); |
397 |
452 |
buildSortByAnnotationScoresMenu(); |
398 |
452 |
calculateTree.addActionListener(new ActionListener() |
399 |
|
{ |
400 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
401 |
0 |
@Override... |
402 |
|
public void actionPerformed(ActionEvent e) |
403 |
|
{ |
404 |
0 |
openTreePcaDialog(); |
405 |
|
} |
406 |
|
}); |
407 |
452 |
buildColourMenu(); |
408 |
|
|
409 |
452 |
if (Desktop.desktop != null) |
410 |
|
{ |
411 |
397 |
this.setDropTarget(new java.awt.dnd.DropTarget(this, this)); |
412 |
397 |
if (!Platform.isJS()) |
413 |
|
{ |
414 |
397 |
addServiceListeners(); |
415 |
|
} |
416 |
397 |
setGUINucleotide(); |
417 |
|
} |
418 |
|
|
419 |
452 |
if (viewport.getWrapAlignment()) |
420 |
|
{ |
421 |
7 |
wrapMenuItem_actionPerformed(null); |
422 |
|
} |
423 |
|
|
424 |
452 |
if (Cache.getDefault("SHOW_OVERVIEW", false)) |
425 |
|
{ |
426 |
28 |
this.overviewMenuItem_actionPerformed(null); |
427 |
|
} |
428 |
|
|
429 |
452 |
addKeyListener(); |
430 |
|
|
431 |
452 |
final List<AlignmentViewPanel> selviews = new ArrayList<>(); |
432 |
452 |
final List<AlignmentPanel> origview = new ArrayList<>(); |
433 |
452 |
final String menuLabel = MessageManager |
434 |
|
.getString("label.copy_format_from"); |
435 |
452 |
ViewSelectionMenu vsel = new ViewSelectionMenu(menuLabel, |
436 |
|
new ViewSetProvider() |
437 |
|
{ |
438 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
439 |
0 |
@Override... |
440 |
|
public AlignmentPanel[] getAllAlignmentPanels() |
441 |
|
{ |
442 |
0 |
origview.clear(); |
443 |
0 |
origview.add(alignPanel); |
444 |
|
|
445 |
0 |
List<AlignmentPanel> aps = new ArrayList<>( |
446 |
|
Arrays.asList(Desktop.getAlignmentPanels(null))); |
447 |
0 |
aps.remove(AlignFrame.this.alignPanel); |
448 |
0 |
return aps.toArray(new AlignmentPanel[aps.size()]); |
449 |
|
} |
450 |
|
}, selviews, new ItemListener() |
451 |
|
{ |
452 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 5 |
Complexity Density: 0.33 |
|
453 |
0 |
@Override... |
454 |
|
public void itemStateChanged(ItemEvent e) |
455 |
|
{ |
456 |
0 |
if (origview.size() > 0) |
457 |
|
{ |
458 |
0 |
final AlignmentPanel ap = origview.get(0); |
459 |
|
|
460 |
|
|
461 |
|
|
462 |
|
|
463 |
|
|
464 |
|
|
465 |
0 |
ViewStyleI vs = selviews.get(0).getAlignViewport() |
466 |
|
.getViewStyle(); |
467 |
0 |
boolean fromSplitFrame = selviews.get(0) |
468 |
|
.getAlignViewport().getCodingComplement() != null; |
469 |
0 |
if (!fromSplitFrame) |
470 |
|
{ |
471 |
0 |
vs.setScaleProteinAsCdna(ap.getAlignViewport() |
472 |
|
.getViewStyle().isScaleProteinAsCdna()); |
473 |
|
} |
474 |
0 |
ap.getAlignViewport().setViewStyle(vs); |
475 |
|
|
476 |
|
|
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
|
481 |
|
|
482 |
0 |
AlignViewportI complement = ap.getAlignViewport() |
483 |
|
.getCodingComplement(); |
484 |
0 |
if (complement != null && vs.isScaleProteinAsCdna()) |
485 |
|
{ |
486 |
0 |
AlignFrame af = Desktop.getAlignFrameFor(complement); |
487 |
0 |
((SplitFrame) af.getSplitViewContainer()) |
488 |
|
.adjustLayout(); |
489 |
0 |
af.setMenusForViewport(); |
490 |
|
} |
491 |
|
|
492 |
0 |
ap.updateLayout(); |
493 |
0 |
ap.setSelected(true); |
494 |
0 |
ap.alignFrame.setMenusForViewport(); |
495 |
|
|
496 |
|
} |
497 |
|
} |
498 |
|
}); |
499 |
452 |
if (Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase(Locale.ROOT) |
500 |
|
.indexOf("devel") > -1 |
501 |
|
|| Cache.getDefault("VERSION", "DEVELOPMENT") |
502 |
|
.toLowerCase(Locale.ROOT).indexOf("test") > -1) |
503 |
|
{ |
504 |
452 |
formatMenu.add(vsel); |
505 |
|
} |
506 |
452 |
addFocusListener(new FocusAdapter() |
507 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
508 |
361 |
@Override... |
509 |
|
public void focusGained(FocusEvent e) |
510 |
|
{ |
511 |
361 |
Jalview.getInstance().setCurrentAlignFrame(AlignFrame.this); |
512 |
|
} |
513 |
|
}); |
514 |
|
|
515 |
|
} |
516 |
|
|
517 |
|
|
518 |
|
|
519 |
|
|
520 |
|
|
521 |
|
@param |
522 |
|
|
523 |
|
@param |
524 |
|
|
525 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
526 |
326 |
public void setFileName(String file, FileFormatI format)... |
527 |
|
{ |
528 |
326 |
fileName = file; |
529 |
326 |
setFileFormat(format); |
530 |
326 |
reload.setEnabled(true); |
531 |
|
} |
532 |
|
|
533 |
|
|
534 |
|
|
535 |
|
|
536 |
|
|
537 |
|
@param |
538 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
539 |
241 |
public void setFileObject(File file)... |
540 |
|
{ |
541 |
241 |
this.fileObject = file; |
542 |
|
} |
543 |
|
|
544 |
|
|
545 |
|
|
546 |
|
|
547 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
548 |
452 |
void addKeyListener()... |
549 |
|
{ |
550 |
452 |
addKeyListener(new KeyAdapter() |
551 |
|
{ |
|
|
| 0% |
Uncovered Elements: 128 (128) |
Complexity: 50 |
Complexity Density: 0.53 |
|
552 |
0 |
@Override... |
553 |
|
public void keyPressed(KeyEvent evt) |
554 |
|
{ |
555 |
0 |
if (viewport.cursorMode |
556 |
|
&& ((evt.getKeyCode() >= KeyEvent.VK_0 |
557 |
|
&& evt.getKeyCode() <= KeyEvent.VK_9) |
558 |
|
|| (evt.getKeyCode() >= KeyEvent.VK_NUMPAD0 |
559 |
|
&& evt.getKeyCode() <= KeyEvent.VK_NUMPAD9)) |
560 |
|
&& Character.isDigit(evt.getKeyChar())) |
561 |
|
{ |
562 |
0 |
alignPanel.getSeqPanel().numberPressed(evt.getKeyChar()); |
563 |
|
} |
564 |
|
|
565 |
0 |
switch (evt.getKeyCode()) |
566 |
|
{ |
567 |
|
|
568 |
0 |
case 27: |
569 |
0 |
deselectAllSequenceMenuItem_actionPerformed(null); |
570 |
|
|
571 |
0 |
break; |
572 |
|
|
573 |
0 |
case KeyEvent.VK_DOWN: |
574 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
575 |
|
{ |
576 |
0 |
moveSelectedSequences(false); |
577 |
|
} |
578 |
0 |
if (viewport.cursorMode) |
579 |
|
{ |
580 |
0 |
alignPanel.getSeqPanel().moveCursor(0, 1, evt.isShiftDown()); |
581 |
|
} |
582 |
0 |
break; |
583 |
|
|
584 |
0 |
case KeyEvent.VK_UP: |
585 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
586 |
|
{ |
587 |
0 |
moveSelectedSequences(true); |
588 |
|
} |
589 |
0 |
if (viewport.cursorMode) |
590 |
|
{ |
591 |
0 |
alignPanel.getSeqPanel().moveCursor(0, -1, evt.isShiftDown()); |
592 |
|
} |
593 |
|
|
594 |
0 |
break; |
595 |
|
|
596 |
0 |
case KeyEvent.VK_LEFT: |
597 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
598 |
|
{ |
599 |
0 |
slideSequences(false, |
600 |
|
alignPanel.getSeqPanel().getKeyboardNo1()); |
601 |
|
} |
602 |
|
else |
603 |
|
{ |
604 |
0 |
alignPanel.getSeqPanel().moveCursor(-1, 0, evt.isShiftDown()); |
605 |
|
} |
606 |
|
|
607 |
0 |
break; |
608 |
|
|
609 |
0 |
case KeyEvent.VK_RIGHT: |
610 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
611 |
|
{ |
612 |
0 |
slideSequences(true, alignPanel.getSeqPanel().getKeyboardNo1()); |
613 |
|
} |
614 |
|
else |
615 |
|
{ |
616 |
0 |
alignPanel.getSeqPanel().moveCursor(1, 0, evt.isShiftDown()); |
617 |
|
} |
618 |
0 |
break; |
619 |
|
|
620 |
0 |
case KeyEvent.VK_SPACE: |
621 |
0 |
if (viewport.cursorMode) |
622 |
|
{ |
623 |
0 |
alignPanel.getSeqPanel().insertGapAtCursor(evt.isControlDown() |
624 |
|
|| evt.isShiftDown() || evt.isAltDown()); |
625 |
|
} |
626 |
0 |
break; |
627 |
|
|
628 |
|
|
629 |
|
|
630 |
|
|
631 |
|
|
632 |
|
|
633 |
|
|
634 |
|
|
635 |
|
|
636 |
|
|
637 |
|
|
638 |
|
|
639 |
0 |
case KeyEvent.VK_DELETE: |
640 |
0 |
case KeyEvent.VK_BACK_SPACE: |
641 |
0 |
if (!viewport.cursorMode) |
642 |
|
{ |
643 |
0 |
cut_actionPerformed(); |
644 |
|
} |
645 |
|
else |
646 |
|
{ |
647 |
0 |
alignPanel.getSeqPanel().deleteGapAtCursor(evt.isControlDown() |
648 |
|
|| evt.isShiftDown() || evt.isAltDown()); |
649 |
|
} |
650 |
|
|
651 |
0 |
break; |
652 |
|
|
653 |
0 |
case KeyEvent.VK_S: |
654 |
0 |
if (viewport.cursorMode) |
655 |
|
{ |
656 |
0 |
alignPanel.getSeqPanel().setCursorRow(); |
657 |
|
} |
658 |
0 |
break; |
659 |
0 |
case KeyEvent.VK_C: |
660 |
0 |
if (viewport.cursorMode && !evt.isControlDown()) |
661 |
|
{ |
662 |
0 |
alignPanel.getSeqPanel().setCursorColumn(); |
663 |
|
} |
664 |
0 |
break; |
665 |
0 |
case KeyEvent.VK_P: |
666 |
0 |
if (viewport.cursorMode) |
667 |
|
{ |
668 |
0 |
alignPanel.getSeqPanel().setCursorPosition(); |
669 |
|
} |
670 |
0 |
break; |
671 |
|
|
672 |
0 |
case KeyEvent.VK_ENTER: |
673 |
0 |
case KeyEvent.VK_COMMA: |
674 |
0 |
if (viewport.cursorMode) |
675 |
|
{ |
676 |
0 |
alignPanel.getSeqPanel().setCursorRowAndColumn(); |
677 |
|
} |
678 |
0 |
break; |
679 |
|
|
680 |
0 |
case KeyEvent.VK_Q: |
681 |
0 |
if (viewport.cursorMode) |
682 |
|
{ |
683 |
0 |
alignPanel.getSeqPanel().setSelectionAreaAtCursor(true); |
684 |
|
} |
685 |
0 |
break; |
686 |
0 |
case KeyEvent.VK_M: |
687 |
0 |
if (viewport.cursorMode) |
688 |
|
{ |
689 |
0 |
alignPanel.getSeqPanel().setSelectionAreaAtCursor(false); |
690 |
|
} |
691 |
0 |
break; |
692 |
|
|
693 |
0 |
case KeyEvent.VK_F2: |
694 |
0 |
viewport.cursorMode = !viewport.cursorMode; |
695 |
0 |
setStatus(MessageManager |
696 |
|
.formatMessage("label.keyboard_editing_mode", new String[] |
697 |
0 |
{ (viewport.cursorMode ? "on" : "off") })); |
698 |
0 |
if (viewport.cursorMode) |
699 |
|
{ |
700 |
0 |
ViewportRanges ranges = viewport.getRanges(); |
701 |
0 |
alignPanel.getSeqPanel().seqCanvas.cursorX = ranges |
702 |
|
.getStartRes(); |
703 |
0 |
alignPanel.getSeqPanel().seqCanvas.cursorY = ranges |
704 |
|
.getStartSeq(); |
705 |
|
} |
706 |
0 |
alignPanel.getSeqPanel().seqCanvas.repaint(); |
707 |
0 |
break; |
708 |
|
|
709 |
0 |
case KeyEvent.VK_F1: |
710 |
0 |
try |
711 |
|
{ |
712 |
0 |
Help.showHelpWindow(); |
713 |
|
} catch (Exception ex) |
714 |
|
{ |
715 |
0 |
ex.printStackTrace(); |
716 |
|
} |
717 |
0 |
break; |
718 |
0 |
case KeyEvent.VK_H: |
719 |
|
{ |
720 |
0 |
boolean toggleSeqs = !evt.isControlDown(); |
721 |
0 |
boolean toggleCols = !evt.isShiftDown(); |
722 |
0 |
toggleHiddenRegions(toggleSeqs, toggleCols); |
723 |
0 |
break; |
724 |
|
} |
725 |
0 |
case KeyEvent.VK_B: |
726 |
|
{ |
727 |
0 |
boolean toggleSel = evt.isControlDown() || evt.isMetaDown(); |
728 |
0 |
boolean modifyExisting = true; |
729 |
|
|
730 |
0 |
boolean invertHighlighted = evt.isAltDown(); |
731 |
0 |
avc.markHighlightedColumns(invertHighlighted, modifyExisting, |
732 |
|
toggleSel); |
733 |
0 |
break; |
734 |
|
} |
735 |
0 |
case KeyEvent.VK_PAGE_UP: |
736 |
0 |
viewport.getRanges().pageUp(); |
737 |
0 |
break; |
738 |
0 |
case KeyEvent.VK_PAGE_DOWN: |
739 |
0 |
viewport.getRanges().pageDown(); |
740 |
0 |
break; |
741 |
|
} |
742 |
|
} |
743 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 7 |
Complexity Density: 0.78 |
|
744 |
0 |
@Override... |
745 |
|
public void keyReleased(KeyEvent evt) |
746 |
|
{ |
747 |
0 |
switch (evt.getKeyCode()) |
748 |
|
{ |
749 |
0 |
case KeyEvent.VK_LEFT: |
750 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
751 |
|
{ |
752 |
0 |
viewport.firePropertyChange("alignment", null, |
753 |
|
viewport.getAlignment().getSequences()); |
754 |
|
} |
755 |
0 |
break; |
756 |
|
|
757 |
0 |
case KeyEvent.VK_RIGHT: |
758 |
0 |
if (evt.isAltDown() || !viewport.cursorMode) |
759 |
|
{ |
760 |
0 |
viewport.firePropertyChange("alignment", null, |
761 |
|
viewport.getAlignment().getSequences()); |
762 |
|
} |
763 |
0 |
break; |
764 |
|
} |
765 |
|
} |
766 |
|
}); |
767 |
|
} |
768 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (29) |
Complexity: 6 |
Complexity Density: 0.29 |
|
769 |
501 |
public void addAlignmentPanel(final AlignmentPanel ap, boolean newPanel)... |
770 |
|
{ |
771 |
501 |
ap.alignFrame = this; |
772 |
501 |
avc = new jalview.controller.AlignViewController(this, viewport, |
773 |
|
alignPanel); |
774 |
|
|
775 |
501 |
alignPanels.add(ap); |
776 |
|
|
777 |
501 |
PaintRefresher.Register(ap, ap.av.getSequenceSetId()); |
778 |
|
|
779 |
501 |
int aSize = alignPanels.size(); |
780 |
|
|
781 |
501 |
tabbedPane.setVisible(aSize > 1 || ap.av.getViewName() != null); |
782 |
|
|
783 |
501 |
if (aSize == 1 && ap.av.getViewName() == null) |
784 |
|
{ |
785 |
447 |
this.getContentPane().add(ap, BorderLayout.CENTER); |
786 |
|
} |
787 |
|
else |
788 |
|
{ |
789 |
54 |
if (aSize == 2) |
790 |
|
{ |
791 |
23 |
setInitialTabVisible(); |
792 |
|
} |
793 |
|
|
794 |
54 |
expandViews.setEnabled(true); |
795 |
54 |
gatherViews.setEnabled(true); |
796 |
54 |
tabbedPane.addTab(ap.av.getViewName(), ap); |
797 |
|
|
798 |
54 |
ap.setVisible(false); |
799 |
|
} |
800 |
|
|
801 |
501 |
if (newPanel) |
802 |
|
{ |
803 |
457 |
if (ap.av.isPadGaps()) |
804 |
|
{ |
805 |
188 |
ap.av.getAlignment().padGaps(); |
806 |
|
} |
807 |
457 |
ap.av.updateConservation(ap); |
808 |
457 |
ap.av.updateConsensus(ap); |
809 |
457 |
ap.av.updateSecondaryStructureConsensus(ap); |
810 |
457 |
ap.av.updateStrucConsensus(ap); |
811 |
|
} |
812 |
|
} |
813 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
814 |
82 |
public void setInitialTabVisible()... |
815 |
|
{ |
816 |
82 |
expandViews.setEnabled(true); |
817 |
82 |
gatherViews.setEnabled(true); |
818 |
82 |
tabbedPane.setVisible(true); |
819 |
82 |
AlignmentPanel first = alignPanels.get(0); |
820 |
82 |
tabbedPane.addTab(first.av.getViewName(), first); |
821 |
82 |
this.getContentPane().add(tabbedPane, BorderLayout.CENTER); |
822 |
|
} |
823 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
824 |
2585 |
public AlignViewport getViewport()... |
825 |
|
{ |
826 |
2585 |
return viewport; |
827 |
|
} |
828 |
|
|
829 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
830 |
397 |
private void addServiceListeners()... |
831 |
|
{ |
832 |
397 |
final java.beans.PropertyChangeListener thisListener; |
833 |
397 |
Desktop.instance.addJalviewPropertyChangeListener("services", |
834 |
|
thisListener = new java.beans.PropertyChangeListener() |
835 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
836 |
1807 |
@Override... |
837 |
|
public void propertyChange(PropertyChangeEvent evt) |
838 |
|
{ |
839 |
|
|
840 |
|
|
841 |
|
|
842 |
|
{ |
843 |
1807 |
SwingUtilities.invokeLater(new Runnable() |
844 |
|
{ |
845 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
846 |
1807 |
@Override... |
847 |
|
public void run() |
848 |
|
{ |
849 |
1807 |
jalview.bin.Console.errPrintln( |
850 |
|
"Rebuild WS Menu for service change"); |
851 |
1807 |
BuildWebServiceMenu(); |
852 |
|
} |
853 |
|
|
854 |
|
}); |
855 |
|
} |
856 |
|
} |
857 |
|
}); |
858 |
397 |
addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() |
859 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
860 |
260 |
@Override... |
861 |
|
public void internalFrameClosed( |
862 |
|
javax.swing.event.InternalFrameEvent evt) |
863 |
|
{ |
864 |
|
|
865 |
260 |
Desktop.instance.removeJalviewPropertyChangeListener("services", |
866 |
|
thisListener); |
867 |
260 |
closeMenuItem_actionPerformed(true); |
868 |
|
} |
869 |
|
}); |
870 |
|
|
871 |
397 |
new Thread(new Runnable() |
872 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
873 |
397 |
@Override... |
874 |
|
public void run() |
875 |
|
{ |
876 |
397 |
BuildWebServiceMenu(); |
877 |
|
} |
878 |
|
}).start(); |
879 |
|
} |
880 |
|
|
881 |
|
|
882 |
|
|
883 |
|
|
884 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
|
885 |
397 |
public void setGUINucleotide()... |
886 |
|
{ |
887 |
397 |
AlignmentI al = getViewport().getAlignment(); |
888 |
397 |
boolean nucleotide = al.isNucleotide(); |
889 |
|
|
890 |
397 |
loadVcf.setVisible(nucleotide); |
891 |
397 |
showTranslation.setVisible(nucleotide); |
892 |
397 |
showReverse.setVisible(nucleotide); |
893 |
397 |
showReverseComplement.setVisible(nucleotide); |
894 |
397 |
conservationMenuItem.setEnabled(!nucleotide); |
895 |
397 |
modifyConservation |
896 |
|
.setEnabled(!nucleotide && conservationMenuItem.isSelected()); |
897 |
397 |
byConsensusSecondaryStructureMenuItem.setEnabled(!nucleotide); |
898 |
397 |
modifyConsensusSecondaryStructureThreshold.setEnabled(!nucleotide |
899 |
|
&& byConsensusSecondaryStructureMenuItem.isSelected()); |
900 |
397 |
showGroupConservation.setEnabled(!nucleotide); |
901 |
|
|
902 |
397 |
showComplementMenuItem |
903 |
397 |
.setText(nucleotide ? MessageManager.getString("label.protein") |
904 |
|
: MessageManager.getString("label.nucleotide")); |
905 |
|
} |
906 |
|
|
907 |
|
|
908 |
|
|
909 |
|
|
910 |
|
|
911 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
912 |
30 |
@Override... |
913 |
|
public void setMenusForViewport() |
914 |
|
{ |
915 |
30 |
setMenusFromViewport(viewport); |
916 |
|
} |
917 |
|
|
918 |
|
|
919 |
|
|
920 |
|
|
921 |
|
|
922 |
|
@param |
923 |
|
|
924 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (43) |
Complexity: 1 |
Complexity Density: 0.02 |
|
925 |
672 |
public void setMenusFromViewport(AlignViewport av)... |
926 |
|
{ |
927 |
672 |
padGapsMenuitem.setSelected(av.isPadGaps()); |
928 |
672 |
colourTextMenuItem.setSelected(av.isShowColourText()); |
929 |
672 |
abovePIDThreshold.setSelected(av.getAbovePIDThreshold()); |
930 |
672 |
modifyPID.setEnabled(abovePIDThreshold.isSelected()); |
931 |
672 |
conservationMenuItem.setSelected(av.getConservationSelected()); |
932 |
672 |
modifyConservation.setEnabled(conservationMenuItem.isSelected()); |
933 |
672 |
byConsensusSecondaryStructureMenuItem |
934 |
|
.setSelected(av.getByConsensusSecondaryStructureSelected()); |
935 |
672 |
modifyConsensusSecondaryStructureThreshold |
936 |
|
.setEnabled(byConsensusSecondaryStructureMenuItem.isSelected()); |
937 |
672 |
seqLimits.setSelected(av.getShowJVSuffix()); |
938 |
672 |
idRightAlign.setSelected(av.isRightAlignIds()); |
939 |
672 |
centreColumnLabelsMenuItem.setState(av.isCentreColumnLabels()); |
940 |
672 |
renderGapsMenuItem.setSelected(av.isRenderGaps()); |
941 |
672 |
wrapMenuItem.setSelected(av.getWrapAlignment()); |
942 |
672 |
scaleAbove.setVisible(av.getWrapAlignment()); |
943 |
672 |
scaleLeft.setVisible(av.getWrapAlignment()); |
944 |
672 |
scaleRight.setVisible(av.getWrapAlignment()); |
945 |
672 |
annotationPanelMenuItem.setState(av.isShowAnnotation()); |
946 |
|
|
947 |
|
|
948 |
|
|
949 |
672 |
showAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState()); |
950 |
672 |
hideAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState()); |
951 |
672 |
showAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState()); |
952 |
672 |
hideAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState()); |
953 |
672 |
viewBoxesMenuItem.setSelected(av.getShowBoxes()); |
954 |
672 |
viewTextMenuItem.setSelected(av.getShowText()); |
955 |
672 |
showNonconservedMenuItem.setSelected(av.getShowUnconserved()); |
956 |
672 |
showGroupConsensus.setSelected(av.isShowGroupConsensus()); |
957 |
672 |
showGroupSSConsensus.setSelected(av.isShowGroupSSConsensus()); |
958 |
672 |
showStrucProvider.setSelected(av.isShowStructureProvider()); |
959 |
672 |
showGroupConservation.setSelected(av.isShowGroupConservation()); |
960 |
672 |
showConsensusHistogram.setSelected(av.isShowConsensusHistogram()); |
961 |
672 |
showSequenceLogo.setSelected(av.isShowSequenceLogo()); |
962 |
672 |
normaliseSequenceLogo.setSelected(av.isNormaliseSequenceLogo()); |
963 |
|
|
964 |
672 |
ColourMenuHelper.setColourSelected(colourMenu, |
965 |
|
av.getGlobalColourScheme()); |
966 |
|
|
967 |
672 |
showSeqFeatures.setSelected(av.isShowSequenceFeatures()); |
968 |
672 |
hiddenMarkers.setState(av.getShowHiddenMarkers()); |
969 |
672 |
applyToAllGroups.setState(av.getColourAppliesToAllGroups()); |
970 |
672 |
showNpFeatsMenuitem.setSelected(av.isShowNPFeats()); |
971 |
672 |
showDbRefsMenuitem.setSelected(av.isShowDBRefs()); |
972 |
672 |
autoCalculate.setSelected(av.autoCalculateConsensus); |
973 |
672 |
sortByTree.setSelected(av.sortByTree); |
974 |
672 |
listenToViewSelections.setSelected(av.followSelection); |
975 |
|
|
976 |
672 |
showProducts.setEnabled(canShowProducts()); |
977 |
672 |
setGroovyEnabled(Desktop.getGroovyConsole() != null); |
978 |
|
|
979 |
672 |
updateEditMenuBar(); |
980 |
|
} |
981 |
|
|
982 |
|
|
983 |
|
|
984 |
|
|
985 |
|
@param |
986 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
987 |
672 |
public void setGroovyEnabled(boolean b)... |
988 |
|
{ |
989 |
672 |
runGroovy.setEnabled(b); |
990 |
|
} |
991 |
|
|
992 |
|
private IProgressIndicator progressBar; |
993 |
|
|
994 |
|
|
995 |
|
|
996 |
|
|
997 |
|
@see |
998 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 3 |
Complexity Density: 1.5 |
|
999 |
659 |
@Override... |
1000 |
|
public void setProgressBar(String message, long id) |
1001 |
|
{ |
1002 |
659 |
if (!Platform.isHeadless() && progressBar != null) |
1003 |
279 |
progressBar.setProgressBar(message, id); |
1004 |
|
} |
1005 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1006 |
0 |
@Override... |
1007 |
|
public JProgressBar getProgressBar(long id) |
1008 |
|
{ |
1009 |
0 |
if (progressBar != null) |
1010 |
0 |
return progressBar.getProgressBar(id); |
1011 |
0 |
return null; |
1012 |
|
} |
1013 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1014 |
0 |
public String getMessage(long id)... |
1015 |
|
{ |
1016 |
0 |
return progressBar.getMessage(id); |
1017 |
|
} |
1018 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1019 |
0 |
public void setProgressBarMessage(long id, String message)... |
1020 |
|
{ |
1021 |
0 |
progressBar.setProgressBarMessage(id, message); |
1022 |
|
} |
1023 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1024 |
0 |
@Override... |
1025 |
|
public void registerHandler(final long id, |
1026 |
|
final IProgressIndicatorHandler handler) |
1027 |
|
{ |
1028 |
0 |
if (progressBar != null) |
1029 |
0 |
progressBar.registerHandler(id, handler); |
1030 |
|
} |
1031 |
|
|
1032 |
|
|
1033 |
|
|
1034 |
|
@return |
1035 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
1036 |
17 |
@Override... |
1037 |
|
public boolean operationInProgress() |
1038 |
|
{ |
1039 |
17 |
return progressBar == null ? false : progressBar.operationInProgress(); |
1040 |
|
} |
1041 |
|
|
1042 |
|
|
1043 |
|
|
1044 |
|
|
1045 |
|
|
1046 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 3 |
Complexity Density: 3 |
|
1047 |
398 |
@Override... |
1048 |
|
public void setStatus(String text) |
1049 |
|
{ |
1050 |
398 |
statusBar.setText(text == null || text.isEmpty() ? " " : text); |
1051 |
|
} |
1052 |
|
|
1053 |
|
|
1054 |
|
|
1055 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1056 |
0 |
public String getVersion()... |
1057 |
|
{ |
1058 |
0 |
return Cache.getProperty("VERSION"); |
1059 |
|
} |
1060 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1061 |
49 |
public FeatureRenderer getFeatureRenderer()... |
1062 |
|
{ |
1063 |
49 |
return alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer(); |
1064 |
|
} |
1065 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1066 |
0 |
@Override... |
1067 |
|
public void fetchSequence_actionPerformed() |
1068 |
|
{ |
1069 |
0 |
new SequenceFetcher(this); |
1070 |
|
} |
1071 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1072 |
0 |
@Override... |
1073 |
|
public void addFromFile_actionPerformed(ActionEvent e) |
1074 |
|
{ |
1075 |
0 |
Desktop.instance.inputLocalFileMenuItem_actionPerformed(viewport); |
1076 |
|
} |
1077 |
|
|
|
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 14 |
Complexity Density: 0.5 |
|
1078 |
0 |
@Override... |
1079 |
|
public void reload_actionPerformed(ActionEvent e) |
1080 |
|
{ |
1081 |
0 |
if (fileName != null) |
1082 |
|
{ |
1083 |
|
|
1084 |
|
|
1085 |
|
|
1086 |
|
|
1087 |
0 |
if (FileFormat.Jalview.equals(currentFileFormat)) |
1088 |
|
{ |
1089 |
0 |
JInternalFrame[] frames = Desktop.desktop.getAllFrames(); |
1090 |
0 |
for (int i = 0; i < frames.length; i++) |
1091 |
|
{ |
1092 |
0 |
if (frames[i] instanceof AlignFrame && frames[i] != this |
1093 |
|
&& ((AlignFrame) frames[i]).fileName != null |
1094 |
|
&& ((AlignFrame) frames[i]).fileName.equals(fileName)) |
1095 |
|
{ |
1096 |
0 |
try |
1097 |
|
{ |
1098 |
0 |
frames[i].setSelected(true); |
1099 |
0 |
Desktop.instance.closeAssociatedWindows(); |
1100 |
|
} catch (java.beans.PropertyVetoException ex) |
1101 |
|
{ |
1102 |
|
} |
1103 |
|
} |
1104 |
|
|
1105 |
|
} |
1106 |
0 |
Desktop.instance.closeAssociatedWindows(); |
1107 |
|
|
1108 |
0 |
FileLoader loader = new FileLoader(); |
1109 |
0 |
DataSourceType protocol = HttpUtils.startsWithHttpOrHttps(fileName) |
1110 |
|
? DataSourceType.URL |
1111 |
|
: DataSourceType.FILE; |
1112 |
0 |
loader.LoadFile(viewport, fileName, protocol, currentFileFormat); |
1113 |
|
} |
1114 |
|
else |
1115 |
|
{ |
1116 |
0 |
Rectangle bounds = this.getBounds(); |
1117 |
|
|
1118 |
0 |
FileLoader loader = new FileLoader(); |
1119 |
|
|
1120 |
0 |
AlignFrame newframe = null; |
1121 |
|
|
1122 |
0 |
if (fileObject == null) |
1123 |
|
{ |
1124 |
|
|
1125 |
0 |
DataSourceType protocol = HttpUtils.startsWithHttpOrHttps( |
1126 |
|
fileName) ? DataSourceType.URL : DataSourceType.FILE; |
1127 |
0 |
newframe = loader.LoadFileWaitTillLoaded(fileName, protocol, |
1128 |
|
currentFileFormat); |
1129 |
|
} |
1130 |
|
else |
1131 |
|
{ |
1132 |
0 |
newframe = loader.LoadFileWaitTillLoaded(fileObject, |
1133 |
|
DataSourceType.FILE, currentFileFormat); |
1134 |
|
} |
1135 |
|
|
1136 |
0 |
newframe.setBounds(bounds); |
1137 |
0 |
if (featureSettings != null && featureSettings.isShowing()) |
1138 |
|
{ |
1139 |
0 |
final Rectangle fspos = featureSettings.frame.getBounds(); |
1140 |
|
|
1141 |
|
|
1142 |
0 |
newframe.featureSettings_actionPerformed(null); |
1143 |
0 |
final FeatureSettings nfs = newframe.featureSettings; |
1144 |
0 |
SwingUtilities.invokeLater(new Runnable() |
1145 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1146 |
0 |
@Override... |
1147 |
|
public void run() |
1148 |
|
{ |
1149 |
0 |
nfs.frame.setBounds(fspos); |
1150 |
|
} |
1151 |
|
}); |
1152 |
0 |
this.featureSettings.close(); |
1153 |
0 |
this.featureSettings = null; |
1154 |
|
} |
1155 |
0 |
this.closeMenuItem_actionPerformed(true); |
1156 |
|
} |
1157 |
|
} |
1158 |
|
} |
1159 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1160 |
0 |
@Override... |
1161 |
|
public void addFromText_actionPerformed(ActionEvent e) |
1162 |
|
{ |
1163 |
0 |
Desktop.instance |
1164 |
|
.inputTextboxMenuItem_actionPerformed(viewport.getAlignPanel()); |
1165 |
|
} |
1166 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1167 |
0 |
@Override... |
1168 |
|
public void addFromURL_actionPerformed(ActionEvent e) |
1169 |
|
{ |
1170 |
0 |
Desktop.instance.inputURLMenuItem_actionPerformed(viewport); |
1171 |
|
} |
1172 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 4 |
Complexity Density: 1.33 |
|
1173 |
0 |
@Override... |
1174 |
|
public void save_actionPerformed(ActionEvent e) |
1175 |
|
{ |
1176 |
0 |
if (fileName == null || (currentFileFormat == null) |
1177 |
|
|| HttpUtils.startsWithHttpOrHttps(fileName)) |
1178 |
|
{ |
1179 |
0 |
saveAs_actionPerformed(); |
1180 |
|
} |
1181 |
|
else |
1182 |
|
{ |
1183 |
0 |
saveAlignment(fileName, currentFileFormat); |
1184 |
|
} |
1185 |
|
} |
1186 |
|
|
1187 |
|
|
1188 |
|
|
1189 |
|
|
1190 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 5 |
Complexity Density: 0.26 |
|
1191 |
0 |
@Override... |
1192 |
|
public void saveAs_actionPerformed() |
1193 |
|
{ |
1194 |
0 |
String format = currentFileFormat == null ? null |
1195 |
|
: currentFileFormat.getName(); |
1196 |
0 |
JalviewFileChooser chooser = JalviewFileChooser |
1197 |
|
.forWrite(Cache.getProperty("LAST_DIRECTORY"), format); |
1198 |
|
|
1199 |
0 |
chooser.setFileView(new JalviewFileView()); |
1200 |
0 |
chooser.setDialogTitle( |
1201 |
|
MessageManager.getString("label.save_alignment_to_file")); |
1202 |
0 |
chooser.setToolTipText(MessageManager.getString("action.save")); |
1203 |
|
|
1204 |
0 |
int value = chooser.showSaveDialog(this); |
1205 |
|
|
1206 |
0 |
if (value != JalviewFileChooser.APPROVE_OPTION) |
1207 |
|
{ |
1208 |
0 |
return; |
1209 |
|
} |
1210 |
0 |
currentFileFormat = chooser.getSelectedFormat(); |
1211 |
|
|
1212 |
0 |
while (currentFileFormat == null) |
1213 |
|
{ |
1214 |
0 |
JvOptionPane.showInternalMessageDialog(Desktop.desktop, |
1215 |
|
MessageManager |
1216 |
|
.getString("label.select_file_format_before_saving"), |
1217 |
|
MessageManager.getString("label.file_format_not_specified"), |
1218 |
|
JvOptionPane.WARNING_MESSAGE); |
1219 |
0 |
value = chooser.showSaveDialog(this); |
1220 |
0 |
if (value != JalviewFileChooser.APPROVE_OPTION) |
1221 |
|
{ |
1222 |
0 |
return; |
1223 |
|
} |
1224 |
0 |
currentFileFormat = chooser.getSelectedFormat(); |
1225 |
|
} |
1226 |
|
|
1227 |
0 |
fileName = chooser.getSelectedFile().getPath(); |
1228 |
|
|
1229 |
0 |
Cache.setProperty("DEFAULT_FILE_FORMAT", currentFileFormat.getName()); |
1230 |
0 |
Cache.setProperty("LAST_DIRECTORY", fileName); |
1231 |
0 |
saveAlignment(fileName, currentFileFormat); |
1232 |
|
} |
1233 |
|
|
1234 |
|
boolean lastSaveSuccessful = false; |
1235 |
|
|
1236 |
|
FileFormatI lastFormatSaved; |
1237 |
|
|
1238 |
|
String lastFilenameSaved; |
1239 |
|
|
1240 |
|
|
1241 |
|
|
1242 |
|
|
1243 |
|
@return |
1244 |
|
|
|
|
| 40% |
Uncovered Elements: 6 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
1245 |
88 |
public boolean isSaveAlignmentSuccessful()... |
1246 |
|
{ |
1247 |
|
|
1248 |
88 |
if (!lastSaveSuccessful) |
1249 |
|
{ |
1250 |
0 |
if (!Platform.isHeadless()) |
1251 |
|
{ |
1252 |
0 |
JvOptionPane.showInternalMessageDialog(this, MessageManager |
1253 |
|
.formatMessage("label.couldnt_save_file", new Object[] |
1254 |
|
{ lastFilenameSaved }), |
1255 |
|
MessageManager.getString("label.error_saving_file"), |
1256 |
|
JvOptionPane.WARNING_MESSAGE); |
1257 |
|
} |
1258 |
|
else |
1259 |
|
{ |
1260 |
0 |
Console.error(MessageManager |
1261 |
|
.formatMessage("label.couldnt_save_file", new Object[] |
1262 |
|
{ lastFilenameSaved })); |
1263 |
|
} |
1264 |
|
} |
1265 |
|
else |
1266 |
|
{ |
1267 |
|
|
1268 |
88 |
setStatus(MessageManager.formatMessage( |
1269 |
|
"label.successfully_saved_to_file_in_format", new Object[] |
1270 |
|
{ lastFilenameSaved, lastFormatSaved })); |
1271 |
|
|
1272 |
|
} |
1273 |
88 |
return lastSaveSuccessful; |
1274 |
|
} |
1275 |
|
|
1276 |
|
|
1277 |
|
|
1278 |
|
|
1279 |
|
|
1280 |
|
|
1281 |
|
|
1282 |
|
|
1283 |
|
@param |
1284 |
|
@param |
1285 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1286 |
54 |
public void saveAlignment(String file, FileFormatI format)... |
1287 |
|
{ |
1288 |
54 |
saveAlignment(file, format, false, false); |
1289 |
|
} |
1290 |
|
|
|
|
| 79.6% |
Uncovered Elements: 21 (103) |
Complexity: 21 |
Complexity Density: 0.3 |
|
1291 |
128 |
public void saveAlignment(String file, FileFormatI format, boolean stdout,... |
1292 |
|
boolean forceBackup) |
1293 |
|
{ |
1294 |
128 |
lastSaveSuccessful = true; |
1295 |
128 |
if (!stdout) |
1296 |
|
{ |
1297 |
116 |
lastFilenameSaved = file; |
1298 |
|
} |
1299 |
128 |
lastFormatSaved = format; |
1300 |
|
|
1301 |
128 |
if (FileFormat.Jalview.equals(format)) |
1302 |
|
{ |
1303 |
8 |
String shortName = title; |
1304 |
8 |
if (shortName.indexOf(File.separatorChar) > -1) |
1305 |
|
{ |
1306 |
5 |
shortName = shortName |
1307 |
|
.substring(shortName.lastIndexOf(File.separatorChar) + 1); |
1308 |
|
} |
1309 |
|
|
1310 |
8 |
lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file, |
1311 |
|
shortName); |
1312 |
|
|
1313 |
8 |
Console.debug("lastSaveSuccessful=" + lastSaveSuccessful); |
1314 |
8 |
if (lastSaveSuccessful) |
1315 |
|
{ |
1316 |
8 |
this.getViewport().setSavedUpToDate(true); |
1317 |
|
} |
1318 |
|
|
1319 |
8 |
statusBar.setText(MessageManager.formatMessage( |
1320 |
|
"label.successfully_saved_to_file_in_format", new Object[] |
1321 |
|
{ file, format })); |
1322 |
|
|
1323 |
8 |
return; |
1324 |
|
} |
1325 |
|
|
1326 |
120 |
AlignExportSettingsI options = new AlignExportSettingsAdapter(false); |
1327 |
120 |
Runnable cancelAction = () -> { |
1328 |
0 |
lastSaveSuccessful = false; |
1329 |
|
}; |
1330 |
120 |
Runnable outputAction = () -> { |
1331 |
|
|
1332 |
120 |
AlignmentExportData exportData = viewport.getAlignExportData(options); |
1333 |
120 |
String output = new FormatAdapter(alignPanel, options) |
1334 |
|
.formatSequences(format, exportData.getAlignment(), |
1335 |
|
exportData.getOmitHidden(), |
1336 |
|
exportData.getStartEndPostions(), |
1337 |
|
viewport.getAlignment().getHiddenColumns()); |
1338 |
120 |
if (output == null) |
1339 |
|
{ |
1340 |
0 |
lastSaveSuccessful = false; |
1341 |
|
} |
1342 |
|
else |
1343 |
|
{ |
1344 |
|
|
1345 |
120 |
boolean doBackup = forceBackup |
1346 |
|
|| (BackupFiles.getEnabled() && !stdout); |
1347 |
120 |
BackupFiles backupfiles = null; |
1348 |
120 |
if (doBackup) |
1349 |
|
{ |
1350 |
92 |
Console.trace("ALIGNFRAME making backupfiles object for " + file); |
1351 |
92 |
backupfiles = new BackupFiles(file); |
1352 |
|
} |
1353 |
120 |
try |
1354 |
|
{ |
1355 |
120 |
String tempFilePath = doBackup ? backupfiles.getTempFilePath() |
1356 |
|
: file; |
1357 |
120 |
Console.trace("ALIGNFRAME setting PrintWriter"); |
1358 |
120 |
PrintWriter out = stdout |
1359 |
|
? new PrintWriter(new OutputStreamWriter(System.out)) |
1360 |
|
: new PrintWriter(new FileWriter(tempFilePath)); |
1361 |
|
|
1362 |
120 |
if (backupfiles != null) |
1363 |
|
{ |
1364 |
92 |
Console.trace("ALIGNFRAME about to write to temp file " |
1365 |
|
+ backupfiles.getTempFilePath()); |
1366 |
|
} |
1367 |
|
|
1368 |
120 |
out.print(output); |
1369 |
120 |
out.flush(); |
1370 |
120 |
if (!stdout) |
1371 |
|
{ |
1372 |
108 |
Console.trace("ALIGNFRAME about to close file"); |
1373 |
108 |
out.close(); |
1374 |
108 |
Console.trace("ALIGNFRAME closed file"); |
1375 |
|
} |
1376 |
120 |
AlignFrame.this.setTitle(stdout ? "STDOUT" : file); |
1377 |
120 |
if (stdout) |
1378 |
|
{ |
1379 |
12 |
statusBar.setText(MessageManager.formatMessage( |
1380 |
|
"label.successfully_printed_to_stdout_in_format", |
1381 |
|
new Object[] |
1382 |
|
{ format.getName() })); |
1383 |
|
} |
1384 |
|
else |
1385 |
|
{ |
1386 |
108 |
statusBar.setText(MessageManager.formatMessage( |
1387 |
|
"label.successfully_saved_to_file_in_format", |
1388 |
|
new Object[] |
1389 |
|
{ fileName, format.getName() })); |
1390 |
|
} |
1391 |
120 |
lastSaveSuccessful = true; |
1392 |
|
} catch (IOException e) |
1393 |
|
{ |
1394 |
0 |
lastSaveSuccessful = false; |
1395 |
0 |
Console.error( |
1396 |
|
"ALIGNFRAME Something happened writing the temp file"); |
1397 |
0 |
Console.error(e.getMessage()); |
1398 |
0 |
Console.debug(Cache.getStackTraceString(e)); |
1399 |
|
} catch (Exception ex) |
1400 |
|
{ |
1401 |
0 |
lastSaveSuccessful = false; |
1402 |
0 |
Console.error( |
1403 |
|
"ALIGNFRAME Something unexpected happened writing the temp file"); |
1404 |
0 |
Console.error(ex.getMessage()); |
1405 |
0 |
Console.debug(Cache.getStackTraceString(ex)); |
1406 |
|
} |
1407 |
|
|
1408 |
120 |
if (doBackup) |
1409 |
|
{ |
1410 |
92 |
backupfiles.setWriteSuccess(lastSaveSuccessful); |
1411 |
92 |
Console.debug("ALIGNFRAME writing temp file was " |
1412 |
92 |
+ (lastSaveSuccessful ? "" : "NOT ") + "successful"); |
1413 |
|
|
1414 |
92 |
Console.trace("ALIGNFRAME about to rollBackupsAndRenameTempFile"); |
1415 |
92 |
lastSaveSuccessful = backupfiles.rollBackupsAndRenameTempFile(); |
1416 |
92 |
Console.debug("ALIGNFRAME performed rollBackupsAndRenameTempFile " |
1417 |
92 |
+ (lastSaveSuccessful ? "" : "un") + "successfully"); |
1418 |
|
} |
1419 |
|
|
1420 |
120 |
Console.debug("lastSaveSuccessful=" + lastSaveSuccessful); |
1421 |
120 |
if (lastSaveSuccessful) |
1422 |
|
{ |
1423 |
120 |
AlignFrame.this.getViewport().setSavedUpToDate(true); |
1424 |
|
} |
1425 |
|
} |
1426 |
|
}; |
1427 |
|
|
1428 |
|
|
1429 |
|
|
1430 |
|
|
1431 |
120 |
if (AlignExportOptions.isNeeded(viewport, format)) |
1432 |
|
{ |
1433 |
0 |
AlignExportOptions choices = new AlignExportOptions( |
1434 |
|
alignPanel.getAlignViewport(), format, options); |
1435 |
0 |
choices.setResponseAction(0, outputAction); |
1436 |
0 |
choices.setResponseAction(1, cancelAction); |
1437 |
0 |
choices.showDialog(); |
1438 |
|
} |
1439 |
|
else |
1440 |
|
{ |
1441 |
120 |
try |
1442 |
|
{ |
1443 |
120 |
outputAction.run(); |
1444 |
|
} catch (Exception e) |
1445 |
|
{ |
1446 |
|
|
1447 |
0 |
e.printStackTrace(); |
1448 |
|
} |
1449 |
|
} |
1450 |
|
} |
1451 |
|
|
1452 |
|
|
1453 |
|
|
1454 |
|
|
1455 |
|
|
1456 |
|
|
1457 |
|
@param |
1458 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 4 |
Complexity Density: 0.21 |
|
1459 |
0 |
@Override... |
1460 |
|
protected void outputText_actionPerformed(String fileFormatName) |
1461 |
|
{ |
1462 |
0 |
FileFormatI fileFormat = FileFormats.getInstance() |
1463 |
|
.forName(fileFormatName); |
1464 |
0 |
AlignExportSettingsI options = new AlignExportSettingsAdapter(false); |
1465 |
0 |
Runnable outputAction = () -> { |
1466 |
|
|
1467 |
0 |
AlignmentExportData exportData = viewport.getAlignExportData(options); |
1468 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
1469 |
0 |
cap.setForInput(null); |
1470 |
0 |
try |
1471 |
|
{ |
1472 |
0 |
FileFormatI format = fileFormat; |
1473 |
0 |
cap.setText(new FormatAdapter(alignPanel, options).formatSequences( |
1474 |
|
format, exportData.getAlignment(), |
1475 |
|
exportData.getOmitHidden(), |
1476 |
|
exportData.getStartEndPostions(), |
1477 |
|
viewport.getAlignment().getHiddenColumns())); |
1478 |
0 |
Desktop.addInternalFrame(cap, MessageManager.formatMessage( |
1479 |
|
"label.alignment_output_command", new Object[] |
1480 |
|
{ fileFormat.getName() }), 600, 500); |
1481 |
|
} catch (OutOfMemoryError oom) |
1482 |
|
{ |
1483 |
0 |
new OOMWarning("Outputting alignment as " + fileFormat.getName(), |
1484 |
|
oom); |
1485 |
0 |
cap.dispose(); |
1486 |
|
} |
1487 |
|
}; |
1488 |
|
|
1489 |
|
|
1490 |
|
|
1491 |
|
|
1492 |
0 |
if (AlignExportOptions.isNeeded(viewport, fileFormat)) |
1493 |
|
{ |
1494 |
0 |
AlignExportOptions choices = new AlignExportOptions( |
1495 |
|
alignPanel.getAlignViewport(), fileFormat, options); |
1496 |
0 |
choices.setResponseAction(0, outputAction); |
1497 |
0 |
choices.showDialog(); |
1498 |
|
} |
1499 |
|
else |
1500 |
|
{ |
1501 |
0 |
try |
1502 |
|
{ |
1503 |
0 |
outputAction.run(); |
1504 |
|
} catch (Exception e) |
1505 |
|
{ |
1506 |
0 |
e.printStackTrace(); |
1507 |
|
} |
1508 |
|
} |
1509 |
|
} |
1510 |
|
|
1511 |
|
|
1512 |
|
|
1513 |
|
|
1514 |
|
@param |
1515 |
|
|
1516 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1517 |
0 |
@Override... |
1518 |
|
protected void htmlMenuItem_actionPerformed(ActionEvent e) |
1519 |
|
{ |
1520 |
0 |
HtmlSvgOutput htmlSVG = new HtmlSvgOutput(alignPanel); |
1521 |
0 |
try |
1522 |
|
{ |
1523 |
0 |
htmlSVG.exportHTML(null); |
1524 |
|
} catch (ImageOutputException x) |
1525 |
|
{ |
1526 |
|
|
1527 |
|
} |
1528 |
|
} |
1529 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1530 |
0 |
@Override... |
1531 |
|
public void bioJSMenuItem_actionPerformed(ActionEvent e) |
1532 |
|
{ |
1533 |
0 |
BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel); |
1534 |
0 |
try |
1535 |
|
{ |
1536 |
0 |
bjs.exportHTML(null); |
1537 |
|
} catch (ImageOutputException x) |
1538 |
|
{ |
1539 |
|
|
1540 |
|
} |
1541 |
|
} |
1542 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
1543 |
0 |
public void createImageMap(File file, String image)... |
1544 |
|
{ |
1545 |
0 |
try |
1546 |
|
{ |
1547 |
0 |
alignPanel.makePNGImageMap(file, image); |
1548 |
|
} catch (ImageOutputException x) |
1549 |
|
{ |
1550 |
|
|
1551 |
|
} |
1552 |
|
} |
1553 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
1554 |
0 |
@Override... |
1555 |
|
public void createPNG_actionPerformed(ActionEvent e) |
1556 |
|
{ |
1557 |
0 |
try |
1558 |
|
{ |
1559 |
0 |
createPNG(null); |
1560 |
|
} catch (ImageOutputException ioex) |
1561 |
|
{ |
1562 |
|
|
1563 |
|
} |
1564 |
|
} |
1565 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
1566 |
0 |
@Override... |
1567 |
|
public void createEPS_actionPerformed(ActionEvent e) |
1568 |
|
{ |
1569 |
0 |
try |
1570 |
|
{ |
1571 |
0 |
createEPS(null); |
1572 |
|
} catch (ImageOutputException ioex) |
1573 |
|
{ |
1574 |
|
|
1575 |
|
} |
1576 |
|
|
1577 |
|
} |
1578 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 2 |
Complexity Density: 1 |
|
1579 |
0 |
@Override... |
1580 |
|
public void createSVG_actionPerformed(ActionEvent e) |
1581 |
|
{ |
1582 |
0 |
try |
1583 |
|
{ |
1584 |
0 |
createSVG(null); |
1585 |
|
} catch (ImageOutputException ioex) |
1586 |
|
{ |
1587 |
|
|
1588 |
|
} |
1589 |
|
|
1590 |
|
} |
1591 |
|
|
1592 |
|
|
1593 |
|
|
1594 |
|
|
1595 |
|
|
1596 |
|
@param |
1597 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1598 |
1 |
public void createPNG(File f) throws ImageOutputException... |
1599 |
|
{ |
1600 |
1 |
createPNG(f, null, BitmapImageSizing.defaultBitmapImageSizing()); |
1601 |
|
} |
1602 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1603 |
24 |
public void createPNG(File f, String renderer, BitmapImageSizing userBis)... |
1604 |
|
throws ImageOutputException |
1605 |
|
{ |
1606 |
24 |
alignPanel.makeAlignmentImage(TYPE.PNG, f, renderer, userBis); |
1607 |
|
} |
1608 |
|
|
1609 |
|
|
1610 |
|
|
1611 |
|
|
1612 |
|
|
1613 |
|
@param |
1614 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1615 |
5 |
public void createEPS(File f) throws ImageOutputException... |
1616 |
|
{ |
1617 |
5 |
createEPS(f, null); |
1618 |
|
} |
1619 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1620 |
10 |
public void createEPS(File f, String renderer) throws ImageOutputException... |
1621 |
|
{ |
1622 |
10 |
alignPanel.makeAlignmentImage(TYPE.EPS, f, renderer); |
1623 |
|
} |
1624 |
|
|
1625 |
|
|
1626 |
|
|
1627 |
|
|
1628 |
|
|
1629 |
|
@param |
1630 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1631 |
1 |
public void createSVG(File f) throws ImageOutputException... |
1632 |
|
{ |
1633 |
1 |
createSVG(f, null); |
1634 |
|
} |
1635 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1636 |
2 |
public void createSVG(File f, String renderer) throws ImageOutputException... |
1637 |
|
{ |
1638 |
2 |
alignPanel.makeAlignmentImage(TYPE.SVG, f, renderer); |
1639 |
|
} |
1640 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1641 |
0 |
@Override... |
1642 |
|
public void pageSetup_actionPerformed(ActionEvent e) |
1643 |
|
{ |
1644 |
0 |
PrinterJob printJob = PrinterJob.getPrinterJob(); |
1645 |
0 |
PrintThread.pf = printJob.pageDialog(printJob.defaultPage()); |
1646 |
|
} |
1647 |
|
|
1648 |
|
|
1649 |
|
|
1650 |
|
|
1651 |
|
@param |
1652 |
|
|
1653 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1654 |
0 |
@Override... |
1655 |
|
public void printMenuItem_actionPerformed(ActionEvent e) |
1656 |
|
{ |
1657 |
|
|
1658 |
0 |
PrintThread thread = new PrintThread(alignPanel); |
1659 |
0 |
thread.start(); |
1660 |
|
} |
1661 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1662 |
0 |
@Override... |
1663 |
|
public void exportFeatures_actionPerformed(ActionEvent e) |
1664 |
|
{ |
1665 |
0 |
new AnnotationExporter(alignPanel).exportFeatures(); |
1666 |
|
} |
1667 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1668 |
0 |
@Override... |
1669 |
|
public void exportAnnotations_actionPerformed(ActionEvent e) |
1670 |
|
{ |
1671 |
0 |
new AnnotationExporter(alignPanel).exportAnnotations(); |
1672 |
|
} |
1673 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
1674 |
0 |
@Override... |
1675 |
|
public void associatedData_actionPerformed(ActionEvent e) |
1676 |
|
{ |
1677 |
0 |
final JalviewFileChooser chooser = new JalviewFileChooser( |
1678 |
|
Cache.getProperty("LAST_DIRECTORY")); |
1679 |
0 |
chooser.setFileView(new JalviewFileView()); |
1680 |
0 |
String tooltip = MessageManager |
1681 |
|
.getString("label.load_jalview_annotations"); |
1682 |
0 |
chooser.setDialogTitle(tooltip); |
1683 |
0 |
chooser.setToolTipText(tooltip); |
1684 |
0 |
chooser.setResponseHandler(0, () -> { |
1685 |
0 |
String choice = chooser.getSelectedFile().getPath(); |
1686 |
0 |
Cache.setProperty("LAST_DIRECTORY", choice); |
1687 |
0 |
loadJalviewDataFile(chooser.getSelectedFile(), null, null, null); |
1688 |
|
}); |
1689 |
|
|
1690 |
0 |
chooser.showOpenDialog(this); |
1691 |
|
} |
1692 |
|
|
1693 |
|
|
1694 |
|
|
1695 |
|
|
1696 |
|
|
1697 |
|
@param |
1698 |
|
|
|
|
| 83.9% |
Uncovered Elements: 5 (31) |
Complexity: 11 |
Complexity Density: 0.65 |
|
1699 |
386 |
@Override... |
1700 |
|
public void closeMenuItem_actionPerformed(boolean closeAllTabs) |
1701 |
|
{ |
1702 |
386 |
if (alignPanels != null && alignPanels.size() < 2) |
1703 |
|
{ |
1704 |
366 |
closeAllTabs = true; |
1705 |
|
} |
1706 |
|
|
1707 |
386 |
Desktop.closeModal(this); |
1708 |
|
|
1709 |
386 |
try |
1710 |
|
{ |
1711 |
386 |
if (alignPanels != null) |
1712 |
|
{ |
1713 |
386 |
if (closeAllTabs) |
1714 |
|
{ |
1715 |
385 |
if (this.isClosed()) |
1716 |
|
{ |
1717 |
|
|
1718 |
|
|
1719 |
512 |
for (int i = 0; i < alignPanels.size(); i++) |
1720 |
|
{ |
1721 |
252 |
AlignmentPanel ap = alignPanels.get(i); |
1722 |
252 |
ap.closePanel(); |
1723 |
|
} |
1724 |
|
} |
1725 |
|
} |
1726 |
|
else |
1727 |
|
{ |
1728 |
1 |
closeView(alignPanel); |
1729 |
|
} |
1730 |
|
} |
1731 |
386 |
if (closeAllTabs) |
1732 |
|
{ |
1733 |
385 |
if (featureSettings != null && featureSettings.isOpen()) |
1734 |
|
{ |
1735 |
0 |
featureSettings.close(); |
1736 |
0 |
featureSettings = null; |
1737 |
|
} |
1738 |
|
|
1739 |
|
|
1740 |
|
|
1741 |
|
|
1742 |
|
|
1743 |
385 |
this.setClosed(true); |
1744 |
|
} |
1745 |
|
} catch (Exception ex) |
1746 |
|
{ |
1747 |
0 |
ex.printStackTrace(); |
1748 |
|
} |
1749 |
|
} |
1750 |
|
|
1751 |
|
|
1752 |
|
|
1753 |
|
|
1754 |
|
@param |
1755 |
|
|
|
|
| 91.7% |
Uncovered Elements: 1 (12) |
Complexity: 3 |
Complexity Density: 0.3 |
|
1756 |
1 |
public void closeView(AlignmentPanel panelToClose)... |
1757 |
|
{ |
1758 |
1 |
int index = tabbedPane.getSelectedIndex(); |
1759 |
1 |
int closedindex = tabbedPane.indexOfComponent(panelToClose); |
1760 |
1 |
alignPanels.remove(panelToClose); |
1761 |
1 |
panelToClose.closePanel(); |
1762 |
1 |
panelToClose = null; |
1763 |
|
|
1764 |
1 |
tabbedPane.removeTabAt(closedindex); |
1765 |
1 |
tabbedPane.validate(); |
1766 |
|
|
1767 |
1 |
if (index > closedindex || index == tabbedPane.getTabCount()) |
1768 |
|
{ |
1769 |
|
|
1770 |
1 |
index--; |
1771 |
|
} |
1772 |
|
|
1773 |
1 |
this.tabSelectionChanged(index); |
1774 |
|
} |
1775 |
|
|
1776 |
|
|
1777 |
|
|
1778 |
|
|
|
|
| 75% |
Uncovered Elements: 4 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
1779 |
1222 |
void updateEditMenuBar()... |
1780 |
|
{ |
1781 |
|
|
1782 |
1222 |
if (viewport.getHistoryList().size() > 0) |
1783 |
|
{ |
1784 |
2 |
undoMenuItem.setEnabled(true); |
1785 |
2 |
CommandI command = viewport.getHistoryList().peek(); |
1786 |
2 |
undoMenuItem.setText(MessageManager |
1787 |
|
.formatMessage("label.undo_command", new Object[] |
1788 |
|
{ command.getDescription() })); |
1789 |
|
} |
1790 |
|
else |
1791 |
|
{ |
1792 |
1220 |
undoMenuItem.setEnabled(false); |
1793 |
1220 |
undoMenuItem.setText(MessageManager.getString("action.undo")); |
1794 |
|
} |
1795 |
|
|
1796 |
1222 |
if (viewport.getRedoList().size() > 0) |
1797 |
|
{ |
1798 |
0 |
redoMenuItem.setEnabled(true); |
1799 |
|
|
1800 |
0 |
CommandI command = viewport.getRedoList().peek(); |
1801 |
0 |
redoMenuItem.setText(MessageManager |
1802 |
|
.formatMessage("label.redo_command", new Object[] |
1803 |
|
{ command.getDescription() })); |
1804 |
|
} |
1805 |
|
else |
1806 |
|
{ |
1807 |
1222 |
redoMenuItem.setEnabled(false); |
1808 |
1222 |
redoMenuItem.setText(MessageManager.getString("action.redo")); |
1809 |
|
} |
1810 |
|
} |
1811 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
1812 |
1 |
@Override... |
1813 |
|
public void addHistoryItem(CommandI command) |
1814 |
|
{ |
1815 |
1 |
if (command.getSize() > 0) |
1816 |
|
{ |
1817 |
1 |
viewport.addToHistoryList(command); |
1818 |
1 |
viewport.clearRedoList(); |
1819 |
1 |
updateEditMenuBar(); |
1820 |
1 |
viewport.updateHiddenColumns(); |
1821 |
|
|
1822 |
|
|
1823 |
|
|
1824 |
|
|
1825 |
|
} |
1826 |
|
} |
1827 |
|
|
1828 |
|
|
1829 |
|
|
1830 |
|
@return |
1831 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
1832 |
0 |
public AlignmentI[] getViewAlignments()... |
1833 |
|
{ |
1834 |
0 |
if (alignPanels != null) |
1835 |
|
{ |
1836 |
0 |
AlignmentI[] als = new AlignmentI[alignPanels.size()]; |
1837 |
0 |
int i = 0; |
1838 |
0 |
for (AlignmentPanel ap : alignPanels) |
1839 |
|
{ |
1840 |
0 |
als[i++] = ap.av.getAlignment(); |
1841 |
|
} |
1842 |
0 |
return als; |
1843 |
|
} |
1844 |
0 |
if (viewport != null) |
1845 |
|
{ |
1846 |
0 |
return new AlignmentI[] { viewport.getAlignment() }; |
1847 |
|
} |
1848 |
0 |
return null; |
1849 |
|
} |
1850 |
|
|
1851 |
|
|
1852 |
|
|
1853 |
|
|
1854 |
|
@param |
1855 |
|
|
1856 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
1857 |
0 |
@Override... |
1858 |
|
protected void undoMenuItem_actionPerformed(ActionEvent e) |
1859 |
|
{ |
1860 |
0 |
if (viewport.getHistoryList().isEmpty()) |
1861 |
|
{ |
1862 |
0 |
return; |
1863 |
|
} |
1864 |
0 |
CommandI command = viewport.getHistoryList().pop(); |
1865 |
0 |
viewport.addToRedoList(command); |
1866 |
0 |
command.undoCommand(getViewAlignments()); |
1867 |
|
|
1868 |
0 |
AlignmentViewport originalSource = getOriginatingSource(command); |
1869 |
0 |
updateEditMenuBar(); |
1870 |
|
|
1871 |
0 |
if (originalSource != null) |
1872 |
|
{ |
1873 |
0 |
if (originalSource != viewport) |
1874 |
|
{ |
1875 |
0 |
Console.warn( |
1876 |
|
"Implementation worry: mismatch of viewport origin for undo"); |
1877 |
|
} |
1878 |
0 |
originalSource.updateHiddenColumns(); |
1879 |
|
|
1880 |
|
|
1881 |
|
|
1882 |
|
|
1883 |
|
|
1884 |
0 |
originalSource.firePropertyChange("alignment", null, |
1885 |
|
originalSource.getAlignment().getSequences()); |
1886 |
|
} |
1887 |
|
} |
1888 |
|
|
1889 |
|
|
1890 |
|
|
1891 |
|
|
1892 |
|
@param |
1893 |
|
|
1894 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
1895 |
0 |
@Override... |
1896 |
|
protected void redoMenuItem_actionPerformed(ActionEvent e) |
1897 |
|
{ |
1898 |
0 |
if (viewport.getRedoList().size() < 1) |
1899 |
|
{ |
1900 |
0 |
return; |
1901 |
|
} |
1902 |
|
|
1903 |
0 |
CommandI command = viewport.getRedoList().pop(); |
1904 |
0 |
viewport.addToHistoryList(command); |
1905 |
0 |
command.doCommand(getViewAlignments()); |
1906 |
|
|
1907 |
0 |
AlignmentViewport originalSource = getOriginatingSource(command); |
1908 |
0 |
updateEditMenuBar(); |
1909 |
|
|
1910 |
0 |
if (originalSource != null) |
1911 |
|
{ |
1912 |
|
|
1913 |
0 |
if (originalSource != viewport) |
1914 |
|
{ |
1915 |
0 |
Console.warn( |
1916 |
|
"Implementation worry: mismatch of viewport origin for redo"); |
1917 |
|
} |
1918 |
0 |
originalSource.updateHiddenColumns(); |
1919 |
|
|
1920 |
|
|
1921 |
|
|
1922 |
|
|
1923 |
|
|
1924 |
0 |
originalSource.firePropertyChange("alignment", null, |
1925 |
|
originalSource.getAlignment().getSequences()); |
1926 |
|
} |
1927 |
|
} |
1928 |
|
|
|
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 6 |
Complexity Density: 0.38 |
|
1929 |
0 |
AlignmentViewport getOriginatingSource(CommandI command)... |
1930 |
|
{ |
1931 |
0 |
AlignmentViewport originalSource = null; |
1932 |
|
|
1933 |
|
|
1934 |
|
|
1935 |
0 |
AlignmentI al = null; |
1936 |
0 |
if (command instanceof EditCommand) |
1937 |
|
{ |
1938 |
0 |
EditCommand editCommand = (EditCommand) command; |
1939 |
0 |
al = editCommand.getAlignment(); |
1940 |
0 |
List<Component> comps = PaintRefresher.components |
1941 |
|
.get(viewport.getSequenceSetId()); |
1942 |
|
|
1943 |
0 |
for (Component comp : comps) |
1944 |
|
{ |
1945 |
0 |
if (comp instanceof AlignmentPanel) |
1946 |
|
{ |
1947 |
0 |
if (al == ((AlignmentPanel) comp).av.getAlignment()) |
1948 |
|
{ |
1949 |
0 |
originalSource = ((AlignmentPanel) comp).av; |
1950 |
0 |
break; |
1951 |
|
} |
1952 |
|
} |
1953 |
|
} |
1954 |
|
} |
1955 |
|
|
1956 |
0 |
if (originalSource == null) |
1957 |
|
{ |
1958 |
|
|
1959 |
|
|
1960 |
0 |
if (al != null) |
1961 |
|
{ |
1962 |
0 |
PaintRefresher.validateSequences(al, viewport.getAlignment()); |
1963 |
|
} |
1964 |
|
|
1965 |
0 |
originalSource = viewport; |
1966 |
|
} |
1967 |
|
|
1968 |
0 |
return originalSource; |
1969 |
|
} |
1970 |
|
|
1971 |
|
|
1972 |
|
|
1973 |
|
|
1974 |
|
|
1975 |
|
@param |
1976 |
|
|
1977 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 4 |
Complexity Density: 0.4 |
|
1978 |
0 |
public void moveSelectedSequences(boolean up)... |
1979 |
|
{ |
1980 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
1981 |
|
|
1982 |
0 |
if (sg == null) |
1983 |
|
{ |
1984 |
0 |
if (viewport.cursorMode) |
1985 |
|
{ |
1986 |
0 |
sg = new SequenceGroup(); |
1987 |
0 |
sg.addSequence(viewport.getAlignment().getSequenceAt( |
1988 |
|
alignPanel.getSeqPanel().seqCanvas.cursorY), false); |
1989 |
|
} |
1990 |
|
else |
1991 |
|
{ |
1992 |
0 |
return; |
1993 |
|
} |
1994 |
|
} |
1995 |
|
|
1996 |
0 |
if (sg.getSize() < 1) |
1997 |
|
{ |
1998 |
0 |
return; |
1999 |
|
} |
2000 |
|
|
2001 |
|
|
2002 |
|
|
2003 |
0 |
viewport.getAlignment().moveSelectedSequencesByOne(sg, |
2004 |
|
viewport.getHiddenRepSequences(), up); |
2005 |
0 |
alignPanel.paintAlignment(true, false); |
2006 |
|
} |
2007 |
|
|
|
|
| 0% |
Uncovered Elements: 65 (65) |
Complexity: 20 |
Complexity Density: 0.51 |
|
2008 |
0 |
synchronized void slideSequences(boolean right, int size)... |
2009 |
|
{ |
2010 |
0 |
List<SequenceI> sg = new ArrayList<>(); |
2011 |
0 |
if (viewport.cursorMode) |
2012 |
|
{ |
2013 |
0 |
sg.add(viewport.getAlignment() |
2014 |
|
.getSequenceAt(alignPanel.getSeqPanel().seqCanvas.cursorY)); |
2015 |
|
} |
2016 |
0 |
else if (viewport.getSelectionGroup() != null |
2017 |
|
&& viewport.getSelectionGroup().getSize() != viewport |
2018 |
|
.getAlignment().getHeight()) |
2019 |
|
{ |
2020 |
0 |
sg = viewport.getSelectionGroup() |
2021 |
|
.getSequences(viewport.getHiddenRepSequences()); |
2022 |
|
} |
2023 |
|
|
2024 |
0 |
if (sg.size() < 1) |
2025 |
|
{ |
2026 |
0 |
return; |
2027 |
|
} |
2028 |
|
|
2029 |
0 |
List<SequenceI> invertGroup = new ArrayList<>(); |
2030 |
|
|
2031 |
0 |
for (SequenceI seq : viewport.getAlignment().getSequences()) |
2032 |
|
{ |
2033 |
0 |
if (!sg.contains(seq)) |
2034 |
|
{ |
2035 |
0 |
invertGroup.add(seq); |
2036 |
|
} |
2037 |
|
} |
2038 |
|
|
2039 |
0 |
SequenceI[] seqs1 = sg.toArray(new SequenceI[0]); |
2040 |
|
|
2041 |
0 |
SequenceI[] seqs2 = new SequenceI[invertGroup.size()]; |
2042 |
0 |
for (int i = 0; i < invertGroup.size(); i++) |
2043 |
|
{ |
2044 |
0 |
seqs2[i] = invertGroup.get(i); |
2045 |
|
} |
2046 |
|
|
2047 |
0 |
SlideSequencesCommand ssc; |
2048 |
0 |
if (right) |
2049 |
|
{ |
2050 |
0 |
ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1, size, |
2051 |
|
viewport.getGapCharacter()); |
2052 |
|
} |
2053 |
|
else |
2054 |
|
{ |
2055 |
0 |
ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2, size, |
2056 |
|
viewport.getGapCharacter()); |
2057 |
|
} |
2058 |
|
|
2059 |
0 |
int groupAdjustment = 0; |
2060 |
0 |
if (ssc.getGapsInsertedBegin() && right) |
2061 |
|
{ |
2062 |
0 |
if (viewport.cursorMode) |
2063 |
|
{ |
2064 |
0 |
alignPanel.getSeqPanel().moveCursor(size, 0); |
2065 |
|
} |
2066 |
|
else |
2067 |
|
{ |
2068 |
0 |
groupAdjustment = size; |
2069 |
|
} |
2070 |
|
} |
2071 |
0 |
else if (!ssc.getGapsInsertedBegin() && !right) |
2072 |
|
{ |
2073 |
0 |
if (viewport.cursorMode) |
2074 |
|
{ |
2075 |
0 |
alignPanel.getSeqPanel().moveCursor(-size, 0); |
2076 |
|
} |
2077 |
|
else |
2078 |
|
{ |
2079 |
0 |
groupAdjustment = -size; |
2080 |
|
} |
2081 |
|
} |
2082 |
|
|
2083 |
0 |
if (groupAdjustment != 0) |
2084 |
|
{ |
2085 |
0 |
viewport.getSelectionGroup().setStartRes( |
2086 |
|
viewport.getSelectionGroup().getStartRes() + groupAdjustment); |
2087 |
0 |
viewport.getSelectionGroup().setEndRes( |
2088 |
|
viewport.getSelectionGroup().getEndRes() + groupAdjustment); |
2089 |
|
} |
2090 |
|
|
2091 |
|
|
2092 |
|
|
2093 |
|
|
2094 |
|
|
2095 |
0 |
boolean appendHistoryItem = false; |
2096 |
0 |
Deque<CommandI> historyList = viewport.getHistoryList(); |
2097 |
0 |
boolean inSplitFrame = getSplitViewContainer() != null; |
2098 |
0 |
if (!inSplitFrame && historyList != null && historyList.size() > 0 |
2099 |
|
&& historyList.peek() instanceof SlideSequencesCommand) |
2100 |
|
{ |
2101 |
0 |
appendHistoryItem = ssc.appendSlideCommand( |
2102 |
|
(SlideSequencesCommand) historyList.peek()); |
2103 |
|
} |
2104 |
|
|
2105 |
0 |
if (!appendHistoryItem) |
2106 |
|
{ |
2107 |
0 |
addHistoryItem(ssc); |
2108 |
|
} |
2109 |
|
|
2110 |
0 |
repaint(); |
2111 |
|
} |
2112 |
|
|
2113 |
|
|
2114 |
|
|
2115 |
|
|
2116 |
|
@param |
2117 |
|
|
2118 |
|
|
|
|
| 63% |
Uncovered Elements: 10 (27) |
Complexity: 5 |
Complexity Density: 0.24 |
|
2119 |
1 |
@Override... |
2120 |
|
protected void copy_actionPerformed() |
2121 |
|
{ |
2122 |
1 |
if (viewport.getSelectionGroup() == null) |
2123 |
|
{ |
2124 |
0 |
return; |
2125 |
|
} |
2126 |
|
|
2127 |
|
|
2128 |
1 |
SequenceI[] seqs = viewport.getSelectionAsNewSequence(); |
2129 |
1 |
String[] omitHidden = null; |
2130 |
|
|
2131 |
1 |
if (viewport.hasHiddenColumns()) |
2132 |
|
{ |
2133 |
0 |
omitHidden = viewport.getViewAsString(true); |
2134 |
|
} |
2135 |
|
|
2136 |
1 |
String output = new FormatAdapter().formatSequences(FileFormat.Fasta, |
2137 |
|
seqs, omitHidden, null); |
2138 |
|
|
2139 |
1 |
StringSelection ss = new StringSelection(output); |
2140 |
|
|
2141 |
1 |
try |
2142 |
|
{ |
2143 |
1 |
jalview.gui.Desktop.internalCopy = true; |
2144 |
|
|
2145 |
|
|
2146 |
1 |
Toolkit.getDefaultToolkit().getSystemClipboard() |
2147 |
|
.setContents(new StringSelection(""), null); |
2148 |
|
|
2149 |
1 |
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, |
2150 |
|
Desktop.instance); |
2151 |
|
} catch (OutOfMemoryError er) |
2152 |
|
{ |
2153 |
0 |
new OOMWarning("copying region", er); |
2154 |
0 |
return; |
2155 |
|
} |
2156 |
|
|
2157 |
1 |
HiddenColumns hiddenColumns = null; |
2158 |
1 |
if (viewport.hasHiddenColumns()) |
2159 |
|
{ |
2160 |
0 |
int hiddenOffset = viewport.getSelectionGroup().getStartRes(); |
2161 |
0 |
int hiddenCutoff = viewport.getSelectionGroup().getEndRes(); |
2162 |
|
|
2163 |
|
|
2164 |
|
|
2165 |
0 |
hiddenColumns = new HiddenColumns( |
2166 |
|
viewport.getAlignment().getHiddenColumns(), hiddenOffset, |
2167 |
|
hiddenCutoff, hiddenOffset); |
2168 |
|
} |
2169 |
|
|
2170 |
1 |
Desktop.jalviewClipboard = new Object[] { seqs, |
2171 |
|
viewport.getAlignment().getDataset(), hiddenColumns }; |
2172 |
1 |
setStatus(MessageManager.formatMessage( |
2173 |
|
"label.copied_sequences_to_clipboard", new Object[] |
2174 |
|
{ Integer.valueOf(seqs.length).toString() })); |
2175 |
|
} |
2176 |
|
|
2177 |
|
|
2178 |
|
|
2179 |
|
|
2180 |
|
@param |
2181 |
|
|
2182 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2183 |
0 |
@Override... |
2184 |
|
protected void pasteNew_actionPerformed(ActionEvent e) |
2185 |
|
{ |
2186 |
0 |
paste(true); |
2187 |
|
} |
2188 |
|
|
2189 |
|
|
2190 |
|
|
2191 |
|
|
2192 |
|
@param |
2193 |
|
|
2194 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2195 |
0 |
@Override... |
2196 |
|
protected void pasteThis_actionPerformed(ActionEvent e) |
2197 |
|
{ |
2198 |
0 |
paste(false); |
2199 |
|
} |
2200 |
|
|
2201 |
|
|
2202 |
|
|
2203 |
|
|
2204 |
|
@param |
2205 |
|
|
2206 |
|
|
|
|
| 0% |
Uncovered Elements: 212 (212) |
Complexity: 48 |
Complexity Density: 0.36 |
|
2207 |
0 |
void paste(boolean newAlignment)... |
2208 |
|
{ |
2209 |
0 |
boolean externalPaste = true; |
2210 |
0 |
try |
2211 |
|
{ |
2212 |
0 |
Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); |
2213 |
0 |
Transferable contents = c.getContents(this); |
2214 |
|
|
2215 |
0 |
if (contents == null) |
2216 |
|
{ |
2217 |
0 |
return; |
2218 |
|
} |
2219 |
|
|
2220 |
0 |
String str; |
2221 |
0 |
FileFormatI format; |
2222 |
0 |
try |
2223 |
|
{ |
2224 |
0 |
str = (String) contents.getTransferData(DataFlavor.stringFlavor); |
2225 |
0 |
if (str.length() < 1) |
2226 |
|
{ |
2227 |
0 |
return; |
2228 |
|
} |
2229 |
|
|
2230 |
0 |
format = new IdentifyFile().identify(str, DataSourceType.PASTE); |
2231 |
|
|
2232 |
|
} catch (OutOfMemoryError er) |
2233 |
|
{ |
2234 |
0 |
new OOMWarning("Out of memory pasting sequences!!", er); |
2235 |
0 |
return; |
2236 |
|
} |
2237 |
|
|
2238 |
0 |
SequenceI[] sequences; |
2239 |
0 |
boolean annotationAdded = false; |
2240 |
0 |
AlignmentI alignment = null; |
2241 |
|
|
2242 |
0 |
if (Desktop.jalviewClipboard != null) |
2243 |
|
{ |
2244 |
|
|
2245 |
|
|
2246 |
|
|
2247 |
0 |
SequenceI[] newseq = (SequenceI[]) Desktop.jalviewClipboard[0]; |
2248 |
|
|
2249 |
0 |
sequences = new SequenceI[newseq.length]; |
2250 |
0 |
for (int i = 0; i < newseq.length; i++) |
2251 |
|
{ |
2252 |
0 |
sequences[i] = new Sequence(newseq[i]); |
2253 |
|
} |
2254 |
0 |
alignment = new Alignment(sequences); |
2255 |
0 |
externalPaste = false; |
2256 |
|
} |
2257 |
|
else |
2258 |
|
{ |
2259 |
|
|
2260 |
0 |
alignment = new FormatAdapter().readFile(str, DataSourceType.PASTE, |
2261 |
|
format); |
2262 |
0 |
sequences = alignment.getSequencesArray(); |
2263 |
|
} |
2264 |
|
|
2265 |
0 |
int alwidth = 0; |
2266 |
0 |
ArrayList<Integer> newGraphGroups = new ArrayList<>(); |
2267 |
0 |
int fgroup = -1; |
2268 |
|
|
2269 |
0 |
if (newAlignment) |
2270 |
|
{ |
2271 |
|
|
2272 |
0 |
if (Desktop.jalviewClipboard != null) |
2273 |
|
{ |
2274 |
|
|
2275 |
0 |
alignment.setDataset((Alignment) Desktop.jalviewClipboard[1]); |
2276 |
|
} |
2277 |
|
else |
2278 |
|
{ |
2279 |
|
|
2280 |
0 |
alignment.setDataset(null); |
2281 |
|
} |
2282 |
0 |
alwidth = alignment.getWidth() + 1; |
2283 |
|
} |
2284 |
|
else |
2285 |
|
{ |
2286 |
0 |
AlignmentI pastedal = alignment; |
2287 |
|
|
2288 |
0 |
alignment = viewport.getAlignment(); |
2289 |
0 |
alwidth = alignment.getWidth() + 1; |
2290 |
|
|
2291 |
0 |
boolean importDs = Desktop.jalviewClipboard != null |
2292 |
|
&& Desktop.jalviewClipboard[1] != alignment.getDataset(); |
2293 |
|
|
2294 |
|
|
2295 |
0 |
Vector<SequenceI> newDs = (importDs) ? new Vector<>() : null; |
2296 |
|
|
2297 |
|
|
2298 |
|
|
2299 |
0 |
for (int i = 0; i < sequences.length; i++) |
2300 |
|
{ |
2301 |
0 |
if (importDs) |
2302 |
|
{ |
2303 |
0 |
newDs.addElement(null); |
2304 |
|
} |
2305 |
0 |
SequenceI ds = sequences[i].getDatasetSequence(); |
2306 |
|
|
2307 |
0 |
if (importDs && ds != null) |
2308 |
|
{ |
2309 |
0 |
if (!newDs.contains(ds)) |
2310 |
|
{ |
2311 |
0 |
newDs.setElementAt(ds, i); |
2312 |
0 |
ds = new Sequence(ds); |
2313 |
|
|
2314 |
0 |
sequences[i].setDatasetSequence(ds); |
2315 |
|
} |
2316 |
|
else |
2317 |
|
{ |
2318 |
0 |
ds = sequences[newDs.indexOf(ds)].getDatasetSequence(); |
2319 |
|
} |
2320 |
|
} |
2321 |
|
else |
2322 |
|
{ |
2323 |
|
|
2324 |
0 |
sequences[i] = sequences[i].deriveSequence(); |
2325 |
0 |
alignment.getDataset() |
2326 |
|
.addSequence(sequences[i].getDatasetSequence()); |
2327 |
|
|
2328 |
|
|
2329 |
|
} |
2330 |
0 |
alignment.addSequence(sequences[i]); |
2331 |
|
} |
2332 |
0 |
if (newDs != null) |
2333 |
|
{ |
2334 |
0 |
newDs.clear(); |
2335 |
|
} |
2336 |
0 |
if (alignment.getAlignmentAnnotation() != null) |
2337 |
|
{ |
2338 |
0 |
for (AlignmentAnnotation alan : alignment |
2339 |
|
.getAlignmentAnnotation()) |
2340 |
|
{ |
2341 |
0 |
if (alan.graphGroup > fgroup) |
2342 |
|
{ |
2343 |
0 |
fgroup = alan.graphGroup; |
2344 |
|
} |
2345 |
|
} |
2346 |
|
} |
2347 |
0 |
if (pastedal.getAlignmentAnnotation() != null) |
2348 |
|
{ |
2349 |
|
|
2350 |
0 |
AlignmentAnnotation[] alann = pastedal.getAlignmentAnnotation(); |
2351 |
0 |
for (int i = 0; i < alann.length; i++) |
2352 |
|
{ |
2353 |
0 |
annotationAdded = true; |
2354 |
0 |
if (alann[i].sequenceRef == null && !alann[i].autoCalculated) |
2355 |
|
{ |
2356 |
0 |
AlignmentAnnotation newann = new AlignmentAnnotation( |
2357 |
|
alann[i]); |
2358 |
0 |
if (newann.graphGroup > -1) |
2359 |
|
{ |
2360 |
0 |
if (newGraphGroups.size() <= newann.graphGroup |
2361 |
|
|| newGraphGroups.get(newann.graphGroup) == null) |
2362 |
|
{ |
2363 |
0 |
for (int q = newGraphGroups |
2364 |
0 |
.size(); q <= newann.graphGroup; q++) |
2365 |
|
{ |
2366 |
0 |
newGraphGroups.add(q, null); |
2367 |
|
} |
2368 |
0 |
newGraphGroups.set(newann.graphGroup, |
2369 |
|
Integer.valueOf(++fgroup)); |
2370 |
|
} |
2371 |
0 |
newann.graphGroup = newGraphGroups.get(newann.graphGroup) |
2372 |
|
.intValue(); |
2373 |
|
} |
2374 |
|
|
2375 |
0 |
newann.padAnnotation(alwidth); |
2376 |
0 |
alignment.addAnnotation(newann); |
2377 |
|
} |
2378 |
|
} |
2379 |
|
} |
2380 |
|
} |
2381 |
0 |
if (!newAlignment) |
2382 |
|
{ |
2383 |
|
|
2384 |
|
|
2385 |
|
|
2386 |
0 |
addHistoryItem(new EditCommand( |
2387 |
|
MessageManager.getString("label.add_sequences"), |
2388 |
|
Action.PASTE, sequences, 0, alignment.getWidth(), |
2389 |
|
alignment)); |
2390 |
|
} |
2391 |
|
|
2392 |
0 |
for (int i = 0; i < sequences.length; i++) |
2393 |
|
{ |
2394 |
0 |
if (sequences[i].getAnnotation() != null) |
2395 |
|
{ |
2396 |
0 |
AlignmentAnnotation newann; |
2397 |
0 |
for (int a = 0; a < sequences[i].getAnnotation().length; a++) |
2398 |
|
{ |
2399 |
0 |
annotationAdded = true; |
2400 |
0 |
newann = sequences[i].getAnnotation()[a]; |
2401 |
0 |
newann.adjustForAlignment(); |
2402 |
0 |
newann.padAnnotation(alwidth); |
2403 |
0 |
if (newann.graphGroup > -1) |
2404 |
|
{ |
2405 |
0 |
if (newann.graphGroup > -1) |
2406 |
|
{ |
2407 |
0 |
if (newGraphGroups.size() <= newann.graphGroup |
2408 |
|
|| newGraphGroups.get(newann.graphGroup) == null) |
2409 |
|
{ |
2410 |
0 |
for (int q = newGraphGroups |
2411 |
0 |
.size(); q <= newann.graphGroup; q++) |
2412 |
|
{ |
2413 |
0 |
newGraphGroups.add(q, null); |
2414 |
|
} |
2415 |
0 |
newGraphGroups.set(newann.graphGroup, |
2416 |
|
Integer.valueOf(++fgroup)); |
2417 |
|
} |
2418 |
0 |
newann.graphGroup = newGraphGroups.get(newann.graphGroup) |
2419 |
|
.intValue(); |
2420 |
|
} |
2421 |
|
} |
2422 |
|
|
2423 |
0 |
alignment.addAnnotation(sequences[i].getAnnotation()[a]); |
2424 |
|
|
2425 |
0 |
ContactMatrixI cm = sequences[i] |
2426 |
|
.getContactMatrixFor(sequences[i].getAnnotation()[a]); |
2427 |
0 |
if (cm != null) |
2428 |
|
{ |
2429 |
0 |
alignment.addContactListFor(sequences[i].getAnnotation()[a], |
2430 |
|
cm); |
2431 |
|
} |
2432 |
|
|
2433 |
0 |
alignment.setAnnotationIndex(sequences[i].getAnnotation()[a], |
2434 |
|
a); |
2435 |
|
} |
2436 |
|
} |
2437 |
|
} |
2438 |
0 |
if (!newAlignment) |
2439 |
|
{ |
2440 |
|
|
2441 |
|
|
2442 |
0 |
viewport.getRanges().setEndSeq(alignment.getHeight() - 1); |
2443 |
0 |
if (annotationAdded) |
2444 |
|
{ |
2445 |
|
|
2446 |
0 |
AlignmentI[] alview = this.getViewAlignments(); |
2447 |
0 |
for (int i = 0; i < sequences.length; i++) |
2448 |
|
{ |
2449 |
0 |
AlignmentAnnotation sann[] = sequences[i].getAnnotation(); |
2450 |
0 |
if (sann == null) |
2451 |
|
{ |
2452 |
0 |
continue; |
2453 |
|
} |
2454 |
0 |
for (int avnum = 0; avnum < alview.length; avnum++) |
2455 |
|
{ |
2456 |
0 |
if (alview[avnum] != alignment) |
2457 |
|
{ |
2458 |
|
|
2459 |
0 |
int avwidth = alview[avnum].getWidth() + 1; |
2460 |
|
|
2461 |
|
|
2462 |
0 |
for (int a = 0; a < sann.length; a++) |
2463 |
|
{ |
2464 |
0 |
AlignmentAnnotation newann = new AlignmentAnnotation( |
2465 |
|
sann[a]); |
2466 |
0 |
sequences[i].addAlignmentAnnotation(newann); |
2467 |
0 |
newann.padAnnotation(avwidth); |
2468 |
0 |
alview[avnum].addAnnotation(newann); |
2469 |
|
|
2470 |
|
|
2471 |
|
|
2472 |
|
|
2473 |
0 |
alview[avnum].setAnnotationIndex(newann, a); |
2474 |
|
} |
2475 |
|
} |
2476 |
|
} |
2477 |
|
} |
2478 |
0 |
buildSortByAnnotationScoresMenu(); |
2479 |
|
} |
2480 |
0 |
viewport.firePropertyChange("alignment", null, |
2481 |
|
alignment.getSequences()); |
2482 |
0 |
if (alignPanels != null) |
2483 |
|
{ |
2484 |
0 |
for (AlignmentPanel ap : alignPanels) |
2485 |
|
{ |
2486 |
0 |
ap.validateAnnotationDimensions(false); |
2487 |
|
} |
2488 |
|
} |
2489 |
|
else |
2490 |
|
{ |
2491 |
0 |
alignPanel.validateAnnotationDimensions(false); |
2492 |
|
} |
2493 |
|
|
2494 |
|
} |
2495 |
|
else |
2496 |
|
{ |
2497 |
0 |
AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, |
2498 |
|
DEFAULT_HEIGHT); |
2499 |
0 |
String newtitle = new String("Copied sequences"); |
2500 |
|
|
2501 |
0 |
if (Desktop.jalviewClipboard != null |
2502 |
|
&& Desktop.jalviewClipboard[2] != null) |
2503 |
|
{ |
2504 |
0 |
HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2]; |
2505 |
0 |
af.viewport.setHiddenColumns(hc); |
2506 |
|
} |
2507 |
|
|
2508 |
|
|
2509 |
|
|
2510 |
0 |
af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() |
2511 |
|
.transferSettings(alignPanel.getSeqPanel().seqCanvas |
2512 |
|
.getFeatureRenderer()); |
2513 |
|
|
2514 |
|
|
2515 |
|
|
2516 |
0 |
if (!externalPaste) |
2517 |
|
{ |
2518 |
0 |
if (title.startsWith("Copied sequences")) |
2519 |
|
{ |
2520 |
0 |
newtitle = title; |
2521 |
|
} |
2522 |
|
else |
2523 |
|
{ |
2524 |
0 |
newtitle = newtitle.concat("- from " + title); |
2525 |
|
} |
2526 |
|
} |
2527 |
|
else |
2528 |
|
{ |
2529 |
0 |
newtitle = new String("Pasted sequences"); |
2530 |
|
} |
2531 |
|
|
2532 |
0 |
Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH, |
2533 |
|
DEFAULT_HEIGHT); |
2534 |
|
|
2535 |
|
} |
2536 |
|
|
2537 |
|
} catch (Exception ex) |
2538 |
|
{ |
2539 |
0 |
ex.printStackTrace(); |
2540 |
0 |
jalview.bin.Console.outPrintln("Exception whilst pasting: " + ex); |
2541 |
|
|
2542 |
|
} |
2543 |
|
|
2544 |
|
} |
2545 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.4 |
|
2546 |
0 |
@Override... |
2547 |
|
protected void expand_newalign(ActionEvent e) |
2548 |
|
{ |
2549 |
0 |
try |
2550 |
|
{ |
2551 |
0 |
AlignmentI alignment = AlignmentUtils |
2552 |
|
.expandContext(getViewport().getAlignment(), -1); |
2553 |
0 |
AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, |
2554 |
|
DEFAULT_HEIGHT); |
2555 |
0 |
String newtitle = new String("Flanking alignment"); |
2556 |
|
|
2557 |
0 |
if (Desktop.jalviewClipboard != null |
2558 |
|
&& Desktop.jalviewClipboard[2] != null) |
2559 |
|
{ |
2560 |
0 |
HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2]; |
2561 |
0 |
af.viewport.setHiddenColumns(hc); |
2562 |
|
} |
2563 |
|
|
2564 |
|
|
2565 |
|
|
2566 |
0 |
af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() |
2567 |
|
.transferSettings(alignPanel.getSeqPanel().seqCanvas |
2568 |
|
.getFeatureRenderer()); |
2569 |
|
|
2570 |
|
|
2571 |
|
|
2572 |
|
{ |
2573 |
0 |
if (title.startsWith("Copied sequences")) |
2574 |
|
{ |
2575 |
0 |
newtitle = title; |
2576 |
|
} |
2577 |
|
else |
2578 |
|
{ |
2579 |
0 |
newtitle = newtitle.concat("- from " + title); |
2580 |
|
} |
2581 |
|
} |
2582 |
|
|
2583 |
0 |
Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH, DEFAULT_HEIGHT); |
2584 |
|
|
2585 |
|
} catch (Exception ex) |
2586 |
|
{ |
2587 |
0 |
ex.printStackTrace(); |
2588 |
0 |
jalview.bin.Console.outPrintln("Exception whilst pasting: " + ex); |
2589 |
|
|
2590 |
|
} catch (OutOfMemoryError oom) |
2591 |
|
{ |
2592 |
0 |
new OOMWarning("Viewing flanking region of alignment", oom); |
2593 |
|
} |
2594 |
|
} |
2595 |
|
|
2596 |
|
|
2597 |
|
|
2598 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2599 |
0 |
@Override... |
2600 |
|
protected void cut_actionPerformed() |
2601 |
|
{ |
2602 |
0 |
copy_actionPerformed(); |
2603 |
0 |
delete_actionPerformed(); |
2604 |
|
} |
2605 |
|
|
2606 |
|
|
2607 |
|
|
2608 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 8 |
Complexity Density: 0.35 |
|
2609 |
0 |
@Override... |
2610 |
|
protected void delete_actionPerformed() |
2611 |
|
{ |
2612 |
|
|
2613 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
2614 |
0 |
if (sg == null) |
2615 |
|
{ |
2616 |
0 |
return; |
2617 |
|
} |
2618 |
|
|
2619 |
0 |
Runnable okAction = () -> { |
2620 |
0 |
SequenceI[] cut = sg.getSequences() |
2621 |
|
.toArray(new SequenceI[sg.getSize()]); |
2622 |
|
|
2623 |
0 |
addHistoryItem(new EditCommand( |
2624 |
|
MessageManager.getString("label.cut_sequences"), Action.CUT, |
2625 |
|
cut, sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1, |
2626 |
|
viewport.getAlignment())); |
2627 |
|
|
2628 |
0 |
viewport.setSelectionGroup(null); |
2629 |
0 |
viewport.sendSelection(); |
2630 |
0 |
viewport.getAlignment().deleteGroup(sg); |
2631 |
|
|
2632 |
0 |
viewport.firePropertyChange("alignment", null, |
2633 |
|
viewport.getAlignment().getSequences()); |
2634 |
0 |
if (viewport.getAlignment().getHeight() < 1) |
2635 |
|
{ |
2636 |
0 |
try |
2637 |
|
{ |
2638 |
0 |
AlignFrame.this.setClosed(true); |
2639 |
|
} catch (Exception ex) |
2640 |
|
{ |
2641 |
|
} |
2642 |
|
} |
2643 |
|
}; |
2644 |
|
|
2645 |
|
|
2646 |
|
|
2647 |
|
|
2648 |
0 |
boolean wholeHeight = sg.getSize() == viewport.getAlignment() |
2649 |
|
.getHeight(); |
2650 |
0 |
boolean wholeWidth = (((sg.getEndRes() - sg.getStartRes()) |
2651 |
|
+ 1) == viewport.getAlignment().getWidth()) ? true : false; |
2652 |
0 |
if (wholeHeight && wholeWidth) |
2653 |
|
{ |
2654 |
0 |
JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop); |
2655 |
0 |
dialog.setResponseHandler(0, okAction); |
2656 |
0 |
Object[] options = new Object[] { |
2657 |
|
MessageManager.getString("action.ok"), |
2658 |
|
MessageManager.getString("action.cancel") }; |
2659 |
0 |
dialog.showDialog(MessageManager.getString("warn.delete_all"), |
2660 |
|
MessageManager.getString("label.delete_all"), |
2661 |
|
JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null, |
2662 |
|
options, options[0]); |
2663 |
|
} |
2664 |
|
else |
2665 |
|
{ |
2666 |
0 |
try |
2667 |
|
{ |
2668 |
0 |
okAction.run(); |
2669 |
|
} catch (Exception e) |
2670 |
|
{ |
2671 |
0 |
e.printStackTrace(); |
2672 |
|
} |
2673 |
|
} |
2674 |
|
} |
2675 |
|
|
2676 |
|
|
2677 |
|
|
2678 |
|
|
2679 |
|
@param |
2680 |
|
|
2681 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
2682 |
0 |
@Override... |
2683 |
|
protected void deleteGroups_actionPerformed(ActionEvent e) |
2684 |
|
{ |
2685 |
0 |
if (avc.deleteGroups()) |
2686 |
|
{ |
2687 |
0 |
PaintRefresher.Refresh(this, viewport.getSequenceSetId()); |
2688 |
0 |
alignPanel.updateAnnotation(); |
2689 |
0 |
alignPanel.paintAlignment(true, true); |
2690 |
|
} |
2691 |
|
} |
2692 |
|
|
2693 |
|
|
2694 |
|
|
2695 |
|
|
2696 |
|
@param |
2697 |
|
|
2698 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
2699 |
6 |
@Override... |
2700 |
|
public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e) |
2701 |
|
{ |
2702 |
6 |
SequenceGroup sg = new SequenceGroup( |
2703 |
|
viewport.getAlignment().getSequences()); |
2704 |
|
|
2705 |
6 |
sg.setEndRes(viewport.getAlignment().getWidth() - 1); |
2706 |
6 |
viewport.setSelectionGroup(sg); |
2707 |
6 |
viewport.isSelectionGroupChanged(true); |
2708 |
6 |
viewport.sendSelection(); |
2709 |
|
|
2710 |
|
|
2711 |
|
|
2712 |
6 |
alignPanel.paintAlignment(false, false); |
2713 |
6 |
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); |
2714 |
|
} |
2715 |
|
|
2716 |
|
|
2717 |
|
|
2718 |
|
|
2719 |
|
@param |
2720 |
|
|
2721 |
|
|
|
|
| 75% |
Uncovered Elements: 3 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
2722 |
2 |
@Override... |
2723 |
|
public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e) |
2724 |
|
{ |
2725 |
2 |
if (viewport.cursorMode) |
2726 |
|
{ |
2727 |
0 |
alignPanel.getSeqPanel().keyboardNo1 = null; |
2728 |
0 |
alignPanel.getSeqPanel().keyboardNo2 = null; |
2729 |
|
} |
2730 |
2 |
viewport.setSelectionGroup(null); |
2731 |
2 |
viewport.getColumnSelection().clear(); |
2732 |
2 |
viewport.setSearchResults(null); |
2733 |
2 |
alignPanel.getIdPanel().getIdCanvas().searchResults = null; |
2734 |
|
|
2735 |
|
|
2736 |
|
|
2737 |
2 |
alignPanel.paintAlignment(false, false); |
2738 |
2 |
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); |
2739 |
2 |
viewport.sendSelection(); |
2740 |
|
} |
2741 |
|
|
2742 |
|
|
2743 |
|
|
2744 |
|
|
2745 |
|
@param |
2746 |
|
|
2747 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
2748 |
0 |
@Override... |
2749 |
|
public void invertSequenceMenuItem_actionPerformed(ActionEvent e) |
2750 |
|
{ |
2751 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
2752 |
|
|
2753 |
0 |
if (sg == null) |
2754 |
|
{ |
2755 |
0 |
selectAllSequenceMenuItem_actionPerformed(null); |
2756 |
|
|
2757 |
0 |
return; |
2758 |
|
} |
2759 |
|
|
2760 |
0 |
for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) |
2761 |
|
{ |
2762 |
0 |
sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false); |
2763 |
|
} |
2764 |
|
|
2765 |
|
|
2766 |
|
|
2767 |
|
|
2768 |
0 |
alignPanel.paintAlignment(true, false); |
2769 |
0 |
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); |
2770 |
0 |
viewport.sendSelection(); |
2771 |
|
} |
2772 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
2773 |
0 |
@Override... |
2774 |
|
public void invertColSel_actionPerformed(ActionEvent e) |
2775 |
|
{ |
2776 |
0 |
viewport.invertColumnSelection(); |
2777 |
0 |
alignPanel.paintAlignment(true, false); |
2778 |
0 |
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); |
2779 |
0 |
viewport.sendSelection(); |
2780 |
|
} |
2781 |
|
|
2782 |
|
|
2783 |
|
|
2784 |
|
|
2785 |
|
@param |
2786 |
|
|
2787 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2788 |
0 |
@Override... |
2789 |
|
public void remove2LeftMenuItem_actionPerformed(ActionEvent e) |
2790 |
|
{ |
2791 |
0 |
trimAlignment(true); |
2792 |
|
} |
2793 |
|
|
2794 |
|
|
2795 |
|
|
2796 |
|
|
2797 |
|
@param |
2798 |
|
|
2799 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2800 |
0 |
@Override... |
2801 |
|
public void remove2RightMenuItem_actionPerformed(ActionEvent e) |
2802 |
|
{ |
2803 |
0 |
trimAlignment(false); |
2804 |
|
} |
2805 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 9 |
Complexity Density: 0.43 |
|
2806 |
0 |
void trimAlignment(boolean trimLeft)... |
2807 |
|
{ |
2808 |
0 |
ColumnSelection colSel = viewport.getColumnSelection(); |
2809 |
0 |
int column; |
2810 |
|
|
2811 |
0 |
if (!colSel.isEmpty()) |
2812 |
|
{ |
2813 |
0 |
if (trimLeft) |
2814 |
|
{ |
2815 |
0 |
column = colSel.getMin(); |
2816 |
|
} |
2817 |
|
else |
2818 |
|
{ |
2819 |
0 |
column = colSel.getMax(); |
2820 |
|
} |
2821 |
|
|
2822 |
0 |
SequenceI[] seqs; |
2823 |
0 |
if (viewport.getSelectionGroup() != null) |
2824 |
|
{ |
2825 |
0 |
seqs = viewport.getSelectionGroup() |
2826 |
|
.getSequencesAsArray(viewport.getHiddenRepSequences()); |
2827 |
|
} |
2828 |
|
else |
2829 |
|
{ |
2830 |
0 |
seqs = viewport.getAlignment().getSequencesArray(); |
2831 |
|
} |
2832 |
|
|
2833 |
0 |
TrimRegionCommand trimRegion; |
2834 |
0 |
if (trimLeft) |
2835 |
|
{ |
2836 |
0 |
trimRegion = new TrimRegionCommand("Remove Left", true, seqs, |
2837 |
|
column, viewport.getAlignment()); |
2838 |
0 |
viewport.getRanges().setStartRes(0); |
2839 |
|
} |
2840 |
|
else |
2841 |
|
{ |
2842 |
0 |
trimRegion = new TrimRegionCommand("Remove Right", false, seqs, |
2843 |
|
column, viewport.getAlignment()); |
2844 |
|
} |
2845 |
|
|
2846 |
0 |
setStatus(MessageManager.formatMessage("label.removed_columns", |
2847 |
|
new String[] |
2848 |
|
{ Integer.valueOf(trimRegion.getSize()).toString() })); |
2849 |
|
|
2850 |
0 |
addHistoryItem(trimRegion); |
2851 |
|
|
2852 |
0 |
for (SequenceGroup sg : viewport.getAlignment().getGroups()) |
2853 |
|
{ |
2854 |
0 |
if ((trimLeft && !sg.adjustForRemoveLeft(column)) |
2855 |
|
|| (!trimLeft && !sg.adjustForRemoveRight(column))) |
2856 |
|
{ |
2857 |
0 |
viewport.getAlignment().deleteGroup(sg); |
2858 |
|
} |
2859 |
|
} |
2860 |
|
|
2861 |
0 |
viewport.firePropertyChange("alignment", null, |
2862 |
|
viewport.getAlignment().getSequences()); |
2863 |
|
} |
2864 |
|
} |
2865 |
|
|
2866 |
|
|
2867 |
|
|
2868 |
|
|
2869 |
|
@param |
2870 |
|
|
2871 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 2 |
Complexity Density: 0.13 |
|
2872 |
0 |
@Override... |
2873 |
|
public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e) |
2874 |
|
{ |
2875 |
0 |
int start = 0, end = viewport.getAlignment().getWidth() - 1; |
2876 |
|
|
2877 |
0 |
SequenceI[] seqs; |
2878 |
0 |
if (viewport.getSelectionGroup() != null) |
2879 |
|
{ |
2880 |
0 |
seqs = viewport.getSelectionGroup() |
2881 |
|
.getSequencesAsArray(viewport.getHiddenRepSequences()); |
2882 |
0 |
start = viewport.getSelectionGroup().getStartRes(); |
2883 |
0 |
end = viewport.getSelectionGroup().getEndRes(); |
2884 |
|
} |
2885 |
|
else |
2886 |
|
{ |
2887 |
0 |
seqs = viewport.getAlignment().getSequencesArray(); |
2888 |
|
} |
2889 |
|
|
2890 |
0 |
RemoveGapColCommand removeGapCols = new RemoveGapColCommand( |
2891 |
|
"Remove Gapped Columns", seqs, start, end, |
2892 |
|
viewport.getAlignment()); |
2893 |
|
|
2894 |
0 |
addHistoryItem(removeGapCols); |
2895 |
|
|
2896 |
0 |
setStatus(MessageManager.formatMessage("label.removed_empty_columns", |
2897 |
|
new Object[] |
2898 |
|
{ Integer.valueOf(removeGapCols.getSize()).toString() })); |
2899 |
|
|
2900 |
|
|
2901 |
|
|
2902 |
0 |
SequenceI seq = viewport.getAlignment().getSequenceAt(0); |
2903 |
0 |
ViewportRanges ranges = viewport.getRanges(); |
2904 |
0 |
int startRes = seq.findPosition(ranges.getStartRes()); |
2905 |
|
|
2906 |
|
|
2907 |
|
|
2908 |
|
|
2909 |
|
|
2910 |
0 |
ranges.setStartRes(seq.findIndex(startRes) - 1); |
2911 |
0 |
viewport.firePropertyChange("alignment", null, |
2912 |
|
viewport.getAlignment().getSequences()); |
2913 |
|
|
2914 |
|
} |
2915 |
|
|
2916 |
|
|
2917 |
|
|
2918 |
|
|
2919 |
|
@param |
2920 |
|
|
2921 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
|
2922 |
0 |
@Override... |
2923 |
|
public void removeAllGapsMenuItem_actionPerformed(ActionEvent e) |
2924 |
|
{ |
2925 |
0 |
int start = 0, end = viewport.getAlignment().getWidth() - 1; |
2926 |
|
|
2927 |
0 |
SequenceI[] seqs; |
2928 |
0 |
if (viewport.getSelectionGroup() != null) |
2929 |
|
{ |
2930 |
0 |
seqs = viewport.getSelectionGroup() |
2931 |
|
.getSequencesAsArray(viewport.getHiddenRepSequences()); |
2932 |
0 |
start = viewport.getSelectionGroup().getStartRes(); |
2933 |
0 |
end = viewport.getSelectionGroup().getEndRes(); |
2934 |
|
} |
2935 |
|
else |
2936 |
|
{ |
2937 |
0 |
seqs = viewport.getAlignment().getSequencesArray(); |
2938 |
|
} |
2939 |
|
|
2940 |
|
|
2941 |
|
|
2942 |
0 |
SequenceI seq = viewport.getAlignment().getSequenceAt(0); |
2943 |
0 |
int startRes = seq.findPosition(viewport.getRanges().getStartRes()); |
2944 |
|
|
2945 |
0 |
addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end, |
2946 |
|
viewport.getAlignment())); |
2947 |
|
|
2948 |
0 |
viewport.getRanges().setStartRes(seq.findIndex(startRes) - 1); |
2949 |
|
|
2950 |
0 |
viewport.firePropertyChange("alignment", null, |
2951 |
|
viewport.getAlignment().getSequences()); |
2952 |
|
|
2953 |
|
} |
2954 |
|
|
2955 |
|
|
2956 |
|
|
2957 |
|
|
2958 |
|
@param |
2959 |
|
|
2960 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2961 |
0 |
@Override... |
2962 |
|
public void padGapsMenuitem_actionPerformed(ActionEvent e) |
2963 |
|
{ |
2964 |
0 |
viewport.setPadGaps(padGapsMenuitem.isSelected()); |
2965 |
0 |
viewport.firePropertyChange("alignment", null, |
2966 |
|
viewport.getAlignment().getSequences()); |
2967 |
|
} |
2968 |
|
|
2969 |
|
|
2970 |
|
|
2971 |
|
|
2972 |
|
@param |
2973 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2974 |
0 |
@Override... |
2975 |
|
public void findMenuItem_actionPerformed(ActionEvent e) |
2976 |
|
{ |
2977 |
0 |
new Finder(alignPanel, false, null); |
2978 |
|
} |
2979 |
|
|
2980 |
|
|
2981 |
|
|
2982 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2983 |
7 |
@Override... |
2984 |
|
public void newView_actionPerformed(ActionEvent e) |
2985 |
|
{ |
2986 |
7 |
newView(null, true); |
2987 |
|
} |
2988 |
|
|
2989 |
|
|
2990 |
|
|
2991 |
|
|
2992 |
|
@param |
2993 |
|
|
2994 |
|
@param |
2995 |
|
|
2996 |
|
@return |
2997 |
|
|
|
|
| 82.1% |
Uncovered Elements: 5 (28) |
Complexity: 5 |
Complexity Density: 0.25 |
|
2998 |
10 |
public AlignmentPanel newView(String viewTitle, boolean copyAnnotation)... |
2999 |
|
{ |
3000 |
|
|
3001 |
|
|
3002 |
|
|
3003 |
10 |
AlignmentPanel newap = new jalview.project.Jalview2XML() |
3004 |
|
.copyAlignPanel(alignPanel); |
3005 |
10 |
if (!copyAnnotation) |
3006 |
|
{ |
3007 |
|
|
3008 |
|
|
3009 |
|
|
3010 |
0 |
newap.av.getAlignment().deleteAllGroups(); |
3011 |
0 |
newap.av.getAlignment().deleteAllAnnotations(false); |
3012 |
|
} |
3013 |
|
|
3014 |
10 |
newap.av.setGatherViewsHere(false); |
3015 |
|
|
3016 |
10 |
if (viewport.getViewName() == null) |
3017 |
|
{ |
3018 |
9 |
viewport.setViewName( |
3019 |
|
MessageManager.getString("label.view_name_original")); |
3020 |
|
} |
3021 |
|
|
3022 |
|
|
3023 |
|
|
3024 |
|
|
3025 |
10 |
newap.av.setHistoryList(viewport.getHistoryList()); |
3026 |
10 |
newap.av.setRedoList(viewport.getRedoList()); |
3027 |
|
|
3028 |
|
|
3029 |
|
|
3030 |
|
|
3031 |
10 |
newap.av.setColourAppliesToAllGroups( |
3032 |
|
viewport.getColourAppliesToAllGroups()); |
3033 |
|
|
3034 |
|
|
3035 |
|
|
3036 |
|
|
3037 |
|
|
3038 |
|
|
3039 |
10 |
newap.av.replaceMappings(viewport.getAlignment()); |
3040 |
|
|
3041 |
|
|
3042 |
|
|
3043 |
|
|
3044 |
10 |
if (newap.av.initComplementConsensus()) |
3045 |
|
{ |
3046 |
0 |
newap.refresh(true); |
3047 |
|
} |
3048 |
|
|
3049 |
10 |
newap.av.setViewName(getNewViewName(viewTitle)); |
3050 |
|
|
3051 |
10 |
addAlignmentPanel(newap, true); |
3052 |
10 |
newap.alignmentChanged(); |
3053 |
|
|
3054 |
10 |
if (alignPanels.size() == 2) |
3055 |
|
{ |
3056 |
9 |
viewport.setGatherViewsHere(true); |
3057 |
|
} |
3058 |
10 |
tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1); |
3059 |
|
|
3060 |
10 |
return newap; |
3061 |
|
} |
3062 |
|
|
3063 |
|
|
3064 |
|
|
3065 |
|
|
3066 |
|
|
3067 |
|
|
3068 |
|
@param |
3069 |
|
@return |
3070 |
|
|
|
|
| 88.9% |
Uncovered Elements: 2 (18) |
Complexity: 5 |
Complexity Density: 0.42 |
|
3071 |
10 |
protected String getNewViewName(String viewTitle)... |
3072 |
|
{ |
3073 |
10 |
int index = Desktop.getViewCount(viewport.getSequenceSetId()); |
3074 |
10 |
boolean addFirstIndex = false; |
3075 |
10 |
if (viewTitle == null || viewTitle.trim().length() == 0) |
3076 |
|
{ |
3077 |
7 |
viewTitle = MessageManager.getString("action.view"); |
3078 |
7 |
addFirstIndex = true; |
3079 |
|
} |
3080 |
|
else |
3081 |
|
{ |
3082 |
3 |
index = 1; |
3083 |
|
} |
3084 |
10 |
String newViewName = viewTitle + ((addFirstIndex) ? " " + index : ""); |
3085 |
|
|
3086 |
10 |
List<Component> comps = PaintRefresher.components |
3087 |
|
.get(viewport.getSequenceSetId()); |
3088 |
|
|
3089 |
10 |
List<String> existingNames = getExistingViewNames(comps); |
3090 |
|
|
3091 |
10 |
while (existingNames.contains(newViewName)) |
3092 |
|
{ |
3093 |
0 |
newViewName = viewTitle + " " + (++index); |
3094 |
|
} |
3095 |
10 |
return newViewName; |
3096 |
|
} |
3097 |
|
|
3098 |
|
|
3099 |
|
|
3100 |
|
|
3101 |
|
|
3102 |
|
@param |
3103 |
|
@return |
3104 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
3105 |
10 |
protected List<String> getExistingViewNames(List<Component> comps)... |
3106 |
|
{ |
3107 |
10 |
List<String> existingNames = new ArrayList<>(); |
3108 |
10 |
for (Component comp : comps) |
3109 |
|
{ |
3110 |
63 |
if (comp instanceof AlignmentPanel) |
3111 |
|
{ |
3112 |
21 |
AlignmentPanel ap = (AlignmentPanel) comp; |
3113 |
21 |
if (!existingNames.contains(ap.av.getViewName())) |
3114 |
|
{ |
3115 |
20 |
existingNames.add(ap.av.getViewName()); |
3116 |
|
} |
3117 |
|
} |
3118 |
|
} |
3119 |
10 |
return existingNames; |
3120 |
|
} |
3121 |
|
|
3122 |
|
|
3123 |
|
|
3124 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3125 |
0 |
@Override... |
3126 |
|
public void expandViews_actionPerformed(ActionEvent e) |
3127 |
|
{ |
3128 |
0 |
Desktop.explodeViews(this); |
3129 |
|
} |
3130 |
|
|
3131 |
|
|
3132 |
|
|
3133 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3134 |
0 |
@Override... |
3135 |
|
public void gatherViews_actionPerformed(ActionEvent e) |
3136 |
|
{ |
3137 |
0 |
Desktop.instance.gatherViews(this); |
3138 |
|
} |
3139 |
|
|
3140 |
|
|
3141 |
|
|
3142 |
|
|
3143 |
|
@param |
3144 |
|
|
3145 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3146 |
0 |
@Override... |
3147 |
|
public void font_actionPerformed(ActionEvent e) |
3148 |
|
{ |
3149 |
0 |
new FontChooser(alignPanel); |
3150 |
|
} |
3151 |
|
|
3152 |
|
|
3153 |
|
|
3154 |
|
|
3155 |
|
@param |
3156 |
|
|
3157 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
3158 |
0 |
@Override... |
3159 |
|
protected void seqLimit_actionPerformed(ActionEvent e) |
3160 |
|
{ |
3161 |
0 |
viewport.setShowJVSuffix(seqLimits.isSelected()); |
3162 |
|
|
3163 |
0 |
alignPanel.getIdPanel().getIdCanvas() |
3164 |
|
.setPreferredSize(alignPanel.calculateIdWidth()); |
3165 |
0 |
alignPanel.paintAlignment(true, false); |
3166 |
|
} |
3167 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3168 |
0 |
@Override... |
3169 |
|
public void idRightAlign_actionPerformed(ActionEvent e) |
3170 |
|
{ |
3171 |
0 |
viewport.setRightAlignIds(idRightAlign.isSelected()); |
3172 |
0 |
alignPanel.paintAlignment(false, false); |
3173 |
|
} |
3174 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3175 |
0 |
@Override... |
3176 |
|
public void centreColumnLabels_actionPerformed(ActionEvent e) |
3177 |
|
{ |
3178 |
0 |
viewport.setCentreColumnLabels(centreColumnLabelsMenuItem.getState()); |
3179 |
0 |
alignPanel.paintAlignment(false, false); |
3180 |
|
} |
3181 |
|
|
3182 |
|
|
3183 |
|
|
3184 |
|
|
3185 |
|
@see |
3186 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
3187 |
0 |
@Override... |
3188 |
|
protected void followHighlight_actionPerformed() |
3189 |
|
{ |
3190 |
|
|
3191 |
|
|
3192 |
|
|
3193 |
|
|
3194 |
0 |
final boolean state = this.followHighlightMenuItem.getState(); |
3195 |
0 |
viewport.setFollowHighlight(state); |
3196 |
0 |
if (state) |
3197 |
|
{ |
3198 |
0 |
alignPanel.scrollToPosition(viewport.getSearchResults()); |
3199 |
|
} |
3200 |
|
} |
3201 |
|
|
3202 |
|
|
3203 |
|
|
3204 |
|
|
3205 |
|
@param |
3206 |
|
|
3207 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3208 |
0 |
@Override... |
3209 |
|
protected void colourTextMenuItem_actionPerformed(ActionEvent e) |
3210 |
|
{ |
3211 |
0 |
viewport.setColourText(colourTextMenuItem.isSelected()); |
3212 |
0 |
alignPanel.paintAlignment(false, false); |
3213 |
|
} |
3214 |
|
|
3215 |
|
|
3216 |
|
|
3217 |
|
|
3218 |
|
@param |
3219 |
|
|
3220 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3221 |
7 |
@Override... |
3222 |
|
public void wrapMenuItem_actionPerformed(ActionEvent e) |
3223 |
|
{ |
3224 |
7 |
setWrapFormat(wrapMenuItem.isSelected(), false); |
3225 |
|
} |
3226 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
3227 |
8 |
public void setWrapFormat(boolean b, boolean setMenuItem)... |
3228 |
|
{ |
3229 |
8 |
scaleAbove.setVisible(b); |
3230 |
8 |
scaleLeft.setVisible(b); |
3231 |
8 |
scaleRight.setVisible(b); |
3232 |
8 |
viewport.setWrapAlignment(b); |
3233 |
8 |
alignPanel.updateLayout(); |
3234 |
8 |
if (setMenuItem) |
3235 |
|
{ |
3236 |
0 |
wrapMenuItem.setSelected(b); |
3237 |
|
} |
3238 |
|
} |
3239 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3240 |
0 |
@Override... |
3241 |
|
public void showAllSeqs_actionPerformed(ActionEvent e) |
3242 |
|
{ |
3243 |
0 |
viewport.showAllHiddenSeqs(); |
3244 |
|
} |
3245 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
3246 |
0 |
@Override... |
3247 |
|
public void showAllColumns_actionPerformed(ActionEvent e) |
3248 |
|
{ |
3249 |
0 |
viewport.showAllHiddenColumns(); |
3250 |
0 |
alignPanel.paintAlignment(true, true); |
3251 |
0 |
viewport.sendSelection(); |
3252 |
|
} |
3253 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3254 |
0 |
@Override... |
3255 |
|
public void hideSelSequences_actionPerformed(ActionEvent e) |
3256 |
|
{ |
3257 |
0 |
viewport.hideAllSelectedSeqs(); |
3258 |
|
} |
3259 |
|
|
3260 |
|
|
3261 |
|
|
3262 |
|
|
3263 |
|
@param |
3264 |
|
@param |
3265 |
|
|
|
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 17 |
Complexity Density: 0.71 |
|
3266 |
0 |
protected void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols)... |
3267 |
|
{ |
3268 |
|
|
3269 |
0 |
boolean hide = false; |
3270 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
3271 |
0 |
if (!toggleSeqs && !toggleCols) |
3272 |
|
{ |
3273 |
|
|
3274 |
|
|
3275 |
|
|
3276 |
0 |
if (viewport.hasSelectedColumns() || (sg != null && sg.getSize() > 0 |
3277 |
|
&& sg.getStartRes() <= sg.getEndRes())) |
3278 |
|
{ |
3279 |
|
|
3280 |
|
|
3281 |
0 |
if (sg != null) |
3282 |
|
{ |
3283 |
0 |
invertSequenceMenuItem_actionPerformed(null); |
3284 |
0 |
sg = viewport.getSelectionGroup(); |
3285 |
0 |
toggleSeqs = true; |
3286 |
|
|
3287 |
|
} |
3288 |
0 |
viewport.expandColSelection(sg, true); |
3289 |
|
|
3290 |
|
|
3291 |
0 |
invertColSel_actionPerformed(null); |
3292 |
0 |
toggleCols = true; |
3293 |
|
} |
3294 |
|
} |
3295 |
|
|
3296 |
0 |
if (toggleSeqs) |
3297 |
|
{ |
3298 |
0 |
if (sg != null && sg.getSize() != viewport.getAlignment().getHeight()) |
3299 |
|
{ |
3300 |
0 |
hideSelSequences_actionPerformed(null); |
3301 |
0 |
hide = true; |
3302 |
|
} |
3303 |
0 |
else if (!(toggleCols && viewport.hasSelectedColumns())) |
3304 |
|
{ |
3305 |
0 |
showAllSeqs_actionPerformed(null); |
3306 |
|
} |
3307 |
|
} |
3308 |
|
|
3309 |
0 |
if (toggleCols) |
3310 |
|
{ |
3311 |
0 |
if (viewport.hasSelectedColumns()) |
3312 |
|
{ |
3313 |
0 |
hideSelColumns_actionPerformed(null); |
3314 |
0 |
if (!toggleSeqs) |
3315 |
|
{ |
3316 |
0 |
viewport.setSelectionGroup(sg); |
3317 |
|
} |
3318 |
|
} |
3319 |
0 |
else if (!hide) |
3320 |
|
{ |
3321 |
0 |
showAllColumns_actionPerformed(null); |
3322 |
|
} |
3323 |
|
} |
3324 |
|
} |
3325 |
|
|
3326 |
|
|
3327 |
|
|
3328 |
|
|
3329 |
|
@see |
3330 |
|
|
3331 |
|
|
3332 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3333 |
0 |
@Override... |
3334 |
|
public void hideAllButSelection_actionPerformed(ActionEvent e) |
3335 |
|
{ |
3336 |
0 |
toggleHiddenRegions(false, false); |
3337 |
0 |
viewport.sendSelection(); |
3338 |
|
} |
3339 |
|
|
3340 |
|
|
3341 |
|
|
3342 |
|
|
3343 |
|
@see |
3344 |
|
|
3345 |
|
|
3346 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
3347 |
0 |
@Override... |
3348 |
|
public void hideAllSelection_actionPerformed(ActionEvent e) |
3349 |
|
{ |
3350 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
3351 |
0 |
viewport.expandColSelection(sg, false); |
3352 |
0 |
viewport.hideAllSelectedSeqs(); |
3353 |
0 |
viewport.hideSelectedColumns(); |
3354 |
0 |
alignPanel.updateLayout(); |
3355 |
0 |
alignPanel.paintAlignment(true, true); |
3356 |
0 |
viewport.sendSelection(); |
3357 |
|
} |
3358 |
|
|
3359 |
|
|
3360 |
|
|
3361 |
|
|
3362 |
|
@see |
3363 |
|
|
3364 |
|
|
3365 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
3366 |
0 |
@Override... |
3367 |
|
public void showAllhidden_actionPerformed(ActionEvent e) |
3368 |
|
{ |
3369 |
0 |
viewport.showAllHiddenColumns(); |
3370 |
0 |
viewport.showAllHiddenSeqs(); |
3371 |
0 |
alignPanel.paintAlignment(true, true); |
3372 |
0 |
viewport.sendSelection(); |
3373 |
|
} |
3374 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
3375 |
2 |
@Override... |
3376 |
|
public void hideSelColumns_actionPerformed(ActionEvent e) |
3377 |
|
{ |
3378 |
2 |
viewport.hideSelectedColumns(); |
3379 |
2 |
alignPanel.updateLayout(); |
3380 |
2 |
alignPanel.paintAlignment(true, true); |
3381 |
2 |
viewport.sendSelection(); |
3382 |
|
} |
3383 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3384 |
0 |
@Override... |
3385 |
|
public void hiddenMarkers_actionPerformed(ActionEvent e) |
3386 |
|
{ |
3387 |
0 |
viewport.setShowHiddenMarkers(hiddenMarkers.isSelected()); |
3388 |
0 |
repaint(); |
3389 |
|
} |
3390 |
|
|
3391 |
|
|
3392 |
|
|
3393 |
|
|
3394 |
|
@param |
3395 |
|
|
3396 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
3397 |
0 |
@Override... |
3398 |
|
protected void scaleAbove_actionPerformed(ActionEvent e) |
3399 |
|
{ |
3400 |
0 |
viewport.setScaleAboveWrapped(scaleAbove.isSelected()); |
3401 |
0 |
alignPanel.updateLayout(); |
3402 |
0 |
alignPanel.paintAlignment(true, false); |
3403 |
|
} |
3404 |
|
|
3405 |
|
|
3406 |
|
|
3407 |
|
|
3408 |
|
@param |
3409 |
|
|
3410 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
3411 |
0 |
@Override... |
3412 |
|
protected void scaleLeft_actionPerformed(ActionEvent e) |
3413 |
|
{ |
3414 |
0 |
viewport.setScaleLeftWrapped(scaleLeft.isSelected()); |
3415 |
0 |
alignPanel.updateLayout(); |
3416 |
0 |
alignPanel.paintAlignment(true, false); |
3417 |
|
} |
3418 |
|
|
3419 |
|
|
3420 |
|
|
3421 |
|
|
3422 |
|
@param |
3423 |
|
|
3424 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
3425 |
0 |
@Override... |
3426 |
|
protected void scaleRight_actionPerformed(ActionEvent e) |
3427 |
|
{ |
3428 |
0 |
viewport.setScaleRightWrapped(scaleRight.isSelected()); |
3429 |
0 |
alignPanel.updateLayout(); |
3430 |
0 |
alignPanel.paintAlignment(true, false); |
3431 |
|
} |
3432 |
|
|
3433 |
|
|
3434 |
|
|
3435 |
|
|
3436 |
|
@param |
3437 |
|
|
3438 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3439 |
0 |
@Override... |
3440 |
|
public void viewBoxesMenuItem_actionPerformed(ActionEvent e) |
3441 |
|
{ |
3442 |
0 |
viewport.setShowBoxes(viewBoxesMenuItem.isSelected()); |
3443 |
0 |
alignPanel.paintAlignment(false, false); |
3444 |
|
} |
3445 |
|
|
3446 |
|
|
3447 |
|
|
3448 |
|
|
3449 |
|
@param |
3450 |
|
|
3451 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3452 |
0 |
@Override... |
3453 |
|
public void viewTextMenuItem_actionPerformed(ActionEvent e) |
3454 |
|
{ |
3455 |
0 |
viewport.setShowText(viewTextMenuItem.isSelected()); |
3456 |
0 |
alignPanel.paintAlignment(false, false); |
3457 |
|
} |
3458 |
|
|
3459 |
|
|
3460 |
|
|
3461 |
|
|
3462 |
|
@param |
3463 |
|
|
3464 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3465 |
0 |
@Override... |
3466 |
|
protected void renderGapsMenuItem_actionPerformed(ActionEvent e) |
3467 |
|
{ |
3468 |
0 |
viewport.setRenderGaps(renderGapsMenuItem.isSelected()); |
3469 |
0 |
alignPanel.paintAlignment(false, false); |
3470 |
|
} |
3471 |
|
|
3472 |
|
public FeatureSettings featureSettings; |
3473 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3474 |
4 |
@Override... |
3475 |
|
public FeatureSettingsControllerI getFeatureSettingsUI() |
3476 |
|
{ |
3477 |
4 |
return featureSettings; |
3478 |
|
} |
3479 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3480 |
0 |
@Override... |
3481 |
|
public void featureSettings_actionPerformed(ActionEvent e) |
3482 |
|
{ |
3483 |
0 |
showFeatureSettingsUI(); |
3484 |
|
} |
3485 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
3486 |
0 |
@Override... |
3487 |
|
public FeatureSettingsControllerI showFeatureSettingsUI() |
3488 |
|
{ |
3489 |
0 |
if (featureSettings != null) |
3490 |
|
{ |
3491 |
0 |
featureSettings.closeOldSettings(); |
3492 |
0 |
featureSettings = null; |
3493 |
|
} |
3494 |
0 |
if (!showSeqFeatures.isSelected()) |
3495 |
|
{ |
3496 |
|
|
3497 |
0 |
showSeqFeatures.setSelected(true); |
3498 |
0 |
showSeqFeatures_actionPerformed(null); |
3499 |
|
} |
3500 |
0 |
featureSettings = new FeatureSettings(this); |
3501 |
0 |
return featureSettings; |
3502 |
|
} |
3503 |
|
|
3504 |
|
|
3505 |
|
|
3506 |
|
|
3507 |
|
@param |
3508 |
|
|
3509 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3510 |
0 |
@Override... |
3511 |
|
public void showSeqFeatures_actionPerformed(ActionEvent evt) |
3512 |
|
{ |
3513 |
0 |
viewport.setShowSequenceFeatures(showSeqFeatures.isSelected()); |
3514 |
0 |
alignPanel.paintAlignment(true, true); |
3515 |
|
} |
3516 |
|
|
3517 |
|
|
3518 |
|
|
3519 |
|
|
3520 |
|
|
3521 |
|
|
3522 |
|
|
3523 |
|
|
3524 |
|
@param |
3525 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
3526 |
0 |
@Override... |
3527 |
|
public void annotationPanelMenuItem_actionPerformed(ActionEvent e) |
3528 |
|
{ |
3529 |
0 |
final boolean setVisible = annotationPanelMenuItem.isSelected(); |
3530 |
0 |
viewport.setShowAnnotation(setVisible); |
3531 |
0 |
this.showAllSeqAnnotations.setEnabled(setVisible); |
3532 |
0 |
this.hideAllSeqAnnotations.setEnabled(setVisible); |
3533 |
0 |
this.showAllAlAnnotations.setEnabled(setVisible); |
3534 |
0 |
this.hideAllAlAnnotations.setEnabled(setVisible); |
3535 |
0 |
alignPanel.updateLayout(); |
3536 |
|
} |
3537 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 2 |
Complexity Density: 0.1 |
|
3538 |
0 |
@Override... |
3539 |
|
public void alignmentProperties() |
3540 |
|
{ |
3541 |
0 |
JComponent pane; |
3542 |
0 |
StringBuffer contents = new AlignmentProperties(viewport.getAlignment()) |
3543 |
|
|
3544 |
|
.formatAsHtml(); |
3545 |
0 |
String content = MessageManager.formatMessage("label.html_content", |
3546 |
|
new Object[] |
3547 |
|
{ contents.toString() }); |
3548 |
0 |
contents = null; |
3549 |
|
|
3550 |
0 |
if (Platform.isJS()) |
3551 |
|
{ |
3552 |
0 |
JLabel textLabel = new JLabel(); |
3553 |
0 |
textLabel.setText(content); |
3554 |
0 |
textLabel.setBackground(Color.WHITE); |
3555 |
|
|
3556 |
0 |
pane = new JPanel(new BorderLayout()); |
3557 |
0 |
((JPanel) pane).setOpaque(true); |
3558 |
0 |
pane.setBackground(Color.WHITE); |
3559 |
0 |
((JPanel) pane).add(textLabel, BorderLayout.NORTH); |
3560 |
|
} |
3561 |
|
else |
3562 |
|
|
3563 |
|
|
3564 |
|
|
3565 |
|
|
3566 |
|
|
3567 |
|
{ |
3568 |
0 |
JEditorPane editPane = new JEditorPane("text/html", ""); |
3569 |
0 |
editPane.setEditable(false); |
3570 |
0 |
editPane.setText(content); |
3571 |
0 |
pane = editPane; |
3572 |
|
} |
3573 |
|
|
3574 |
0 |
JInternalFrame frame = new JInternalFrame(); |
3575 |
0 |
frame.setFrameIcon(null); |
3576 |
0 |
frame.getContentPane().add(new JScrollPane(pane)); |
3577 |
|
|
3578 |
0 |
Desktop.addInternalFrame(frame, MessageManager |
3579 |
|
.formatMessage("label.alignment_properties", new Object[] |
3580 |
|
{ getTitle() }), 500, 400); |
3581 |
|
} |
3582 |
|
|
3583 |
|
|
3584 |
|
|
3585 |
|
|
3586 |
|
@param |
3587 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3588 |
30 |
@Override... |
3589 |
|
public void overviewMenuItem_actionPerformed(ActionEvent e) |
3590 |
|
{ |
3591 |
30 |
boolean showHiddenRegions = Cache |
3592 |
|
.getDefault(Preferences.SHOW_OV_HIDDEN_AT_START, false); |
3593 |
30 |
openOverviewPanel(showHiddenRegions); |
3594 |
|
} |
3595 |
|
|
|
|
| 90% |
Uncovered Elements: 2 (20) |
Complexity: 3 |
Complexity Density: 0.19 |
|
3596 |
43 |
public OverviewPanel openOverviewPanel(boolean showHidden)... |
3597 |
|
{ |
3598 |
43 |
if (alignPanel.overviewPanel != null) |
3599 |
|
{ |
3600 |
0 |
return alignPanel.overviewPanel; |
3601 |
|
} |
3602 |
43 |
JInternalFrame frame = new JInternalFrame(); |
3603 |
43 |
frame.setFrameIcon(null); |
3604 |
43 |
final OverviewPanel overview = new OverviewPanel(alignPanel, frame, |
3605 |
|
showHidden); |
3606 |
43 |
frame.setContentPane(overview); |
3607 |
|
|
3608 |
43 |
alignPanel.setOverviewPanel(overview); |
3609 |
43 |
alignPanel.setOverviewTitle(this); |
3610 |
|
|
3611 |
43 |
Desktop.addInternalFrame(frame, overview.getTitle(), true, |
3612 |
|
frame.getWidth(), frame.getHeight(), true, true); |
3613 |
43 |
frame.pack(); |
3614 |
43 |
frame.setLayer(JLayeredPane.PALETTE_LAYER); |
3615 |
43 |
final AlignmentPanel thePanel = this.alignPanel; |
3616 |
43 |
frame.addInternalFrameListener( |
3617 |
|
new javax.swing.event.InternalFrameAdapter() |
3618 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3619 |
39 |
@Override... |
3620 |
|
public void internalFrameClosed( |
3621 |
|
javax.swing.event.InternalFrameEvent evt) |
3622 |
|
{ |
3623 |
39 |
overview.dispose(); |
3624 |
39 |
thePanel.setOverviewPanel(null); |
3625 |
|
} |
3626 |
|
}); |
3627 |
43 |
if (getKeyListeners().length > 0) |
3628 |
|
{ |
3629 |
15 |
frame.addKeyListener(getKeyListeners()[0]); |
3630 |
|
} |
3631 |
|
|
3632 |
43 |
return overview; |
3633 |
|
} |
3634 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3635 |
0 |
@Override... |
3636 |
|
public void textColour_actionPerformed() |
3637 |
|
{ |
3638 |
0 |
new TextColourChooser().chooseColour(alignPanel, null); |
3639 |
|
} |
3640 |
|
|
3641 |
|
|
3642 |
|
|
3643 |
|
|
3644 |
|
|
3645 |
|
|
3646 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3647 |
0 |
@Override... |
3648 |
|
public void annotationColour_actionPerformed() |
3649 |
|
{ |
3650 |
0 |
new AnnotationColourChooser(viewport, alignPanel); |
3651 |
|
} |
3652 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3653 |
0 |
@Override... |
3654 |
|
public void annotationColumn_actionPerformed(ActionEvent e) |
3655 |
|
{ |
3656 |
0 |
new AnnotationColumnChooser(viewport, alignPanel); |
3657 |
|
} |
3658 |
|
|
3659 |
|
|
3660 |
|
|
3661 |
|
|
3662 |
|
|
3663 |
|
|
3664 |
|
@param |
3665 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3666 |
3 |
@Override... |
3667 |
|
public void applyToAllGroups_actionPerformed(boolean selected) |
3668 |
|
{ |
3669 |
3 |
viewport.setColourAppliesToAllGroups(selected); |
3670 |
|
} |
3671 |
|
|
3672 |
|
|
3673 |
|
|
3674 |
|
|
3675 |
|
@param |
3676 |
|
|
3677 |
|
|
|
|
| 57.1% |
Uncovered Elements: 3 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
3678 |
15 |
@Override... |
3679 |
|
public void changeColour_actionPerformed(String name) |
3680 |
|
{ |
3681 |
|
|
3682 |
|
|
3683 |
|
|
3684 |
|
|
3685 |
15 |
if (ResidueColourScheme.USER_DEFINED_MENU.equals(name)) |
3686 |
|
{ |
3687 |
0 |
new UserDefinedColours(alignPanel); |
3688 |
0 |
return; |
3689 |
|
} |
3690 |
|
|
3691 |
|
|
3692 |
|
|
3693 |
|
|
3694 |
15 |
ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(name, |
3695 |
|
viewport, viewport.getAlignment(), |
3696 |
|
viewport.getHiddenRepSequences()); |
3697 |
15 |
changeColour(cs); |
3698 |
|
} |
3699 |
|
|
3700 |
|
|
3701 |
|
|
3702 |
|
|
3703 |
|
@param |
3704 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
3705 |
179 |
@Override... |
3706 |
|
public void changeColour(ColourSchemeI cs) |
3707 |
|
{ |
3708 |
|
|
3709 |
179 |
ColourMenuHelper.setColourSelected(colourMenu, cs); |
3710 |
|
|
3711 |
179 |
viewport.setGlobalColourScheme(cs); |
3712 |
|
|
3713 |
179 |
alignPanel.paintAlignment(true, true); |
3714 |
|
} |
3715 |
|
|
3716 |
|
|
3717 |
|
|
3718 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3719 |
6 |
@Override... |
3720 |
|
protected void modifyPID_actionPerformed() |
3721 |
|
{ |
3722 |
6 |
SliderPanel.setPIDSliderSource(alignPanel, viewport.getResidueShading(), |
3723 |
|
alignPanel.getViewName()); |
3724 |
6 |
SliderPanel.showPIDSlider(); |
3725 |
|
} |
3726 |
|
|
3727 |
|
|
3728 |
|
|
3729 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3730 |
6 |
@Override... |
3731 |
|
protected void modifyConservation_actionPerformed() |
3732 |
|
{ |
3733 |
6 |
SliderPanel.setConservationSlider(alignPanel, |
3734 |
|
viewport.getResidueShading(), alignPanel.getViewName()); |
3735 |
6 |
SliderPanel.showConservationSlider(); |
3736 |
|
} |
3737 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
3738 |
0 |
@Override... |
3739 |
|
protected void modifyConsensusSecondaryStructureThreshold_actionPerformed() |
3740 |
|
{ |
3741 |
0 |
SliderPanel.setConsensusSecondaryStructureSlider(alignPanel, |
3742 |
|
viewport.getResidueShading(), alignPanel.getViewName()); |
3743 |
0 |
SliderPanel.showConsensusSecondaryStructureSlider(); |
3744 |
|
} |
3745 |
|
|
3746 |
|
|
3747 |
|
|
3748 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
3749 |
8 |
@Override... |
3750 |
|
public void conservationMenuItem_actionPerformed(boolean selected) |
3751 |
|
{ |
3752 |
8 |
modifyConservation.setEnabled(selected); |
3753 |
8 |
viewport.setConservationSelected(selected); |
3754 |
8 |
viewport.getResidueShading().setConservationApplied(selected); |
3755 |
|
|
3756 |
8 |
changeColour(viewport.getGlobalColourScheme()); |
3757 |
8 |
if (selected) |
3758 |
|
{ |
3759 |
6 |
modifyConservation_actionPerformed(); |
3760 |
|
} |
3761 |
|
else |
3762 |
|
{ |
3763 |
2 |
SliderPanel.hideConservationSlider(); |
3764 |
|
} |
3765 |
|
} |
3766 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
3767 |
0 |
@Override... |
3768 |
|
public void colourByConsensusSecondaryStructureMenuItem_actionPerformed( |
3769 |
|
boolean selected) |
3770 |
|
{ |
3771 |
0 |
modifyConsensusSecondaryStructureThreshold.setEnabled(selected); |
3772 |
0 |
viewport.setByConsensusSecondaryStructureSelected(selected); |
3773 |
0 |
viewport.getResidueShading() |
3774 |
|
.setConsensusSecondaryStructureColouring(selected); |
3775 |
|
|
3776 |
0 |
changeColour(viewport.getGlobalColourScheme()); |
3777 |
0 |
if (selected) |
3778 |
|
{ |
3779 |
0 |
modifyConsensusSecondaryStructureThreshold_actionPerformed(); |
3780 |
|
} |
3781 |
|
else |
3782 |
|
{ |
3783 |
0 |
SliderPanel.hideConsensusSecondaryStructureSlider(); |
3784 |
|
} |
3785 |
|
} |
3786 |
|
|
3787 |
|
|
3788 |
|
|
3789 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
3790 |
9 |
@Override... |
3791 |
|
public void abovePIDThreshold_actionPerformed(boolean selected) |
3792 |
|
{ |
3793 |
9 |
modifyPID.setEnabled(selected); |
3794 |
9 |
viewport.setAbovePIDThreshold(selected); |
3795 |
9 |
if (!selected) |
3796 |
|
{ |
3797 |
3 |
viewport.getResidueShading().setThreshold(0, |
3798 |
|
viewport.isIgnoreGapsConsensus()); |
3799 |
|
} |
3800 |
|
|
3801 |
9 |
changeColour(viewport.getGlobalColourScheme()); |
3802 |
9 |
if (selected) |
3803 |
|
{ |
3804 |
6 |
modifyPID_actionPerformed(); |
3805 |
|
} |
3806 |
|
else |
3807 |
|
{ |
3808 |
3 |
SliderPanel.hidePIDSlider(); |
3809 |
|
} |
3810 |
|
} |
3811 |
|
|
3812 |
|
|
3813 |
|
|
3814 |
|
|
3815 |
|
@param |
3816 |
|
|
3817 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
3818 |
0 |
@Override... |
3819 |
|
public void sortPairwiseMenuItem_actionPerformed(ActionEvent e) |
3820 |
|
{ |
3821 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
3822 |
0 |
AlignmentSorter.sortByPID(viewport.getAlignment(), |
3823 |
|
viewport.getAlignment().getSequenceAt(0)); |
3824 |
0 |
addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder, |
3825 |
|
viewport.getAlignment())); |
3826 |
0 |
alignPanel.paintAlignment(true, false); |
3827 |
|
} |
3828 |
|
|
3829 |
|
|
3830 |
|
|
3831 |
|
|
3832 |
|
@param |
3833 |
|
|
3834 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
3835 |
0 |
@Override... |
3836 |
|
public void sortIDMenuItem_actionPerformed(ActionEvent e) |
3837 |
|
{ |
3838 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
3839 |
0 |
AlignmentSorter.sortByID(viewport.getAlignment()); |
3840 |
0 |
addHistoryItem( |
3841 |
|
new OrderCommand("ID Sort", oldOrder, viewport.getAlignment())); |
3842 |
0 |
alignPanel.paintAlignment(true, false); |
3843 |
|
} |
3844 |
|
|
3845 |
|
|
3846 |
|
|
3847 |
|
|
3848 |
|
@param |
3849 |
|
|
3850 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
3851 |
0 |
@Override... |
3852 |
|
public void sortLengthMenuItem_actionPerformed(ActionEvent e) |
3853 |
|
{ |
3854 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
3855 |
0 |
AlignmentSorter.sortByLength(viewport.getAlignment()); |
3856 |
0 |
addHistoryItem(new OrderCommand("Length Sort", oldOrder, |
3857 |
|
viewport.getAlignment())); |
3858 |
0 |
alignPanel.paintAlignment(true, false); |
3859 |
|
} |
3860 |
|
|
3861 |
|
|
3862 |
|
|
3863 |
|
|
3864 |
|
@param |
3865 |
|
|
3866 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
3867 |
0 |
@Override... |
3868 |
|
public void sortGroupMenuItem_actionPerformed(ActionEvent e) |
3869 |
|
{ |
3870 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
3871 |
0 |
AlignmentSorter.sortByGroup(viewport.getAlignment()); |
3872 |
0 |
addHistoryItem(new OrderCommand("Group Sort", oldOrder, |
3873 |
|
viewport.getAlignment())); |
3874 |
|
|
3875 |
0 |
alignPanel.paintAlignment(true, false); |
3876 |
|
} |
3877 |
|
|
3878 |
|
|
3879 |
|
|
3880 |
|
|
3881 |
|
@param |
3882 |
|
|
3883 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3884 |
0 |
@Override... |
3885 |
|
public void removeRedundancyMenuItem_actionPerformed(ActionEvent e) |
3886 |
|
{ |
3887 |
0 |
new RedundancyPanel(alignPanel, this); |
3888 |
|
} |
3889 |
|
|
3890 |
|
|
3891 |
|
|
3892 |
|
|
3893 |
|
@param |
3894 |
|
|
3895 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
3896 |
0 |
@Override... |
3897 |
|
public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e) |
3898 |
|
{ |
3899 |
0 |
if ((viewport.getSelectionGroup() == null) |
3900 |
|
|| (viewport.getSelectionGroup().getSize() < 2)) |
3901 |
|
{ |
3902 |
0 |
JvOptionPane.showInternalMessageDialog(this, |
3903 |
|
MessageManager.getString( |
3904 |
|
"label.you_must_select_least_two_sequences"), |
3905 |
|
MessageManager.getString("label.invalid_selection"), |
3906 |
|
JvOptionPane.WARNING_MESSAGE); |
3907 |
|
} |
3908 |
|
else |
3909 |
|
{ |
3910 |
0 |
new Thread(new Runnable() |
3911 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
3912 |
0 |
@Override... |
3913 |
|
public void run() |
3914 |
|
{ |
3915 |
0 |
JInternalFrame frame = new JInternalFrame(); |
3916 |
0 |
frame.setFrameIcon(null); |
3917 |
0 |
frame.setContentPane(new PairwiseAlignPanel(viewport)); |
3918 |
0 |
Desktop.addInternalFrame(frame, |
3919 |
|
MessageManager.getString("action.pairwise_alignment"), |
3920 |
|
600, 500); |
3921 |
|
} |
3922 |
|
}).start(); |
3923 |
|
|
3924 |
|
} |
3925 |
|
} |
3926 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
3927 |
0 |
@Override... |
3928 |
|
public void autoCalculate_actionPerformed(ActionEvent e) |
3929 |
|
{ |
3930 |
0 |
viewport.autoCalculateConsensus = autoCalculate.isSelected(); |
3931 |
0 |
if (viewport.autoCalculateConsensus) |
3932 |
|
{ |
3933 |
0 |
viewport.firePropertyChange("alignment", null, |
3934 |
|
viewport.getAlignment().getSequences()); |
3935 |
|
} |
3936 |
|
} |
3937 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3938 |
0 |
@Override... |
3939 |
|
public void sortByTreeOption_actionPerformed(ActionEvent e) |
3940 |
|
{ |
3941 |
0 |
viewport.sortByTree = sortByTree.isSelected(); |
3942 |
|
} |
3943 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3944 |
0 |
@Override... |
3945 |
|
protected void listenToViewSelections_actionPerformed(ActionEvent e) |
3946 |
|
{ |
3947 |
0 |
viewport.followSelection = listenToViewSelections.isSelected(); |
3948 |
|
} |
3949 |
|
|
3950 |
|
|
3951 |
|
|
3952 |
|
|
3953 |
|
@param |
3954 |
|
|
3955 |
|
@param |
3956 |
|
|
3957 |
|
@param |
3958 |
|
|
3959 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 5 |
Complexity Density: 0.33 |
|
3960 |
0 |
void newTreePanel(String type, String modelName,... |
3961 |
|
SimilarityParamsI options) |
3962 |
|
{ |
3963 |
0 |
String frameTitle = ""; |
3964 |
0 |
TreePanel tp; |
3965 |
|
|
3966 |
0 |
boolean onSelection = false; |
3967 |
0 |
if (viewport.getSelectionGroup() != null |
3968 |
|
&& viewport.getSelectionGroup().getSize() > 0) |
3969 |
|
{ |
3970 |
0 |
SequenceGroup sg = viewport.getSelectionGroup(); |
3971 |
|
|
3972 |
|
|
3973 |
0 |
for (SequenceI _s : sg.getSequences()) |
3974 |
|
{ |
3975 |
0 |
if (_s.getLength() < sg.getEndRes()) |
3976 |
|
{ |
3977 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, |
3978 |
|
MessageManager.getString( |
3979 |
|
"label.selected_region_to_tree_may_only_contain_residues_or_gaps"), |
3980 |
|
MessageManager.getString( |
3981 |
|
"label.sequences_selection_not_aligned"), |
3982 |
|
JvOptionPane.WARNING_MESSAGE); |
3983 |
|
|
3984 |
0 |
return; |
3985 |
|
} |
3986 |
|
} |
3987 |
0 |
onSelection = true; |
3988 |
|
} |
3989 |
|
else |
3990 |
|
{ |
3991 |
0 |
if (viewport.getAlignment().getHeight() < 2) |
3992 |
|
{ |
3993 |
0 |
return; |
3994 |
|
} |
3995 |
|
} |
3996 |
|
|
3997 |
0 |
tp = new TreePanel(alignPanel, type, modelName, options); |
3998 |
|
|
3999 |
0 |
frameTitle = formCalculationTitle(tp.getPanelTitle(), onSelection, |
4000 |
|
this.title); |
4001 |
|
|
4002 |
0 |
Desktop.addInternalFrame(tp, frameTitle, 600, 500); |
4003 |
|
} |
4004 |
|
|
4005 |
|
|
4006 |
|
|
4007 |
|
@param |
4008 |
|
|
4009 |
|
@param |
4010 |
|
|
4011 |
|
@param |
4012 |
|
|
4013 |
|
@param |
4014 |
|
|
4015 |
|
@return |
4016 |
|
|
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
4017 |
2 |
public String formCalculationTitle(String panelTitle, boolean onSelection,... |
4018 |
|
String title) |
4019 |
|
{ |
4020 |
2 |
String frameTitle = panelTitle; |
4021 |
|
|
4022 |
2 |
frameTitle += (onSelection ? " on region" : ""); |
4023 |
|
|
4024 |
2 |
frameTitle += " from "; |
4025 |
|
|
4026 |
2 |
if (viewport.getViewName() != null) |
4027 |
|
{ |
4028 |
2 |
frameTitle += viewport.getViewName() + " of "; |
4029 |
|
} |
4030 |
|
|
4031 |
2 |
frameTitle += title; |
4032 |
2 |
return frameTitle; |
4033 |
|
} |
4034 |
|
|
4035 |
|
|
4036 |
|
|
4037 |
|
|
4038 |
|
@param |
4039 |
|
|
4040 |
|
@param |
4041 |
|
|
4042 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
4043 |
0 |
public void addSortByOrderMenuItem(String title,... |
4044 |
|
final AlignmentOrder order) |
4045 |
|
{ |
4046 |
0 |
final JMenuItem item = new JMenuItem(MessageManager |
4047 |
|
.formatMessage("action.by_title_param", new Object[] |
4048 |
|
{ title })); |
4049 |
0 |
sort.add(item); |
4050 |
0 |
item.addActionListener(new java.awt.event.ActionListener() |
4051 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
4052 |
0 |
@Override... |
4053 |
|
public void actionPerformed(ActionEvent e) |
4054 |
|
{ |
4055 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
4056 |
|
|
4057 |
|
|
4058 |
|
|
4059 |
0 |
AlignmentSorter.sortBy(viewport.getAlignment(), order); |
4060 |
|
|
4061 |
0 |
addHistoryItem(new OrderCommand(order.getName(), oldOrder, |
4062 |
|
viewport.getAlignment())); |
4063 |
|
|
4064 |
0 |
alignPanel.paintAlignment(true, false); |
4065 |
|
} |
4066 |
|
}); |
4067 |
|
} |
4068 |
|
|
4069 |
|
|
4070 |
|
|
4071 |
|
|
4072 |
|
@param |
4073 |
|
|
4074 |
|
@param |
4075 |
|
|
4076 |
|
|
4077 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
4078 |
4 |
public void addSortByAnnotScoreMenuItem(JMenu sort,... |
4079 |
|
final String scoreLabel) |
4080 |
|
{ |
4081 |
4 |
final JMenuItem item = new JMenuItem(scoreLabel); |
4082 |
4 |
sort.add(item); |
4083 |
4 |
item.addActionListener(new java.awt.event.ActionListener() |
4084 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
4085 |
0 |
@Override... |
4086 |
|
public void actionPerformed(ActionEvent e) |
4087 |
|
{ |
4088 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
4089 |
0 |
AlignmentSorter.sortByAnnotationScore(scoreLabel, |
4090 |
|
viewport.getAlignment()); |
4091 |
0 |
addHistoryItem(new OrderCommand("Sort by " + scoreLabel, oldOrder, |
4092 |
|
viewport.getAlignment())); |
4093 |
0 |
alignPanel.paintAlignment(true, false); |
4094 |
|
} |
4095 |
|
}); |
4096 |
|
} |
4097 |
|
|
4098 |
|
|
4099 |
|
|
4100 |
|
|
4101 |
|
|
4102 |
|
protected int _annotationScoreVectorHash; |
4103 |
|
|
4104 |
|
|
4105 |
|
|
4106 |
|
|
4107 |
|
|
4108 |
|
|
4109 |
|
|
|
|
| 92.6% |
Uncovered Elements: 2 (27) |
Complexity: 8 |
Complexity Density: 0.47 |
|
4110 |
457 |
@Override... |
4111 |
|
public void buildSortByAnnotationScoresMenu() |
4112 |
|
{ |
4113 |
457 |
if (viewport.getAlignment().getAlignmentAnnotation() == null) |
4114 |
|
{ |
4115 |
0 |
return; |
4116 |
|
} |
4117 |
|
|
4118 |
457 |
if (viewport.getAlignment().getAlignmentAnnotation() |
4119 |
|
.hashCode() != _annotationScoreVectorHash) |
4120 |
|
{ |
4121 |
456 |
sortByAnnotScore.removeAll(); |
4122 |
|
|
4123 |
456 |
Hashtable<String, String> scoreSorts = new Hashtable<>(); |
4124 |
456 |
AlignmentAnnotation aann[]; |
4125 |
456 |
for (SequenceI sqa : viewport.getAlignment().getSequences()) |
4126 |
|
{ |
4127 |
4095 |
aann = sqa.getAnnotation(); |
4128 |
4399 |
for (int i = 0; aann != null && i < aann.length; i++) |
4129 |
|
{ |
4130 |
304 |
if (aann[i].hasScore() && aann[i].sequenceRef != null) |
4131 |
|
{ |
4132 |
152 |
scoreSorts.put(aann[i].label, aann[i].label); |
4133 |
|
} |
4134 |
|
} |
4135 |
|
} |
4136 |
456 |
Enumeration<String> labels = scoreSorts.keys(); |
4137 |
460 |
while (labels.hasMoreElements()) |
4138 |
|
{ |
4139 |
4 |
addSortByAnnotScoreMenuItem(sortByAnnotScore, labels.nextElement()); |
4140 |
|
} |
4141 |
456 |
sortByAnnotScore.setVisible(scoreSorts.size() > 0); |
4142 |
456 |
scoreSorts.clear(); |
4143 |
|
|
4144 |
456 |
_annotationScoreVectorHash = viewport.getAlignment() |
4145 |
|
.getAlignmentAnnotation().hashCode(); |
4146 |
|
} |
4147 |
|
} |
4148 |
|
|
4149 |
|
|
4150 |
|
|
4151 |
|
|
4152 |
|
|
4153 |
|
|
4154 |
|
|
4155 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 3 |
Complexity Density: 0.21 |
|
4156 |
0 |
@Override... |
4157 |
|
public void buildTreeSortMenu() |
4158 |
|
{ |
4159 |
0 |
sortByTreeMenu.removeAll(); |
4160 |
|
|
4161 |
0 |
List<Component> comps = PaintRefresher.components |
4162 |
|
.get(viewport.getSequenceSetId()); |
4163 |
0 |
List<TreePanel> treePanels = new ArrayList<>(); |
4164 |
0 |
for (Component comp : comps) |
4165 |
|
{ |
4166 |
0 |
if (comp instanceof TreePanel) |
4167 |
|
{ |
4168 |
0 |
treePanels.add((TreePanel) comp); |
4169 |
|
} |
4170 |
|
} |
4171 |
|
|
4172 |
0 |
if (treePanels.size() < 1) |
4173 |
|
{ |
4174 |
0 |
sortByTreeMenu.setVisible(false); |
4175 |
0 |
return; |
4176 |
|
} |
4177 |
|
|
4178 |
0 |
sortByTreeMenu.setVisible(true); |
4179 |
|
|
4180 |
0 |
for (final TreePanel tp : treePanels) |
4181 |
|
{ |
4182 |
0 |
final JMenuItem item = new JMenuItem(tp.getTitle()); |
4183 |
0 |
item.addActionListener(new java.awt.event.ActionListener() |
4184 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
4185 |
0 |
@Override... |
4186 |
|
public void actionPerformed(ActionEvent e) |
4187 |
|
{ |
4188 |
0 |
tp.sortByTree_actionPerformed(); |
4189 |
0 |
addHistoryItem(tp.sortAlignmentIn(alignPanel)); |
4190 |
|
|
4191 |
|
} |
4192 |
|
}); |
4193 |
|
|
4194 |
0 |
sortByTreeMenu.add(item); |
4195 |
|
} |
4196 |
|
} |
4197 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
4198 |
0 |
public boolean sortBy(AlignmentOrder alorder, String undoname)... |
4199 |
|
{ |
4200 |
0 |
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); |
4201 |
0 |
AlignmentSorter.sortBy(viewport.getAlignment(), alorder); |
4202 |
0 |
if (undoname != null) |
4203 |
|
{ |
4204 |
0 |
addHistoryItem(new OrderCommand(undoname, oldOrder, |
4205 |
|
viewport.getAlignment())); |
4206 |
|
} |
4207 |
0 |
alignPanel.paintAlignment(true, false); |
4208 |
0 |
return true; |
4209 |
|
} |
4210 |
|
|
4211 |
|
|
4212 |
|
|
4213 |
|
|
4214 |
|
|
4215 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 6 |
Complexity Density: 0.67 |
|
4216 |
0 |
public jalview.datamodel.AlignmentView gatherSequencesForAlignment()... |
4217 |
|
{ |
4218 |
|
|
4219 |
0 |
AlignmentView msa = null; |
4220 |
|
|
4221 |
0 |
if ((viewport.getSelectionGroup() != null) |
4222 |
|
&& (viewport.getSelectionGroup().getSize() > 1)) |
4223 |
|
{ |
4224 |
|
|
4225 |
|
|
4226 |
|
|
4227 |
|
|
4228 |
|
|
4229 |
|
|
4230 |
|
|
4231 |
|
|
4232 |
|
|
4233 |
0 |
msa = viewport.getAlignmentView(true); |
4234 |
|
} |
4235 |
0 |
else if (viewport.getSelectionGroup() != null |
4236 |
|
&& viewport.getSelectionGroup().getSize() == 1) |
4237 |
|
{ |
4238 |
0 |
int option = JvOptionPane.showConfirmDialog(this, |
4239 |
|
MessageManager.getString("warn.oneseq_msainput_selection"), |
4240 |
|
MessageManager.getString("label.invalid_selection"), |
4241 |
|
JvOptionPane.OK_CANCEL_OPTION); |
4242 |
0 |
if (option == JvOptionPane.OK_OPTION) |
4243 |
|
{ |
4244 |
0 |
msa = viewport.getAlignmentView(false); |
4245 |
|
} |
4246 |
|
} |
4247 |
|
else |
4248 |
|
{ |
4249 |
0 |
msa = viewport.getAlignmentView(false); |
4250 |
|
} |
4251 |
0 |
return msa; |
4252 |
|
} |
4253 |
|
|
4254 |
|
|
4255 |
|
|
4256 |
|
|
4257 |
|
|
4258 |
|
|
4259 |
|
|
4260 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 4 |
Complexity Density: 0.57 |
|
4261 |
0 |
public AlignmentView gatherSeqOrMsaForSecStrPrediction()... |
4262 |
|
{ |
4263 |
0 |
AlignmentView seqs = null; |
4264 |
|
|
4265 |
0 |
if ((viewport.getSelectionGroup() != null) |
4266 |
|
&& (viewport.getSelectionGroup().getSize() > 0)) |
4267 |
|
{ |
4268 |
0 |
seqs = viewport.getAlignmentView(true); |
4269 |
|
} |
4270 |
|
else |
4271 |
|
{ |
4272 |
0 |
seqs = viewport.getAlignmentView(false); |
4273 |
|
} |
4274 |
|
|
4275 |
|
|
4276 |
|
|
4277 |
|
|
4278 |
0 |
if (!viewport.getAlignment().isAligned(false)) |
4279 |
|
{ |
4280 |
0 |
seqs.setSequences(new SeqCigar[] { seqs.getSequences()[0] }); |
4281 |
|
|
4282 |
|
|
4283 |
|
|
4284 |
|
} |
4285 |
0 |
return seqs; |
4286 |
|
} |
4287 |
|
|
4288 |
|
|
4289 |
|
|
4290 |
|
|
4291 |
|
|
4292 |
|
|
4293 |
|
|
4294 |
|
|
4295 |
|
@param |
4296 |
|
|
4297 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.25 |
|
4298 |
0 |
@Override... |
4299 |
|
protected void loadTreeMenuItem_actionPerformed(ActionEvent e) |
4300 |
|
{ |
4301 |
|
|
4302 |
0 |
JalviewFileChooser chooser = new JalviewFileChooser( |
4303 |
|
Cache.getProperty("LAST_DIRECTORY")); |
4304 |
0 |
chooser.setFileView(new JalviewFileView()); |
4305 |
0 |
chooser.setDialogTitle( |
4306 |
|
MessageManager.getString("label.select_newick_like_tree_file")); |
4307 |
0 |
chooser.setToolTipText( |
4308 |
|
MessageManager.getString("label.load_tree_file")); |
4309 |
|
|
4310 |
0 |
chooser.setResponseHandler(0, () -> { |
4311 |
0 |
String filePath = chooser.getSelectedFile().getPath(); |
4312 |
0 |
Cache.setProperty("LAST_DIRECTORY", filePath); |
4313 |
0 |
NewickFile fin = null; |
4314 |
0 |
try |
4315 |
|
{ |
4316 |
0 |
fin = new NewickFile(new FileParse(chooser.getSelectedFile(), |
4317 |
|
DataSourceType.FILE)); |
4318 |
0 |
viewport.setCurrentTree(showNewickTree(fin, filePath).getTree()); |
4319 |
|
} catch (Exception ex) |
4320 |
|
{ |
4321 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, ex.getMessage(), |
4322 |
|
MessageManager.getString("label.problem_reading_tree_file"), |
4323 |
|
JvOptionPane.WARNING_MESSAGE); |
4324 |
0 |
ex.printStackTrace(); |
4325 |
|
} |
4326 |
0 |
if (fin != null && fin.hasWarningMessage()) |
4327 |
|
{ |
4328 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, |
4329 |
|
fin.getWarningMessage(), |
4330 |
|
MessageManager |
4331 |
|
.getString("label.possible_problem_with_tree_file"), |
4332 |
|
JvOptionPane.WARNING_MESSAGE); |
4333 |
|
} |
4334 |
|
}); |
4335 |
0 |
chooser.showOpenDialog(this); |
4336 |
|
} |
4337 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
4338 |
2 |
public TreePanel showNewickTree(NewickFile nf, String treeTitle)... |
4339 |
|
{ |
4340 |
2 |
return showNewickTree(nf, treeTitle, 600, 500, 4, 5); |
4341 |
|
} |
4342 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
4343 |
14 |
public TreePanel showNewickTree(NewickFile nf, String treeTitle, int w,... |
4344 |
|
int h, int x, int y) |
4345 |
|
{ |
4346 |
14 |
return showNewickTree(nf, treeTitle, null, w, h, x, y); |
4347 |
|
} |
4348 |
|
|
4349 |
|
|
4350 |
|
|
4351 |
|
|
4352 |
|
|
4353 |
|
@param |
4354 |
|
|
4355 |
|
@param |
4356 |
|
|
4357 |
|
@param |
4358 |
|
|
4359 |
|
@param |
4360 |
|
|
4361 |
|
@param |
4362 |
|
|
4363 |
|
@param |
4364 |
|
|
4365 |
|
@param |
4366 |
|
|
4367 |
|
@return |
4368 |
|
|
|
|
| 80% |
Uncovered Elements: 3 (15) |
Complexity: 5 |
Complexity Density: 0.45 |
|
4369 |
14 |
public TreePanel showNewickTree(NewickFile nf, String treeTitle,... |
4370 |
|
AlignmentView input, int w, int h, int x, int y) |
4371 |
|
{ |
4372 |
14 |
TreePanel tp = null; |
4373 |
|
|
4374 |
14 |
try |
4375 |
|
{ |
4376 |
14 |
nf.parse(); |
4377 |
|
|
4378 |
14 |
if (nf.getTree() != null) |
4379 |
|
{ |
4380 |
14 |
tp = new TreePanel(alignPanel, nf, treeTitle, input); |
4381 |
|
|
4382 |
14 |
tp.setSize(w, h); |
4383 |
|
|
4384 |
14 |
if (x > 0 && y > 0) |
4385 |
|
{ |
4386 |
14 |
tp.setLocation(x, y); |
4387 |
|
} |
4388 |
|
|
4389 |
14 |
Desktop.addInternalFrame(tp, treeTitle, w, h); |
4390 |
|
} |
4391 |
|
} catch (Exception ex) |
4392 |
|
{ |
4393 |
0 |
ex.printStackTrace(); |
4394 |
|
} |
4395 |
|
|
4396 |
14 |
return tp; |
4397 |
|
} |
4398 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.45 |
|
4399 |
0 |
public TreePanel showNewickTreeForAnnotation(NewickFile nf,... |
4400 |
|
String treeTitle, AlignmentView input, int w, int h, int x, int y) |
4401 |
|
{ |
4402 |
0 |
TreePanel tp = null; |
4403 |
|
|
4404 |
0 |
try |
4405 |
|
{ |
4406 |
0 |
nf.parse(); |
4407 |
|
|
4408 |
0 |
if (nf.getTree() != null) |
4409 |
|
{ |
4410 |
0 |
tp = TreePanel.newTreeForAnnotations(alignPanel, nf, treeTitle, |
4411 |
|
input); |
4412 |
|
|
4413 |
0 |
tp.setSize(w, h); |
4414 |
|
|
4415 |
0 |
if (x > 0 && y > 0) |
4416 |
|
{ |
4417 |
0 |
tp.setLocation(x, y); |
4418 |
|
} |
4419 |
|
|
4420 |
0 |
Desktop.addInternalFrame(tp, treeTitle, w, h); |
4421 |
|
} |
4422 |
|
} catch (Exception ex) |
4423 |
|
{ |
4424 |
0 |
ex.printStackTrace(); |
4425 |
|
} |
4426 |
|
|
4427 |
0 |
return tp; |
4428 |
|
} |
4429 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
4430 |
0 |
public void showContactMapTree(AlignmentAnnotation aa, ContactMatrixI cm)... |
4431 |
|
{ |
4432 |
0 |
int x = 4, y = 5; |
4433 |
0 |
int w = 400, h = 500; |
4434 |
|
|
4435 |
0 |
try |
4436 |
|
{ |
4437 |
0 |
NewickFile fin = new NewickFile( |
4438 |
|
new FileParse(cm.getNewick(), DataSourceType.PASTE)); |
4439 |
0 |
String title = aa.label + " " + cm.getTreeMethod() + " tree" |
4440 |
0 |
+ (aa.sequenceRef != null |
4441 |
|
? (" for " + aa.sequenceRef.getDisplayId(false)) |
4442 |
|
: ""); |
4443 |
|
|
4444 |
0 |
showColumnWiseTree(fin, aa, title, w, h, x, y); |
4445 |
|
} catch (Throwable xx) |
4446 |
|
{ |
4447 |
0 |
Console.error("Unexpected exception showing tree for contact matrix", |
4448 |
|
xx); |
4449 |
|
} |
4450 |
|
} |
4451 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 5 |
Complexity Density: 0.42 |
|
4452 |
0 |
public TreePanel showColumnWiseTree(NewickFile nf, AlignmentAnnotation aa,... |
4453 |
|
String treeTitle, int w, int h, int x, int y) |
4454 |
|
{ |
4455 |
0 |
try |
4456 |
|
{ |
4457 |
0 |
nf.parse(); |
4458 |
0 |
if (nf.getTree() == null) |
4459 |
|
{ |
4460 |
0 |
return null; |
4461 |
|
} |
4462 |
0 |
TreePanel tp = new TreePanel(alignPanel, nf, aa, treeTitle); |
4463 |
|
|
4464 |
0 |
tp.setSize(w, h); |
4465 |
|
|
4466 |
0 |
if (x > 0 && y > 0) |
4467 |
|
{ |
4468 |
0 |
tp.setLocation(x, y); |
4469 |
|
} |
4470 |
|
|
4471 |
0 |
Desktop.addInternalFrame(tp, treeTitle, w, h); |
4472 |
0 |
return tp; |
4473 |
|
} catch (Throwable xx) |
4474 |
|
{ |
4475 |
0 |
Console.error("Unexpected exception showing tree for contact matrix", |
4476 |
|
xx); |
4477 |
|
} |
4478 |
0 |
return null; |
4479 |
|
} |
4480 |
|
|
4481 |
|
|
4482 |
|
|
4483 |
|
|
4484 |
|
private boolean buildingMenu = false; |
4485 |
|
|
4486 |
|
|
4487 |
|
|
4488 |
|
|
4489 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
4490 |
2204 |
public void BuildWebServiceMenu()... |
4491 |
|
{ |
4492 |
2205 |
while (buildingMenu) |
4493 |
|
{ |
4494 |
1 |
try |
4495 |
|
{ |
4496 |
1 |
jalview.bin.Console |
4497 |
|
.errPrintln("Waiting for building menu to finish."); |
4498 |
1 |
Thread.sleep(10); |
4499 |
|
} catch (Exception e) |
4500 |
|
{ |
4501 |
|
} |
4502 |
|
} |
4503 |
2204 |
final AlignFrame me = this; |
4504 |
2204 |
buildingMenu = true; |
4505 |
2204 |
new Thread(new Runnable() |
4506 |
|
{ |
|
|
| 94.1% |
Uncovered Elements: 2 (34) |
Complexity: 7 |
Complexity Density: 0.27 |
|
4507 |
2204 |
@Override... |
4508 |
|
public void run() |
4509 |
|
{ |
4510 |
2204 |
final List<JMenuItem> legacyItems = new ArrayList<>(); |
4511 |
2204 |
try |
4512 |
|
{ |
4513 |
|
|
4514 |
|
|
4515 |
|
|
4516 |
|
|
4517 |
|
|
4518 |
|
|
4519 |
|
|
4520 |
|
|
4521 |
|
|
4522 |
|
|
4523 |
|
|
4524 |
|
|
4525 |
2204 |
final Vector<JMenu> wsmenu = new Vector<>(); |
4526 |
2204 |
final IProgressIndicator af = me; |
4527 |
|
|
4528 |
|
|
4529 |
|
|
4530 |
|
|
4531 |
|
|
4532 |
|
|
4533 |
2204 |
final JMenu msawsmenu = new JMenu("Alignment"); |
4534 |
2204 |
final JMenu secstrmenu = new JMenu( |
4535 |
|
"Secondary Structure Prediction"); |
4536 |
2204 |
final JMenu seqsrchmenu = new JMenu("Sequence Database Search"); |
4537 |
2204 |
final JMenu analymenu = new JMenu("Analysis"); |
4538 |
2204 |
final JMenu dismenu = new JMenu("Protein Disorder"); |
4539 |
|
|
4540 |
|
|
4541 |
2204 |
if ( |
4542 |
|
|
4543 |
2204 |
Discoverer.services != null && (Discoverer.services.size() > 0)) |
4544 |
|
{ |
4545 |
|
|
4546 |
|
|
4547 |
|
|
4548 |
|
|
4549 |
|
|
4550 |
|
|
4551 |
2204 |
Vector<ServiceHandle> secstrpr = Discoverer.services |
4552 |
|
.get("SecStrPred"); |
4553 |
2204 |
if (secstrpr != null) |
4554 |
|
{ |
4555 |
|
|
4556 |
4408 |
for (int i = 0, j = secstrpr.size(); i < j; i++) |
4557 |
|
{ |
4558 |
2204 |
final ext.vamsas.ServiceHandle sh = secstrpr.get(i); |
4559 |
2204 |
jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer |
4560 |
|
.getServiceClient(sh); |
4561 |
2204 |
int p = secstrmenu.getItemCount(); |
4562 |
2203 |
impl.attachWSMenuEntry(secstrmenu, me); |
4563 |
2204 |
int q = secstrmenu.getItemCount(); |
4564 |
4408 |
for (int litm = p; litm < q; litm++) |
4565 |
|
{ |
4566 |
2204 |
legacyItems.add(secstrmenu.getItem(litm)); |
4567 |
|
} |
4568 |
|
} |
4569 |
|
} |
4570 |
|
} |
4571 |
|
|
4572 |
|
|
4573 |
|
|
4574 |
2204 |
wsmenu.add(msawsmenu); |
4575 |
2204 |
wsmenu.add(secstrmenu); |
4576 |
2204 |
wsmenu.add(dismenu); |
4577 |
2204 |
wsmenu.add(analymenu); |
4578 |
|
|
4579 |
|
|
4580 |
|
|
4581 |
2204 |
javax.swing.SwingUtilities.invokeLater(new Runnable() |
4582 |
|
{ |
|
|
| 74.5% |
Uncovered Elements: 12 (47) |
Complexity: 10 |
Complexity Density: 0.32 |
|
4583 |
2204 |
@Override... |
4584 |
|
public void run() |
4585 |
|
{ |
4586 |
2204 |
try |
4587 |
|
{ |
4588 |
2204 |
webService.removeAll(); |
4589 |
|
|
4590 |
2204 |
if (wsmenu.size() > 0) |
4591 |
|
{ |
4592 |
11020 |
for (int i = 0, j = wsmenu.size(); i < j; i++) |
4593 |
|
{ |
4594 |
8816 |
webService.add(wsmenu.get(i)); |
4595 |
|
} |
4596 |
|
} |
4597 |
|
else |
4598 |
|
{ |
4599 |
0 |
webService.add(me.webServiceNoServices); |
4600 |
|
} |
4601 |
|
|
4602 |
|
{ |
4603 |
|
|
4604 |
|
|
4605 |
|
|
4606 |
|
|
4607 |
|
|
4608 |
|
|
4609 |
|
|
4610 |
|
|
4611 |
2204 |
Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer(); |
4612 |
2204 |
if (jws2servs != null) |
4613 |
|
{ |
4614 |
2204 |
if (jws2servs.hasServices()) |
4615 |
|
{ |
4616 |
1286 |
jws2servs.attachWSMenuEntry(webService, me); |
4617 |
1283 |
for (Jws2Instance sv : jws2servs.getServices()) |
4618 |
|
{ |
4619 |
2808 |
if (sv.description.toLowerCase(Locale.ROOT) |
4620 |
|
.contains("jpred")) |
4621 |
|
{ |
4622 |
0 |
for (JMenuItem jmi : legacyItems) |
4623 |
|
{ |
4624 |
0 |
jmi.setVisible(false); |
4625 |
|
} |
4626 |
|
} |
4627 |
|
} |
4628 |
|
} |
4629 |
|
|
4630 |
2201 |
if (jws2servs.isRunning()) |
4631 |
|
{ |
4632 |
422 |
JMenuItem tm = new JMenuItem( |
4633 |
|
"Still discovering JABA Services"); |
4634 |
422 |
tm.setEnabled(false); |
4635 |
422 |
webService.add(tm); |
4636 |
|
} |
4637 |
1779 |
else if (!Cache.getDefault("SHOW_JWS2_SERVICES", true)) |
4638 |
|
{ |
4639 |
0 |
JMenuItem enableJws2 = new JMenuItem( |
4640 |
|
"Discover Web Services"); |
4641 |
0 |
enableJws2.setToolTipText( |
4642 |
|
"Select to start JABA Web Service discovery (or enable option in Web Service preferences)"); |
4643 |
0 |
enableJws2.setEnabled(true); |
4644 |
0 |
enableJws2.addActionListener(new ActionListener() |
4645 |
|
{ |
4646 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
4647 |
0 |
@Override... |
4648 |
|
public void actionPerformed(ActionEvent e) |
4649 |
|
{ |
4650 |
|
|
4651 |
0 |
Desktop.instance.startServiceDiscovery(false, |
4652 |
|
true); |
4653 |
|
} |
4654 |
|
}); |
4655 |
0 |
webService.add(enableJws2); |
4656 |
|
} |
4657 |
|
} |
4658 |
|
} |
4659 |
2201 |
build_urlServiceMenu(me.webService); |
4660 |
2201 |
build_fetchdbmenu(webService); |
4661 |
2201 |
for (JMenu item : wsmenu) |
4662 |
|
{ |
4663 |
8804 |
if (item.getItemCount() == 0) |
4664 |
|
{ |
4665 |
3097 |
item.setEnabled(false); |
4666 |
|
} |
4667 |
|
else |
4668 |
|
{ |
4669 |
5707 |
item.setEnabled(true); |
4670 |
|
} |
4671 |
|
} |
4672 |
|
} catch (Exception e) |
4673 |
|
{ |
4674 |
3 |
Console.debug( |
4675 |
|
"Exception during web service menu building process.", |
4676 |
|
e); |
4677 |
|
} |
4678 |
|
} |
4679 |
|
}); |
4680 |
|
} catch (Exception e) |
4681 |
|
{ |
4682 |
|
} |
4683 |
2204 |
buildingMenu = false; |
4684 |
|
} |
4685 |
|
}).start(); |
4686 |
|
|
4687 |
|
} |
4688 |
|
|
4689 |
|
|
4690 |
|
|
4691 |
|
|
4692 |
|
@param |
4693 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
4694 |
2201 |
protected void build_urlServiceMenu(JMenu webService)... |
4695 |
|
{ |
4696 |
|
|
4697 |
|
|
4698 |
|
|
4699 |
|
|
4700 |
|
|
4701 |
|
|
4702 |
|
|
4703 |
|
|
4704 |
|
|
4705 |
|
|
4706 |
|
|
4707 |
|
|
4708 |
|
|
4709 |
|
|
4710 |
|
|
4711 |
|
|
4712 |
|
|
4713 |
|
|
4714 |
2201 |
for (jalview.ws.rest.RestClient client : jalview.ws.rest.RestClient |
4715 |
|
.getRestClients()) |
4716 |
|
{ |
4717 |
2201 |
client.attachWSMenuEntry( |
4718 |
|
JvSwingUtils.findOrCreateMenu(webService, client.getAction()), |
4719 |
|
this); |
4720 |
|
} |
4721 |
|
} |
4722 |
|
|
4723 |
|
|
4724 |
|
|
4725 |
|
|
4726 |
|
|
4727 |
|
|
4728 |
|
|
4729 |
|
@return |
4730 |
|
|
|
|
| 81.8% |
Uncovered Elements: 4 (22) |
Complexity: 4 |
Complexity Density: 0.2 |
|
4731 |
672 |
public boolean canShowProducts()... |
4732 |
|
{ |
4733 |
672 |
SequenceI[] seqs = viewport.getAlignment().getSequencesArray(); |
4734 |
672 |
AlignmentI dataset = viewport.getAlignment().getDataset(); |
4735 |
|
|
4736 |
672 |
showProducts.removeAll(); |
4737 |
672 |
final boolean dna = viewport.getAlignment().isNucleotide(); |
4738 |
|
|
4739 |
672 |
if (seqs == null || seqs.length == 0) |
4740 |
|
{ |
4741 |
|
|
4742 |
0 |
return false; |
4743 |
|
} |
4744 |
|
|
4745 |
672 |
boolean showp = false; |
4746 |
672 |
try |
4747 |
|
{ |
4748 |
672 |
List<String> ptypes = new CrossRef(seqs, dataset) |
4749 |
|
.findXrefSourcesForSequences(dna); |
4750 |
|
|
4751 |
672 |
for (final String source : ptypes) |
4752 |
|
{ |
4753 |
6 |
showp = true; |
4754 |
6 |
final AlignFrame af = this; |
4755 |
6 |
JMenuItem xtype = new JMenuItem(source); |
4756 |
6 |
xtype.addActionListener(new ActionListener() |
4757 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
4758 |
0 |
@Override... |
4759 |
|
public void actionPerformed(ActionEvent e) |
4760 |
|
{ |
4761 |
0 |
showProductsFor(af.viewport.getSequenceSelection(), dna, |
4762 |
|
source); |
4763 |
|
} |
4764 |
|
}); |
4765 |
6 |
showProducts.add(xtype); |
4766 |
|
} |
4767 |
672 |
showProducts.setVisible(showp); |
4768 |
672 |
showProducts.setEnabled(showp); |
4769 |
|
} catch (Exception e) |
4770 |
|
{ |
4771 |
0 |
Console.warn( |
4772 |
|
"canShowProducts threw an exception - please report to help@jalview.org", |
4773 |
|
e); |
4774 |
0 |
return false; |
4775 |
|
} |
4776 |
672 |
return showp; |
4777 |
|
} |
4778 |
|
|
4779 |
|
|
4780 |
|
|
4781 |
|
|
4782 |
|
|
4783 |
|
@param |
4784 |
|
|
4785 |
|
@param |
4786 |
|
|
4787 |
|
@param |
4788 |
|
|
4789 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
4790 |
0 |
protected void showProductsFor(final SequenceI[] sel, final boolean _odna,... |
4791 |
|
final String source) |
4792 |
|
{ |
4793 |
0 |
new Thread(CrossRefAction.getHandlerFor(sel, _odna, source, this)) |
4794 |
|
.start(); |
4795 |
|
} |
4796 |
|
|
4797 |
|
|
4798 |
|
|
4799 |
|
|
4800 |
|
|
|
|
| 56% |
Uncovered Elements: 11 (25) |
Complexity: 5 |
Complexity Density: 0.24 |
|
4801 |
1 |
@Override... |
4802 |
|
public void showTranslation_actionPerformed(GeneticCodeI codeTable) |
4803 |
|
{ |
4804 |
1 |
AlignmentI al = null; |
4805 |
1 |
try |
4806 |
|
{ |
4807 |
1 |
Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true)); |
4808 |
|
|
4809 |
1 |
al = dna.translateCdna(codeTable); |
4810 |
|
} catch (Exception ex) |
4811 |
|
{ |
4812 |
0 |
Console.error("Exception during translation. Please report this !", |
4813 |
|
ex); |
4814 |
0 |
final String msg = MessageManager.getString( |
4815 |
|
"label.error_when_translating_sequences_submit_bug_report"); |
4816 |
0 |
final String errorTitle = MessageManager |
4817 |
|
.getString("label.implementation_error") |
4818 |
|
+ MessageManager.getString("label.translation_failed"); |
4819 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle, |
4820 |
|
JvOptionPane.ERROR_MESSAGE); |
4821 |
0 |
return; |
4822 |
|
} |
4823 |
1 |
if (al == null || al.getHeight() == 0) |
4824 |
|
{ |
4825 |
0 |
final String msg = MessageManager.getString( |
4826 |
|
"label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation"); |
4827 |
0 |
final String errorTitle = MessageManager |
4828 |
|
.getString("label.translation_failed"); |
4829 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle, |
4830 |
|
JvOptionPane.WARNING_MESSAGE); |
4831 |
|
} |
4832 |
|
else |
4833 |
|
{ |
4834 |
1 |
AlignFrame af = new AlignFrame(al, DEFAULT_WIDTH, DEFAULT_HEIGHT); |
4835 |
1 |
af.setFileFormat(this.currentFileFormat); |
4836 |
1 |
final String newTitle = MessageManager |
4837 |
|
.formatMessage("label.translation_of_params", new Object[] |
4838 |
|
{ this.getTitle(), codeTable.getId() }); |
4839 |
1 |
af.setTitle(newTitle); |
4840 |
1 |
if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) |
4841 |
|
{ |
4842 |
1 |
final SequenceI[] seqs = viewport.getSelectionAsNewSequence(); |
4843 |
1 |
viewport.openSplitFrame(af, new Alignment(seqs)); |
4844 |
|
} |
4845 |
|
else |
4846 |
|
{ |
4847 |
0 |
Desktop.addInternalFrame(af, newTitle, DEFAULT_WIDTH, |
4848 |
|
DEFAULT_HEIGHT); |
4849 |
|
} |
4850 |
|
} |
4851 |
|
} |
4852 |
|
|
4853 |
|
|
4854 |
|
|
4855 |
|
|
4856 |
|
@param |
4857 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
4858 |
327 |
public void setFileFormat(FileFormatI format)... |
4859 |
|
{ |
4860 |
327 |
this.currentFileFormat = format; |
4861 |
|
} |
4862 |
|
|
4863 |
|
|
4864 |
|
|
4865 |
|
|
4866 |
|
@param |
4867 |
|
|
4868 |
|
@param |
4869 |
|
|
4870 |
|
@return |
4871 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
4872 |
4 |
public boolean parseFeaturesFile(Object file, DataSourceType sourceType)... |
4873 |
|
{ |
4874 |
|
|
4875 |
4 |
return avc.parseFeaturesFile(file, sourceType, |
4876 |
|
Cache.getDefault("RELAXEDSEQIDMATCHING", false)); |
4877 |
|
|
4878 |
|
} |
4879 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
4880 |
5 |
@Override... |
4881 |
|
public void refreshFeatureUI(boolean enableIfNecessary) |
4882 |
|
{ |
4883 |
|
|
4884 |
|
|
4885 |
|
|
4886 |
5 |
if (enableIfNecessary) |
4887 |
|
{ |
4888 |
5 |
viewport.setShowSequenceFeatures(true); |
4889 |
5 |
showSeqFeatures.setSelected(true); |
4890 |
|
} |
4891 |
|
|
4892 |
|
} |
4893 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
4894 |
0 |
@Override... |
4895 |
|
public void dragEnter(DropTargetDragEvent evt) |
4896 |
|
{ |
4897 |
|
} |
4898 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
4899 |
0 |
@Override... |
4900 |
|
public void dragExit(DropTargetEvent evt) |
4901 |
|
{ |
4902 |
|
} |
4903 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
4904 |
0 |
@Override... |
4905 |
|
public void dragOver(DropTargetDragEvent evt) |
4906 |
|
{ |
4907 |
|
} |
4908 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
4909 |
0 |
@Override... |
4910 |
|
public void dropActionChanged(DropTargetDragEvent evt) |
4911 |
|
{ |
4912 |
|
} |
4913 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.3 |
|
4914 |
0 |
@Override... |
4915 |
|
public void drop(DropTargetDropEvent evt) |
4916 |
|
{ |
4917 |
|
|
4918 |
|
|
4919 |
0 |
evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); |
4920 |
0 |
Transferable t = evt.getTransferable(); |
4921 |
|
|
4922 |
0 |
final AlignFrame thisaf = this; |
4923 |
0 |
final List<Object> files = new ArrayList<>(); |
4924 |
0 |
List<DataSourceType> protocols = new ArrayList<>(); |
4925 |
|
|
4926 |
0 |
try |
4927 |
|
{ |
4928 |
0 |
Desktop.transferFromDropTarget(files, protocols, evt, t); |
4929 |
|
} catch (Exception e) |
4930 |
|
{ |
4931 |
0 |
e.printStackTrace(); |
4932 |
|
} |
4933 |
0 |
if (files != null) |
4934 |
|
{ |
4935 |
0 |
new Thread(new Runnable() |
4936 |
|
{ |
|
|
| 0% |
Uncovered Elements: 95 (95) |
Complexity: 24 |
Complexity Density: 0.39 |
|
4937 |
0 |
@Override... |
4938 |
|
public void run() |
4939 |
|
{ |
4940 |
0 |
try |
4941 |
|
{ |
4942 |
|
|
4943 |
|
|
4944 |
|
|
4945 |
0 |
SequenceIdMatcher idm = new SequenceIdMatcher( |
4946 |
|
viewport.getAlignment().getSequencesArray()); |
4947 |
|
|
4948 |
|
|
4949 |
|
|
4950 |
0 |
ArrayList<Object[]> filesmatched = new ArrayList<>(); |
4951 |
0 |
ArrayList<Object[]> filesnotmatched = new ArrayList<>(); |
4952 |
0 |
for (int i = 0; i < files.size(); i++) |
4953 |
|
{ |
4954 |
|
|
4955 |
0 |
Object file = files.get(i); |
4956 |
0 |
String fileName = file.toString(); |
4957 |
0 |
String pdbfn = ""; |
4958 |
0 |
DataSourceType protocol = (file instanceof File |
4959 |
|
? DataSourceType.FILE |
4960 |
|
: FormatAdapter.checkProtocol(fileName)); |
4961 |
0 |
if (protocol == DataSourceType.FILE) |
4962 |
|
{ |
4963 |
0 |
File fl; |
4964 |
0 |
if (file instanceof File) |
4965 |
|
{ |
4966 |
0 |
fl = (File) file; |
4967 |
0 |
Platform.cacheFileData(fl); |
4968 |
|
} |
4969 |
|
else |
4970 |
|
{ |
4971 |
0 |
fl = new File(fileName); |
4972 |
|
} |
4973 |
0 |
pdbfn = fl.getName(); |
4974 |
|
} |
4975 |
0 |
else if (protocol == DataSourceType.URL) |
4976 |
|
{ |
4977 |
0 |
URL url = new URL(fileName); |
4978 |
0 |
pdbfn = url.getFile(); |
4979 |
|
} |
4980 |
0 |
if (pdbfn.length() > 0) |
4981 |
|
{ |
4982 |
|
|
4983 |
0 |
SequenceI[] mtch = idm.findAllIdMatches(pdbfn); |
4984 |
0 |
int l = 0, c = pdbfn.indexOf("."); |
4985 |
0 |
while (mtch == null && c != -1) |
4986 |
|
{ |
4987 |
0 |
do |
4988 |
|
{ |
4989 |
0 |
l = c; |
4990 |
? |
} while ((c = pdbfn.indexOf(".", l)) > l); |
4991 |
0 |
if (l > -1) |
4992 |
|
{ |
4993 |
0 |
pdbfn = pdbfn.substring(0, l); |
4994 |
|
} |
4995 |
0 |
mtch = idm.findAllIdMatches(pdbfn); |
4996 |
|
} |
4997 |
0 |
FileFormatI type = null; |
4998 |
0 |
if (mtch != null) |
4999 |
|
{ |
5000 |
0 |
try |
5001 |
|
{ |
5002 |
0 |
type = new IdentifyFile().identify(file, protocol); |
5003 |
|
} catch (Exception ex) |
5004 |
|
{ |
5005 |
0 |
type = null; |
5006 |
|
} |
5007 |
0 |
if (type != null && type.isStructureFile()) |
5008 |
|
{ |
5009 |
0 |
filesmatched.add(new Object[] { file, protocol, mtch }); |
5010 |
0 |
continue; |
5011 |
|
} |
5012 |
|
} |
5013 |
|
|
5014 |
|
|
5015 |
0 |
filesnotmatched.add(new Object[] { file, protocol, type }); |
5016 |
|
} |
5017 |
|
} |
5018 |
0 |
int assocfiles = 0; |
5019 |
0 |
if (filesmatched.size() > 0) |
5020 |
|
{ |
5021 |
0 |
boolean autoAssociate = Cache |
5022 |
|
.getDefault("AUTOASSOCIATE_PDBANDSEQS", false); |
5023 |
0 |
if (!autoAssociate) |
5024 |
|
{ |
5025 |
0 |
String msg = MessageManager.formatMessage( |
5026 |
|
"label.automatically_associate_structure_files_with_sequences_same_name", |
5027 |
|
new Object[] |
5028 |
|
{ Integer.valueOf(filesmatched.size()) |
5029 |
|
.toString() }); |
5030 |
0 |
String ttl = MessageManager.getString( |
5031 |
|
"label.automatically_associate_structure_files_by_name"); |
5032 |
0 |
int choice = JvOptionPane.showConfirmDialog(thisaf, msg, |
5033 |
|
ttl, JvOptionPane.YES_NO_OPTION); |
5034 |
0 |
autoAssociate = choice == JvOptionPane.YES_OPTION; |
5035 |
|
} |
5036 |
0 |
if (autoAssociate) |
5037 |
|
{ |
5038 |
0 |
for (Object[] fm : filesmatched) |
5039 |
|
{ |
5040 |
|
|
5041 |
|
|
5042 |
|
|
5043 |
0 |
for (SequenceI toassoc : (SequenceI[]) fm[2]) |
5044 |
|
{ |
5045 |
0 |
PDBEntry pe = new AssociatePdbFileWithSeq() |
5046 |
|
.associatePdbWithSeq(fm[0].toString(), |
5047 |
|
(DataSourceType) fm[1], toassoc, false, |
5048 |
|
Desktop.instance); |
5049 |
0 |
if (pe != null) |
5050 |
|
{ |
5051 |
0 |
jalview.bin.Console.errPrintln("Associated file : " |
5052 |
|
+ (fm[0].toString()) + " with " |
5053 |
|
+ toassoc.getDisplayId(true)); |
5054 |
0 |
assocfiles++; |
5055 |
|
} |
5056 |
|
} |
5057 |
|
|
5058 |
|
|
5059 |
0 |
alignPanel.paintAlignment(true, false); |
5060 |
|
} |
5061 |
|
} |
5062 |
|
else |
5063 |
|
{ |
5064 |
|
|
5065 |
|
|
5066 |
|
|
5067 |
0 |
for (Object[] o : filesmatched) |
5068 |
|
{ |
5069 |
0 |
filesnotmatched.add(new Object[] { o[0], o[1] }); |
5070 |
|
} |
5071 |
|
} |
5072 |
|
} |
5073 |
0 |
if (filesnotmatched.size() > 0) |
5074 |
|
{ |
5075 |
0 |
if (assocfiles > 0 && (Cache.getDefault( |
5076 |
|
"AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false) |
5077 |
|
|| JvOptionPane.showConfirmDialog(thisaf, |
5078 |
|
"<html>" + MessageManager.formatMessage( |
5079 |
|
"label.ignore_unmatched_dropped_files_info", |
5080 |
|
new Object[] |
5081 |
|
{ Integer.valueOf( |
5082 |
|
filesnotmatched.size()) |
5083 |
|
.toString() }) |
5084 |
|
+ "</html>", |
5085 |
|
MessageManager.getString( |
5086 |
|
"label.ignore_unmatched_dropped_files"), |
5087 |
|
JvOptionPane.YES_NO_OPTION) == JvOptionPane.YES_OPTION)) |
5088 |
|
{ |
5089 |
0 |
return; |
5090 |
|
} |
5091 |
0 |
for (Object[] fn : filesnotmatched) |
5092 |
|
{ |
5093 |
0 |
loadJalviewDataFile(fn[0], (DataSourceType) fn[1], |
5094 |
|
(FileFormatI) fn[2], null); |
5095 |
|
} |
5096 |
|
|
5097 |
|
} |
5098 |
|
} catch (Exception ex) |
5099 |
|
{ |
5100 |
0 |
ex.printStackTrace(); |
5101 |
|
} |
5102 |
|
} |
5103 |
|
}).start(); |
5104 |
|
} |
5105 |
|
} |
5106 |
|
|
5107 |
|
|
5108 |
|
|
5109 |
|
|
5110 |
|
|
5111 |
|
|
5112 |
|
|
5113 |
|
|
5114 |
|
|
5115 |
|
|
5116 |
|
@param |
5117 |
|
|
5118 |
|
|
|
|
| 56.2% |
Uncovered Elements: 39 (89) |
Complexity: 25 |
Complexity Density: 0.49 |
|
5119 |
7 |
public void loadJalviewDataFile(Object file, DataSourceType sourceType,... |
5120 |
|
FileFormatI format, SequenceI assocSeq) |
5121 |
|
{ |
5122 |
|
|
5123 |
7 |
try |
5124 |
|
{ |
5125 |
7 |
if (sourceType == null) |
5126 |
|
{ |
5127 |
2 |
sourceType = FormatAdapter.checkProtocol(file); |
5128 |
|
} |
5129 |
|
|
5130 |
|
|
5131 |
|
|
5132 |
7 |
boolean isAnnotation = (format == null |
5133 |
|
|| FileFormat.Pfam.equals(format)) |
5134 |
|
? new AnnotationFile().annotateAlignmentView(viewport, |
5135 |
|
file, sourceType) |
5136 |
|
: false; |
5137 |
|
|
5138 |
7 |
if (!isAnnotation) |
5139 |
|
{ |
5140 |
|
|
5141 |
3 |
TCoffeeScoreFile tcf = null; |
5142 |
3 |
try |
5143 |
|
{ |
5144 |
3 |
tcf = new TCoffeeScoreFile(file, sourceType); |
5145 |
3 |
if (tcf.isValid()) |
5146 |
|
{ |
5147 |
1 |
if (tcf.annotateAlignment(viewport.getAlignment(), true)) |
5148 |
|
{ |
5149 |
1 |
buildColourMenu(); |
5150 |
1 |
changeColour( |
5151 |
|
new TCoffeeColourScheme(viewport.getAlignment())); |
5152 |
1 |
isAnnotation = true; |
5153 |
1 |
setStatus(MessageManager.getString( |
5154 |
|
"label.successfully_pasted_tcoffee_scores_to_alignment")); |
5155 |
|
} |
5156 |
|
else |
5157 |
|
{ |
5158 |
|
|
5159 |
|
|
5160 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, |
5161 |
0 |
tcf.getWarningMessage() == null |
5162 |
|
? MessageManager.getString( |
5163 |
|
"label.check_file_matches_sequence_ids_alignment") |
5164 |
|
: tcf.getWarningMessage(), |
5165 |
|
MessageManager.getString( |
5166 |
|
"label.problem_reading_tcoffee_score_file"), |
5167 |
|
JvOptionPane.WARNING_MESSAGE); |
5168 |
|
} |
5169 |
|
} |
5170 |
|
else |
5171 |
|
{ |
5172 |
2 |
tcf = null; |
5173 |
|
} |
5174 |
|
} catch (Exception x) |
5175 |
|
{ |
5176 |
0 |
Console.debug( |
5177 |
|
"Exception when processing data source as T-COFFEE score file", |
5178 |
|
x); |
5179 |
0 |
tcf = null; |
5180 |
|
} |
5181 |
3 |
if (tcf == null) |
5182 |
|
{ |
5183 |
|
|
5184 |
|
|
5185 |
|
|
5186 |
2 |
if (format == null) |
5187 |
|
{ |
5188 |
2 |
format = new IdentifyFile().identify(file, sourceType); |
5189 |
|
} |
5190 |
2 |
if (FileFormat.FeatureSettings == format) |
5191 |
|
{ |
5192 |
0 |
if (featureSettings != null) |
5193 |
|
{ |
5194 |
0 |
featureSettings.load(file, sourceType); |
5195 |
|
} |
5196 |
|
else |
5197 |
|
{ |
5198 |
0 |
FeatureSettings.loadFeatureSettingsFile(getFeatureRenderer(), |
5199 |
|
fileObject, sourceType); |
5200 |
|
} |
5201 |
|
} |
5202 |
2 |
else if (FileFormat.ScoreMatrix == format) |
5203 |
|
{ |
5204 |
0 |
ScoreMatrixFile sm = new ScoreMatrixFile( |
5205 |
|
new FileParse(file, sourceType)); |
5206 |
0 |
sm.parse(); |
5207 |
|
|
5208 |
0 |
setStatus(MessageManager.formatMessage( |
5209 |
|
"label.successfully_loaded_matrix", |
5210 |
|
sm.getMatrixName())); |
5211 |
|
} |
5212 |
2 |
else if (FileFormat.Jnet.equals(format)) |
5213 |
|
{ |
5214 |
0 |
JPredFile predictions = new JPredFile(file, sourceType); |
5215 |
0 |
new JnetAnnotationMaker(); |
5216 |
0 |
JnetAnnotationMaker.add_annotation(predictions, |
5217 |
|
viewport.getAlignment(), 0, false); |
5218 |
0 |
viewport.getAlignment().setupJPredAlignment(); |
5219 |
0 |
isAnnotation = true; |
5220 |
|
} |
5221 |
|
|
5222 |
2 |
else if (FileFormat.Features.equals(format)) |
5223 |
|
{ |
5224 |
2 |
if (parseFeaturesFile(file, sourceType)) |
5225 |
|
{ |
5226 |
2 |
SplitFrame splitFrame = (SplitFrame) getSplitViewContainer(); |
5227 |
2 |
if (splitFrame != null) |
5228 |
|
{ |
5229 |
0 |
splitFrame.repaint(); |
5230 |
|
} |
5231 |
|
else |
5232 |
|
{ |
5233 |
2 |
alignPanel.paintAlignment(true, true); |
5234 |
|
} |
5235 |
|
} |
5236 |
|
} |
5237 |
|
else |
5238 |
|
{ |
5239 |
0 |
new FileLoader().LoadFile(viewport, file, sourceType, format); |
5240 |
|
} |
5241 |
|
} |
5242 |
|
} |
5243 |
7 |
if (isAnnotation) |
5244 |
|
{ |
5245 |
|
|
5246 |
5 |
alignPanel.adjustAnnotationHeight(); |
5247 |
5 |
viewport.updateSequenceIdColours(); |
5248 |
5 |
buildSortByAnnotationScoresMenu(); |
5249 |
5 |
alignPanel.paintAlignment(true, true); |
5250 |
|
} |
5251 |
|
} catch (Exception ex) |
5252 |
|
{ |
5253 |
0 |
ex.printStackTrace(); |
5254 |
|
} catch (OutOfMemoryError oom) |
5255 |
|
{ |
5256 |
0 |
try |
5257 |
|
{ |
5258 |
0 |
System.gc(); |
5259 |
|
} catch (Exception x) |
5260 |
|
{ |
5261 |
|
} |
5262 |
0 |
new OOMWarning( |
5263 |
|
"loading data " |
5264 |
0 |
+ (sourceType != null |
5265 |
0 |
? (sourceType == DataSourceType.PASTE |
5266 |
|
? "from clipboard." |
5267 |
|
: "using " + sourceType + " from " |
5268 |
|
+ file) |
5269 |
|
: ".") |
5270 |
0 |
+ (format != null |
5271 |
|
? "(parsing as '" + format + "' file)" |
5272 |
|
: ""), |
5273 |
|
oom, Desktop.desktop); |
5274 |
|
} |
5275 |
|
} |
5276 |
|
|
5277 |
|
|
5278 |
|
|
5279 |
|
|
5280 |
|
|
|
|
| 65.9% |
Uncovered Elements: 14 (41) |
Complexity: 11 |
Complexity Density: 0.44 |
|
5281 |
160 |
@Override... |
5282 |
|
public void tabSelectionChanged(int index) |
5283 |
|
{ |
5284 |
160 |
if (index > -1) |
5285 |
|
{ |
5286 |
|
|
5287 |
|
|
5288 |
|
|
5289 |
|
|
5290 |
105 |
alignPanel.setOverviewTitle(this); |
5291 |
|
|
5292 |
|
|
5293 |
|
|
5294 |
|
|
5295 |
|
|
5296 |
105 |
alignPanel = alignPanels.get(index); |
5297 |
105 |
alignPanel.setOverviewTitle(this); |
5298 |
|
|
5299 |
105 |
viewport = alignPanel.av; |
5300 |
105 |
avc.setViewportAndAlignmentPanel(viewport, alignPanel); |
5301 |
105 |
setMenusFromViewport(viewport); |
5302 |
105 |
if (featureSettings != null && featureSettings.isOpen() |
5303 |
|
&& featureSettings.fr.getViewport() != viewport) |
5304 |
|
{ |
5305 |
0 |
if (viewport.isShowSequenceFeatures()) |
5306 |
|
{ |
5307 |
|
|
5308 |
0 |
showFeatureSettingsUI(); |
5309 |
|
} |
5310 |
|
else |
5311 |
|
{ |
5312 |
|
|
5313 |
0 |
featureSettings.close(); |
5314 |
|
} |
5315 |
|
} |
5316 |
|
|
5317 |
|
} |
5318 |
|
|
5319 |
|
|
5320 |
|
|
5321 |
|
|
5322 |
160 |
if (viewport.getConservationSelected()) |
5323 |
|
{ |
5324 |
2 |
SliderPanel.setConservationSlider(alignPanel, |
5325 |
|
viewport.getResidueShading(), alignPanel.getViewName()); |
5326 |
|
} |
5327 |
|
else |
5328 |
|
{ |
5329 |
158 |
SliderPanel.hideConservationSlider(); |
5330 |
|
} |
5331 |
160 |
if (viewport.getByConsensusSecondaryStructureSelected()) |
5332 |
|
{ |
5333 |
0 |
SliderPanel.setConsensusSecondaryStructureSlider(alignPanel, |
5334 |
|
viewport.getResidueShading(), alignPanel.getViewName()); |
5335 |
|
} |
5336 |
|
else |
5337 |
|
{ |
5338 |
160 |
SliderPanel.hideConsensusSecondaryStructureSlider(); |
5339 |
|
} |
5340 |
160 |
if (viewport.getAbovePIDThreshold()) |
5341 |
|
{ |
5342 |
2 |
SliderPanel.setPIDSliderSource(alignPanel, |
5343 |
|
viewport.getResidueShading(), alignPanel.getViewName()); |
5344 |
|
} |
5345 |
|
else |
5346 |
|
{ |
5347 |
158 |
SliderPanel.hidePIDSlider(); |
5348 |
|
} |
5349 |
|
|
5350 |
|
|
5351 |
|
|
5352 |
|
|
5353 |
|
|
5354 |
|
|
5355 |
|
|
5356 |
|
|
5357 |
160 |
final AlignViewportI peer = viewport.getCodingComplement(); |
5358 |
160 |
if (peer != null) |
5359 |
|
{ |
5360 |
0 |
AlignFrame linkedAlignFrame = ((AlignViewport) peer) |
5361 |
|
.getAlignPanel().alignFrame; |
5362 |
0 |
if (linkedAlignFrame.tabbedPane.getTabCount() > index) |
5363 |
|
{ |
5364 |
0 |
linkedAlignFrame.tabbedPane.setSelectedIndex(index); |
5365 |
|
} |
5366 |
|
} |
5367 |
|
} |
5368 |
|
|
5369 |
|
|
5370 |
|
|
5371 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
5372 |
0 |
@Override... |
5373 |
|
public void tabbedPane_mousePressed(MouseEvent e) |
5374 |
|
{ |
5375 |
0 |
if (e.isPopupTrigger()) |
5376 |
|
{ |
5377 |
0 |
String msg = MessageManager.getString("label.enter_view_name"); |
5378 |
0 |
String ttl = tabbedPane.getTitleAt(tabbedPane.getSelectedIndex()); |
5379 |
0 |
String reply = JvOptionPane.showInputDialog(msg, ttl); |
5380 |
|
|
5381 |
0 |
if (reply != null) |
5382 |
|
{ |
5383 |
0 |
viewport.setViewName(reply); |
5384 |
|
|
5385 |
0 |
tabbedPane.setTitleAt(tabbedPane.getSelectedIndex(), reply); |
5386 |
|
} |
5387 |
|
} |
5388 |
|
} |
5389 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5390 |
185 |
public AlignViewport getCurrentView()... |
5391 |
|
{ |
5392 |
185 |
return viewport; |
5393 |
|
} |
5394 |
|
|
5395 |
|
|
5396 |
|
|
5397 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
5398 |
0 |
@Override... |
5399 |
|
protected void extractScores_actionPerformed(ActionEvent e) |
5400 |
|
{ |
5401 |
0 |
ParseProperties pp = new jalview.analysis.ParseProperties( |
5402 |
|
viewport.getAlignment()); |
5403 |
|
|
5404 |
|
|
5405 |
|
|
5406 |
|
|
5407 |
0 |
if (pp.getScoresFromDescription("description column", |
5408 |
|
"score in description column ", "\\W*([-+eE0-9.]+)", true) > 0) |
5409 |
|
{ |
5410 |
0 |
buildSortByAnnotationScoresMenu(); |
5411 |
|
} |
5412 |
|
} |
5413 |
|
|
5414 |
|
|
5415 |
|
|
5416 |
|
|
5417 |
|
@see |
5418 |
|
|
5419 |
|
|
5420 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5421 |
0 |
@Override... |
5422 |
|
protected void showDbRefs_actionPerformed(ActionEvent e) |
5423 |
|
{ |
5424 |
0 |
viewport.setShowDBRefs(showDbRefsMenuitem.isSelected()); |
5425 |
|
} |
5426 |
|
|
5427 |
|
|
5428 |
|
|
5429 |
|
|
5430 |
|
|
5431 |
|
|
5432 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5433 |
0 |
@Override... |
5434 |
|
protected void showNpFeats_actionPerformed(ActionEvent e) |
5435 |
|
{ |
5436 |
0 |
viewport.setShowNPFeats(showNpFeatsMenuitem.isSelected()); |
5437 |
|
} |
5438 |
|
|
5439 |
|
|
5440 |
|
|
5441 |
|
|
5442 |
|
|
5443 |
|
@param |
5444 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 6 |
Complexity Density: 0.6 |
|
5445 |
0 |
public boolean closeView(AlignViewportI av)... |
5446 |
|
{ |
5447 |
0 |
if (viewport == av) |
5448 |
|
{ |
5449 |
0 |
this.closeMenuItem_actionPerformed(false); |
5450 |
0 |
return true; |
5451 |
|
} |
5452 |
0 |
Component[] comp = tabbedPane.getComponents(); |
5453 |
0 |
for (int i = 0; comp != null && i < comp.length; i++) |
5454 |
|
{ |
5455 |
0 |
if (comp[i] instanceof AlignmentPanel) |
5456 |
|
{ |
5457 |
0 |
if (((AlignmentPanel) comp[i]).av == av) |
5458 |
|
{ |
5459 |
|
|
5460 |
0 |
closeView((AlignmentPanel) comp[i]); |
5461 |
0 |
return true; |
5462 |
|
} |
5463 |
|
} |
5464 |
|
} |
5465 |
0 |
return false; |
5466 |
|
} |
5467 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
|
5468 |
2201 |
protected void build_fetchdbmenu(JMenu webService)... |
5469 |
|
{ |
5470 |
|
|
5471 |
|
|
5472 |
|
|
5473 |
|
|
5474 |
2201 |
final JMenu rfetch = new JMenu( |
5475 |
|
MessageManager.getString("action.fetch_db_references")); |
5476 |
2201 |
rfetch.setToolTipText(MessageManager.getString( |
5477 |
|
"label.retrieve_parse_sequence_database_records_alignment_or_selected_sequences")); |
5478 |
2201 |
webService.add(rfetch); |
5479 |
|
|
5480 |
2201 |
final JCheckBoxMenuItem trimrs = new JCheckBoxMenuItem( |
5481 |
|
MessageManager.getString("option.trim_retrieved_seqs")); |
5482 |
2201 |
trimrs.setToolTipText( |
5483 |
|
MessageManager.getString("label.trim_retrieved_sequences")); |
5484 |
2201 |
trimrs.setSelected( |
5485 |
|
Cache.getDefault(DBRefFetcher.TRIM_RETRIEVED_SEQUENCES, true)); |
5486 |
2201 |
trimrs.addActionListener(new ActionListener() |
5487 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
5488 |
0 |
@Override... |
5489 |
|
public void actionPerformed(ActionEvent e) |
5490 |
|
{ |
5491 |
0 |
trimrs.setSelected(trimrs.isSelected()); |
5492 |
0 |
Cache.setProperty(DBRefFetcher.TRIM_RETRIEVED_SEQUENCES, |
5493 |
|
Boolean.valueOf(trimrs.isSelected()).toString()); |
5494 |
|
} |
5495 |
|
}); |
5496 |
2201 |
rfetch.add(trimrs); |
5497 |
2201 |
JMenuItem fetchr = new JMenuItem( |
5498 |
|
MessageManager.getString("label.standard_databases")); |
5499 |
2201 |
fetchr.setToolTipText( |
5500 |
|
MessageManager.getString("label.fetch_embl_uniprot")); |
5501 |
2201 |
fetchr.addActionListener(new ActionListener() |
5502 |
|
{ |
5503 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5504 |
0 |
@Override... |
5505 |
|
public void actionPerformed(ActionEvent e) |
5506 |
|
{ |
5507 |
0 |
new Thread(new Runnable() |
5508 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
5509 |
0 |
@Override... |
5510 |
|
public void run() |
5511 |
|
{ |
5512 |
0 |
boolean isNucleotide = alignPanel.alignFrame.getViewport() |
5513 |
|
.getAlignment().isNucleotide(); |
5514 |
0 |
DBRefFetcher dbRefFetcher = new DBRefFetcher( |
5515 |
|
alignPanel.av.getSequenceSelection(), |
5516 |
|
alignPanel.alignFrame, null, |
5517 |
|
alignPanel.alignFrame.featureSettings, isNucleotide); |
5518 |
0 |
dbRefFetcher.addListener(new FetchFinishedListenerI() |
5519 |
|
{ |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
5520 |
0 |
@Override... |
5521 |
|
public void finished() |
5522 |
|
{ |
5523 |
|
|
5524 |
0 |
for (FeatureSettingsModelI srcSettings : dbRefFetcher |
5525 |
|
.getFeatureSettingsModels()) |
5526 |
|
{ |
5527 |
|
|
5528 |
0 |
alignPanel.av.mergeFeaturesStyle(srcSettings); |
5529 |
|
} |
5530 |
0 |
AlignFrame.this.setMenusForViewport(); |
5531 |
|
} |
5532 |
|
}); |
5533 |
0 |
dbRefFetcher.fetchDBRefs(false); |
5534 |
|
} |
5535 |
|
}).start(); |
5536 |
|
|
5537 |
|
} |
5538 |
|
|
5539 |
|
}); |
5540 |
2201 |
rfetch.add(fetchr); |
5541 |
2201 |
new Thread(new Runnable() |
5542 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
5543 |
2201 |
@Override... |
5544 |
|
public void run() |
5545 |
|
{ |
5546 |
2201 |
final jalview.ws.SequenceFetcher sf = jalview.gui.SequenceFetcher |
5547 |
|
.getSequenceFetcherSingleton(); |
5548 |
2201 |
javax.swing.SwingUtilities.invokeLater(new Runnable() |
5549 |
|
{ |
|
|
| 45.3% |
Uncovered Elements: 41 (75) |
Complexity: 12 |
Complexity Density: 0.2 |
|
5550 |
2201 |
@Override... |
5551 |
|
public void run() |
5552 |
|
{ |
5553 |
2201 |
String[] dbclasses = sf.getNonAlignmentSources(); |
5554 |
2201 |
List<DbSourceProxy> otherdb; |
5555 |
2201 |
JMenu dfetch = new JMenu(); |
5556 |
2201 |
JMenu ifetch = new JMenu(); |
5557 |
2201 |
JMenuItem fetchr = null; |
5558 |
2201 |
int comp = 0, icomp = 0, mcomp = 15; |
5559 |
2201 |
String mname = null; |
5560 |
2201 |
int dbi = 0; |
5561 |
2201 |
for (String dbclass : dbclasses) |
5562 |
|
{ |
5563 |
11005 |
otherdb = sf.getSourceProxy(dbclass); |
5564 |
|
|
5565 |
|
|
5566 |
11005 |
if (otherdb == null || otherdb.size() < 1) |
5567 |
|
{ |
5568 |
0 |
continue; |
5569 |
|
} |
5570 |
11005 |
if (mname == null) |
5571 |
|
{ |
5572 |
2201 |
mname = "From " + dbclass; |
5573 |
|
} |
5574 |
11005 |
if (otherdb.size() == 1) |
5575 |
|
{ |
5576 |
11005 |
final DbSourceProxy[] dassource = otherdb |
5577 |
|
.toArray(new DbSourceProxy[0]); |
5578 |
11005 |
DbSourceProxy src = otherdb.get(0); |
5579 |
11005 |
fetchr = new JMenuItem(src.getDbSource()); |
5580 |
11005 |
fetchr.addActionListener(new ActionListener() |
5581 |
|
{ |
5582 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5583 |
0 |
@Override... |
5584 |
|
public void actionPerformed(ActionEvent e) |
5585 |
|
{ |
5586 |
0 |
new Thread(new Runnable() |
5587 |
|
{ |
5588 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
5589 |
0 |
@Override... |
5590 |
|
public void run() |
5591 |
|
{ |
5592 |
0 |
boolean isNucleotide = alignPanel.alignFrame |
5593 |
|
.getViewport().getAlignment() |
5594 |
|
.isNucleotide(); |
5595 |
0 |
DBRefFetcher dbRefFetcher = new DBRefFetcher( |
5596 |
|
alignPanel.av.getSequenceSelection(), |
5597 |
|
alignPanel.alignFrame, dassource, |
5598 |
|
alignPanel.alignFrame.featureSettings, |
5599 |
|
isNucleotide); |
5600 |
0 |
dbRefFetcher |
5601 |
|
.addListener(new FetchFinishedListenerI() |
5602 |
|
{ |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
5603 |
0 |
@Override... |
5604 |
|
public void finished() |
5605 |
|
{ |
5606 |
0 |
FeatureSettingsModelI srcSettings = dassource[0] |
5607 |
|
.getFeatureColourScheme(); |
5608 |
0 |
alignPanel.av.mergeFeaturesStyle( |
5609 |
|
srcSettings); |
5610 |
0 |
AlignFrame.this.setMenusForViewport(); |
5611 |
|
} |
5612 |
|
}); |
5613 |
0 |
dbRefFetcher.fetchDBRefs(false); |
5614 |
|
} |
5615 |
|
}).start(); |
5616 |
|
} |
5617 |
|
|
5618 |
|
}); |
5619 |
11005 |
fetchr.setToolTipText(JvSwingUtils.wrapTooltip(true, |
5620 |
|
MessageManager.formatMessage( |
5621 |
|
"label.fetch_retrieve_from", new Object[] |
5622 |
|
{ src.getDbName() }))); |
5623 |
11005 |
dfetch.add(fetchr); |
5624 |
11005 |
comp++; |
5625 |
|
} |
5626 |
|
else |
5627 |
|
{ |
5628 |
0 |
final DbSourceProxy[] dassource = otherdb |
5629 |
|
.toArray(new DbSourceProxy[0]); |
5630 |
|
|
5631 |
0 |
DbSourceProxy src = otherdb.get(0); |
5632 |
0 |
fetchr = new JMenuItem(MessageManager |
5633 |
|
.formatMessage("label.fetch_all_param", new Object[] |
5634 |
|
{ src.getDbSource() })); |
5635 |
0 |
fetchr.addActionListener(new ActionListener() |
5636 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5637 |
0 |
@Override... |
5638 |
|
public void actionPerformed(ActionEvent e) |
5639 |
|
{ |
5640 |
0 |
new Thread(new Runnable() |
5641 |
|
{ |
5642 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
5643 |
0 |
@Override... |
5644 |
|
public void run() |
5645 |
|
{ |
5646 |
0 |
boolean isNucleotide = alignPanel.alignFrame |
5647 |
|
.getViewport().getAlignment() |
5648 |
|
.isNucleotide(); |
5649 |
0 |
DBRefFetcher dbRefFetcher = new DBRefFetcher( |
5650 |
|
alignPanel.av.getSequenceSelection(), |
5651 |
|
alignPanel.alignFrame, dassource, |
5652 |
|
alignPanel.alignFrame.featureSettings, |
5653 |
|
isNucleotide); |
5654 |
0 |
dbRefFetcher |
5655 |
|
.addListener(new FetchFinishedListenerI() |
5656 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5657 |
0 |
@Override... |
5658 |
|
public void finished() |
5659 |
|
{ |
5660 |
0 |
AlignFrame.this.setMenusForViewport(); |
5661 |
|
} |
5662 |
|
}); |
5663 |
0 |
dbRefFetcher.fetchDBRefs(false); |
5664 |
|
} |
5665 |
|
}).start(); |
5666 |
|
} |
5667 |
|
}); |
5668 |
|
|
5669 |
0 |
fetchr.setToolTipText(JvSwingUtils.wrapTooltip(true, |
5670 |
|
MessageManager.formatMessage( |
5671 |
|
"label.fetch_retrieve_from_all_sources", |
5672 |
|
new Object[] |
5673 |
|
{ Integer.valueOf(otherdb.size()) |
5674 |
|
.toString(), |
5675 |
|
src.getDbSource(), src.getDbName() }))); |
5676 |
0 |
dfetch.add(fetchr); |
5677 |
0 |
comp++; |
5678 |
|
|
5679 |
0 |
ifetch = new JMenu(MessageManager.formatMessage( |
5680 |
|
"label.source_from_db_source", new Object[] |
5681 |
|
{ src.getDbSource() })); |
5682 |
0 |
icomp = 0; |
5683 |
0 |
String imname = null; |
5684 |
0 |
int i = 0; |
5685 |
0 |
for (DbSourceProxy sproxy : otherdb) |
5686 |
|
{ |
5687 |
0 |
String dbname = sproxy.getDbName(); |
5688 |
0 |
String sname = dbname.length() > 5 |
5689 |
|
? dbname.substring(0, 5) + "..." |
5690 |
|
: dbname; |
5691 |
0 |
String msname = dbname.length() > 10 |
5692 |
|
? dbname.substring(0, 10) + "..." |
5693 |
|
: dbname; |
5694 |
0 |
if (imname == null) |
5695 |
|
{ |
5696 |
0 |
imname = MessageManager |
5697 |
|
.formatMessage("label.from_msname", new Object[] |
5698 |
|
{ sname }); |
5699 |
|
} |
5700 |
0 |
fetchr = new JMenuItem(msname); |
5701 |
0 |
final DbSourceProxy[] dassrc = { sproxy }; |
5702 |
0 |
fetchr.addActionListener(new ActionListener() |
5703 |
|
{ |
5704 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5705 |
0 |
@Override... |
5706 |
|
public void actionPerformed(ActionEvent e) |
5707 |
|
{ |
5708 |
0 |
new Thread(new Runnable() |
5709 |
|
{ |
5710 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
5711 |
0 |
@Override... |
5712 |
|
public void run() |
5713 |
|
{ |
5714 |
0 |
boolean isNucleotide = alignPanel.alignFrame |
5715 |
|
.getViewport().getAlignment() |
5716 |
|
.isNucleotide(); |
5717 |
0 |
DBRefFetcher dbRefFetcher = new DBRefFetcher( |
5718 |
|
alignPanel.av.getSequenceSelection(), |
5719 |
|
alignPanel.alignFrame, dassrc, |
5720 |
|
alignPanel.alignFrame.featureSettings, |
5721 |
|
isNucleotide); |
5722 |
0 |
dbRefFetcher |
5723 |
|
.addListener(new FetchFinishedListenerI() |
5724 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5725 |
0 |
@Override... |
5726 |
|
public void finished() |
5727 |
|
{ |
5728 |
0 |
AlignFrame.this.setMenusForViewport(); |
5729 |
|
} |
5730 |
|
}); |
5731 |
0 |
dbRefFetcher.fetchDBRefs(false); |
5732 |
|
} |
5733 |
|
}).start(); |
5734 |
|
} |
5735 |
|
|
5736 |
|
}); |
5737 |
0 |
fetchr.setToolTipText( |
5738 |
|
"<html>" + MessageManager.formatMessage( |
5739 |
|
"label.fetch_retrieve_from", new Object[] |
5740 |
|
{ dbname })); |
5741 |
0 |
ifetch.add(fetchr); |
5742 |
0 |
++i; |
5743 |
0 |
if (++icomp >= mcomp || i == (otherdb.size())) |
5744 |
|
{ |
5745 |
0 |
ifetch.setText(MessageManager.formatMessage( |
5746 |
|
"label.source_to_target", imname, sname)); |
5747 |
0 |
dfetch.add(ifetch); |
5748 |
0 |
ifetch = new JMenu(); |
5749 |
0 |
imname = null; |
5750 |
0 |
icomp = 0; |
5751 |
0 |
comp++; |
5752 |
|
} |
5753 |
|
} |
5754 |
|
} |
5755 |
11005 |
++dbi; |
5756 |
11005 |
if (comp >= mcomp || dbi >= (dbclasses.length)) |
5757 |
|
{ |
5758 |
2201 |
dfetch.setText(MessageManager.formatMessage( |
5759 |
|
"label.source_to_target", mname, dbclass)); |
5760 |
2201 |
rfetch.add(dfetch); |
5761 |
2201 |
dfetch = new JMenu(); |
5762 |
2201 |
mname = null; |
5763 |
2201 |
comp = 0; |
5764 |
|
} |
5765 |
|
} |
5766 |
|
} |
5767 |
|
}); |
5768 |
|
} |
5769 |
|
}).start(); |
5770 |
|
|
5771 |
|
} |
5772 |
|
|
5773 |
|
|
5774 |
|
|
5775 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5776 |
0 |
@Override... |
5777 |
|
protected void justifyLeftMenuItem_actionPerformed(ActionEvent e) |
5778 |
|
{ |
5779 |
0 |
avc.justify_Region(true); |
5780 |
|
} |
5781 |
|
|
5782 |
|
|
5783 |
|
|
5784 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
5785 |
0 |
@Override... |
5786 |
|
protected void justifyRightMenuItem_actionPerformed(ActionEvent e) |
5787 |
|
{ |
5788 |
0 |
avc.justify_Region(false); |
5789 |
|
} |
5790 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
5791 |
12 |
@Override... |
5792 |
|
public void setShowSeqFeatures(boolean b) |
5793 |
|
{ |
5794 |
12 |
showSeqFeatures.setSelected(b); |
5795 |
12 |
viewport.setShowSequenceFeatures(b); |
5796 |
|
} |
5797 |
|
|
5798 |
|
|
5799 |
|
|
5800 |
|
|
5801 |
|
@see |
5802 |
|
|
5803 |
|
|
5804 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
5805 |
0 |
@Override... |
5806 |
|
protected void showUnconservedMenuItem_actionPerformed(ActionEvent e) |
5807 |
|
{ |
5808 |
0 |
viewport.setShowUnconserved(showNonconservedMenuItem.getState()); |
5809 |
0 |
alignPanel.paintAlignment(false, false); |
5810 |
|
} |
5811 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
5812 |
0 |
@Override... |
5813 |
|
protected void showStructureProvider_actionPerformed(ActionEvent e) |
5814 |
|
{ |
5815 |
0 |
viewport.setShowStructureProvider(showStrucProvider.getState()); |
5816 |
0 |
alignPanel.paintAlignment(false, false); |
5817 |
|
|
5818 |
|
} |
5819 |
|
|
|
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 6 |
Complexity Density: 0.22 |
|
5820 |
0 |
@Override... |
5821 |
|
protected void updateShowSecondaryStructureMenu(JMenu showSS, |
5822 |
|
ButtonGroup ssButtonGroup) |
5823 |
|
{ |
5824 |
|
|
5825 |
0 |
List<String> ssSources = new ArrayList<String>(); |
5826 |
0 |
AlignmentAnnotation[] anns = alignPanel.getAlignment() |
5827 |
|
.getAlignmentAnnotation(); |
5828 |
0 |
Map<String, JCheckBoxMenuItem> checkboxMap = getCheckboxesInMenu( |
5829 |
|
showSS); |
5830 |
|
|
5831 |
0 |
ssSources = AlignmentUtils.extractSSSourceInAlignmentAnnotation(anns); |
5832 |
|
|
5833 |
0 |
if (ssSources == null) |
5834 |
|
{ |
5835 |
0 |
showSS.removeAll(); |
5836 |
0 |
ssButtonGroup.clearSelection(); |
5837 |
0 |
return; |
5838 |
|
} |
5839 |
|
|
5840 |
0 |
List<String> selectedCheckBoxes = getSelectedOptions(checkboxMap); |
5841 |
|
|
5842 |
|
|
5843 |
0 |
for (String ssSource : ssSources) |
5844 |
|
{ |
5845 |
|
|
5846 |
0 |
if (checkboxMap.get(ssSource) == null) |
5847 |
|
{ |
5848 |
0 |
JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(ssSource); |
5849 |
0 |
checkBox.setSelected(false); |
5850 |
|
|
5851 |
0 |
checkBox.addItemListener(e -> { |
5852 |
0 |
if (e.getStateChange() == ItemEvent.SELECTED) |
5853 |
|
{ |
5854 |
|
|
5855 |
0 |
showOrHideSecondaryStructureForSource(ssSource, true); |
5856 |
|
|
5857 |
|
} |
5858 |
|
else |
5859 |
|
{ |
5860 |
|
|
5861 |
0 |
showOrHideSecondaryStructureForSource(ssSource, false); |
5862 |
|
|
5863 |
|
} |
5864 |
|
}); |
5865 |
0 |
showSS.add(checkBox); |
5866 |
|
} |
5867 |
|
} |
5868 |
|
|
5869 |
0 |
for (String key : checkboxMap.keySet()) |
5870 |
|
{ |
5871 |
|
|
5872 |
0 |
if (!ssSources.contains(key)) |
5873 |
|
{ |
5874 |
0 |
showSS.remove(checkboxMap.get(key)); |
5875 |
0 |
checkboxMap.remove(key); |
5876 |
0 |
selectedCheckBoxes.remove(key); |
5877 |
|
} |
5878 |
0 |
if (selectedCheckBoxes.contains(key)) |
5879 |
|
{ |
5880 |
0 |
checkboxMap.get(key).setSelected(true); |
5881 |
|
} |
5882 |
|
else |
5883 |
|
{ |
5884 |
0 |
checkboxMap.get(key).setSelected(false); |
5885 |
|
} |
5886 |
|
|
5887 |
0 |
ssButtonGroup.clearSelection(); |
5888 |
|
} |
5889 |
|
|
5890 |
|
} |
5891 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
5892 |
0 |
private List<String> getSelectedOptions(... |
5893 |
|
Map<String, JCheckBoxMenuItem> checkboxMap) |
5894 |
|
{ |
5895 |
0 |
List<String> selectedOptions = new ArrayList<>(); |
5896 |
0 |
for (String key : checkboxMap.keySet()) |
5897 |
|
{ |
5898 |
0 |
JCheckBoxMenuItem checkbox = checkboxMap.get(key); |
5899 |
0 |
if (checkbox.isSelected()) |
5900 |
|
{ |
5901 |
0 |
selectedOptions.add(key); |
5902 |
|
} |
5903 |
|
} |
5904 |
0 |
return selectedOptions; |
5905 |
|
} |
5906 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
5907 |
0 |
private Map<String, JCheckBoxMenuItem> getCheckboxesInMenu(JMenu menu)... |
5908 |
|
{ |
5909 |
0 |
Map<String, JCheckBoxMenuItem> checkboxMap = new HashMap<>(); |
5910 |
0 |
for (Component component : menu.getMenuComponents()) |
5911 |
|
{ |
5912 |
0 |
if (component instanceof JCheckBoxMenuItem) |
5913 |
|
{ |
5914 |
0 |
JCheckBoxMenuItem checkbox = (JCheckBoxMenuItem) component; |
5915 |
0 |
checkboxMap.put(checkbox.getText(), checkbox); |
5916 |
|
} |
5917 |
|
} |
5918 |
0 |
return checkboxMap; |
5919 |
|
} |
5920 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 11 |
Complexity Density: 0.5 |
|
5921 |
0 |
@Override... |
5922 |
|
protected void showOrHideSecondaryStructureForSource( |
5923 |
|
String ssSourceSelection, boolean visible) |
5924 |
|
{ |
5925 |
|
|
5926 |
0 |
String noneOption = MessageManager |
5927 |
|
.getString("option.ss_providers_none"); |
5928 |
0 |
String allOption = MessageManager.getString("option.ss_providers_all"); |
5929 |
|
|
5930 |
0 |
AlignmentAnnotation[] annotations = alignPanel.getAlignment() |
5931 |
|
.getAlignmentAnnotation(); |
5932 |
|
|
5933 |
0 |
for (AlignmentAnnotation aa : annotations) |
5934 |
|
{ |
5935 |
|
|
5936 |
0 |
if (aa.groupRef != null) |
5937 |
|
{ |
5938 |
0 |
continue; |
5939 |
|
} |
5940 |
|
|
5941 |
0 |
boolean isSSConsensus = aa.label.startsWith( |
5942 |
|
MessageManager.getString("label.ssconsensus_label")); |
5943 |
0 |
boolean matchesSSSourceSelection = aa.description |
5944 |
|
.startsWith(ssSourceSelection); |
5945 |
|
|
5946 |
0 |
if (isSSConsensus && (matchesSSSourceSelection |
5947 |
|
|| ssSourceSelection.equals(noneOption))) |
5948 |
|
{ |
5949 |
|
|
5950 |
0 |
if (ssSourceSelection.equals(allOption)) |
5951 |
|
{ |
5952 |
0 |
aa.visible = true; |
5953 |
0 |
break; |
5954 |
|
} |
5955 |
|
|
5956 |
0 |
if (!aa.description.startsWith(allOption)) |
5957 |
0 |
aa.visible = visible; |
5958 |
|
|
5959 |
|
} |
5960 |
|
|
5961 |
0 |
for (String label : Constants.SECONDARY_STRUCTURE_LABELS.keySet()) |
5962 |
|
{ |
5963 |
|
|
5964 |
0 |
if (label.equals(aa.label)) |
5965 |
|
{ |
5966 |
|
|
5967 |
0 |
String ssSource = AlignmentUtils |
5968 |
|
.extractSSSourceFromAnnotationDescription(aa); |
5969 |
|
|
5970 |
0 |
if (ssSource != null && (ssSource.equals(ssSourceSelection) |
5971 |
|
|| ssSourceSelection.equals(noneOption))) |
5972 |
|
{ |
5973 |
0 |
aa.visible = visible; |
5974 |
|
} |
5975 |
|
} |
5976 |
|
} |
5977 |
|
|
5978 |
|
} |
5979 |
|
|
5980 |
0 |
PaintRefresher.Refresh(this, viewport.getSequenceSetId()); |
5981 |
0 |
alignPanel.updateAnnotation(); |
5982 |
0 |
alignPanel.paintAlignment(true, true); |
5983 |
|
|
5984 |
|
} |
5985 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
5986 |
0 |
protected void showSSConsensus_actionPerformed(ActionEvent e)... |
5987 |
|
{ |
5988 |
0 |
viewport.setShowSSConsensus(showSSConsensus.getState()); |
5989 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
5990 |
|
} |
5991 |
|
|
5992 |
|
|
5993 |
|
|
5994 |
|
|
5995 |
|
@see |
5996 |
|
|
5997 |
|
|
5998 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
5999 |
0 |
@Override... |
6000 |
|
protected void showGroupConsensus_actionPerformed(ActionEvent e) |
6001 |
|
{ |
6002 |
0 |
viewport.setShowGroupConsensus(showGroupConsensus.getState()); |
6003 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
6004 |
|
|
6005 |
|
} |
6006 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
6007 |
0 |
@Override... |
6008 |
|
protected void showGroupSSConsensus_actionPerformed(ActionEvent e) |
6009 |
|
{ |
6010 |
0 |
viewport.setShowGroupSSConsensus(showGroupSSConsensus.getState()); |
6011 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
6012 |
|
|
6013 |
|
} |
6014 |
|
|
6015 |
|
|
6016 |
|
|
6017 |
|
|
6018 |
|
@see |
6019 |
|
|
6020 |
|
|
6021 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
6022 |
0 |
@Override... |
6023 |
|
protected void showGroupConservation_actionPerformed(ActionEvent e) |
6024 |
|
{ |
6025 |
0 |
viewport.setShowGroupConservation(showGroupConservation.getState()); |
6026 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
6027 |
|
} |
6028 |
|
|
6029 |
|
|
6030 |
|
|
6031 |
|
|
6032 |
|
@see |
6033 |
|
|
6034 |
|
|
6035 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
6036 |
0 |
@Override... |
6037 |
|
protected void showConsensusHistogram_actionPerformed(ActionEvent e) |
6038 |
|
{ |
6039 |
0 |
viewport.setShowConsensusHistogram(showConsensusHistogram.getState()); |
6040 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
6041 |
|
} |
6042 |
|
|
6043 |
|
|
6044 |
|
|
6045 |
|
|
6046 |
|
|
6047 |
|
@see |
6048 |
|
|
6049 |
|
|
6050 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
6051 |
0 |
@Override... |
6052 |
|
protected void showSequenceLogo_actionPerformed(ActionEvent e) |
6053 |
|
{ |
6054 |
0 |
viewport.setShowSequenceLogo(showSequenceLogo.getState()); |
6055 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
6056 |
|
} |
6057 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
6058 |
0 |
@Override... |
6059 |
|
protected void normaliseSequenceLogo_actionPerformed(ActionEvent e) |
6060 |
|
{ |
6061 |
0 |
showSequenceLogo.setState(true); |
6062 |
0 |
viewport.setShowSequenceLogo(true); |
6063 |
0 |
viewport.setNormaliseSequenceLogo(normaliseSequenceLogo.getState()); |
6064 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
6065 |
|
} |
6066 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
6067 |
0 |
@Override... |
6068 |
|
protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e) |
6069 |
|
{ |
6070 |
0 |
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); |
6071 |
|
} |
6072 |
|
|
6073 |
|
|
6074 |
|
|
6075 |
|
|
6076 |
|
@see |
6077 |
|
|
6078 |
|
|
6079 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
6080 |
0 |
@Override... |
6081 |
|
protected void makeGrpsFromSelection_actionPerformed(ActionEvent e) |
6082 |
|
{ |
6083 |
0 |
if (avc.makeGroupsFromSelection()) |
6084 |
|
{ |
6085 |
0 |
PaintRefresher.Refresh(this, viewport.getSequenceSetId()); |
6086 |
0 |
alignPanel.updateAnnotation(); |
6087 |
0 |
alignPanel.paintAlignment(true, |
6088 |
|
viewport.needToUpdateStructureViews()); |
6089 |
|
} |
6090 |
|
} |
6091 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
6092 |
0 |
public void clearAlignmentSeqRep()... |
6093 |
|
{ |
6094 |
|
|
6095 |
0 |
if (viewport.getAlignment().hasSeqrep()) |
6096 |
|
{ |
6097 |
0 |
viewport.getAlignment().setSeqrep(null); |
6098 |
0 |
PaintRefresher.Refresh(this, viewport.getSequenceSetId()); |
6099 |
0 |
alignPanel.updateAnnotation(); |
6100 |
0 |
alignPanel.paintAlignment(true, true); |
6101 |
|
} |
6102 |
|
} |
6103 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
6104 |
0 |
@Override... |
6105 |
|
protected void createGroup_actionPerformed(ActionEvent e) |
6106 |
|
{ |
6107 |
0 |
if (avc.createGroup()) |
6108 |
|
{ |
6109 |
0 |
if (applyAutoAnnotationSettings.isSelected()) |
6110 |
|
{ |
6111 |
0 |
alignPanel.updateAnnotation(true, false); |
6112 |
|
} |
6113 |
0 |
alignPanel.alignmentChanged(); |
6114 |
|
} |
6115 |
|
} |
6116 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
6117 |
0 |
@Override... |
6118 |
|
protected void unGroup_actionPerformed(ActionEvent e) |
6119 |
|
{ |
6120 |
0 |
if (avc.unGroup()) |
6121 |
|
{ |
6122 |
0 |
alignPanel.alignmentChanged(); |
6123 |
|
} |
6124 |
|
} |
6125 |
|
|
6126 |
|
|
6127 |
|
|
6128 |
|
|
6129 |
|
@param |
6130 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 5 |
Complexity Density: 1.25 |
|
6131 |
0 |
public void setDisplayedView(AlignmentPanel alignmentPanel)... |
6132 |
|
{ |
6133 |
0 |
if (!viewport.getSequenceSetId() |
6134 |
|
.equals(alignmentPanel.av.getSequenceSetId())) |
6135 |
|
{ |
6136 |
0 |
throw new Error(MessageManager.getString( |
6137 |
|
"error.implementation_error_cannot_show_view_alignment_frame")); |
6138 |
|
} |
6139 |
0 |
if (tabbedPane != null && tabbedPane.getTabCount() > 0 && alignPanels |
6140 |
|
.indexOf(alignmentPanel) != tabbedPane.getSelectedIndex()) |
6141 |
|
{ |
6142 |
0 |
tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel)); |
6143 |
|
} |
6144 |
|
} |
6145 |
|
|
6146 |
|
|
6147 |
|
|
6148 |
|
|
6149 |
|
@param |
6150 |
|
@param |
6151 |
|
|
6152 |
|
@param |
6153 |
|
|
6154 |
|
|
|
|
| 77.8% |
Uncovered Elements: 4 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
6155 |
302 |
@Override... |
6156 |
|
public void setAnnotationsVisibility(boolean visible, |
6157 |
|
boolean forSequences, boolean forAlignment) |
6158 |
|
{ |
6159 |
302 |
AlignmentAnnotation[] anns = alignPanel.getAlignment() |
6160 |
|
.getAlignmentAnnotation(); |
6161 |
302 |
if (anns == null) |
6162 |
|
{ |
6163 |
0 |
return; |
6164 |
|
} |
6165 |
302 |
for (AlignmentAnnotation aa : anns) |
6166 |
|
{ |
6167 |
|
|
6168 |
|
|
6169 |
|
|
6170 |
1138 |
if (aa.annotations == null) |
6171 |
|
{ |
6172 |
0 |
continue; |
6173 |
|
} |
6174 |
1138 |
boolean apply = (aa.sequenceRef == null && forAlignment) |
6175 |
|
|| (aa.sequenceRef != null && forSequences); |
6176 |
1138 |
if (apply) |
6177 |
|
{ |
6178 |
569 |
aa.visible = visible; |
6179 |
|
} |
6180 |
|
} |
6181 |
302 |
alignPanel.validateAnnotationDimensions(true); |
6182 |
|
|
6183 |
|
|
6184 |
302 |
alignPanel.fontChanged(); |
6185 |
302 |
alignPanel.alignmentChanged(); |
6186 |
|
} |
6187 |
|
|
6188 |
|
|
6189 |
|
|
6190 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
6191 |
0 |
@Override... |
6192 |
|
protected void sortAnnotations_actionPerformed() |
6193 |
|
{ |
6194 |
0 |
this.alignPanel.av.setSortAnnotationsBy(getAnnotationSortOrder()); |
6195 |
0 |
this.alignPanel.av |
6196 |
|
.setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); |
6197 |
0 |
alignPanel.paintAlignment(false, false); |
6198 |
|
} |
6199 |
|
|
6200 |
|
|
6201 |
|
|
6202 |
|
@return |
6203 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
6204 |
235 |
public List<? extends AlignmentViewPanel> getAlignPanels()... |
6205 |
|
{ |
6206 |
|
|
6207 |
|
|
6208 |
235 |
return alignPanels; |
6209 |
|
} |
6210 |
|
|
6211 |
|
|
6212 |
|
|
6213 |
|
|
6214 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 4 |
Complexity Density: 0.21 |
|
6215 |
0 |
protected void viewAsCdna_actionPerformed()... |
6216 |
|
{ |
6217 |
|
|
6218 |
0 |
final AlignmentI alignment = getViewport().getAlignment(); |
6219 |
0 |
List<AlignedCodonFrame> mappings = alignment.getCodonFrames(); |
6220 |
0 |
if (mappings == null) |
6221 |
|
{ |
6222 |
0 |
return; |
6223 |
|
} |
6224 |
0 |
List<SequenceI> cdnaSeqs = new ArrayList<>(); |
6225 |
0 |
for (SequenceI aaSeq : alignment.getSequences()) |
6226 |
|
{ |
6227 |
0 |
for (AlignedCodonFrame acf : mappings) |
6228 |
|
{ |
6229 |
0 |
SequenceI dnaSeq = acf.getDnaForAaSeq(aaSeq.getDatasetSequence()); |
6230 |
0 |
if (dnaSeq != null) |
6231 |
|
{ |
6232 |
|
|
6233 |
|
|
6234 |
|
|
6235 |
|
|
6236 |
|
|
6237 |
0 |
final Sequence newSeq = new Sequence(dnaSeq); |
6238 |
0 |
newSeq.setDatasetSequence(dnaSeq); |
6239 |
0 |
cdnaSeqs.add(newSeq); |
6240 |
|
} |
6241 |
|
} |
6242 |
|
} |
6243 |
0 |
if (cdnaSeqs.size() == 0) |
6244 |
|
{ |
6245 |
|
|
6246 |
0 |
return; |
6247 |
|
} |
6248 |
0 |
AlignmentI cdna = new Alignment( |
6249 |
|
cdnaSeqs.toArray(new SequenceI[cdnaSeqs.size()])); |
6250 |
0 |
GAlignFrame alignFrame = new AlignFrame(cdna, AlignFrame.DEFAULT_WIDTH, |
6251 |
|
AlignFrame.DEFAULT_HEIGHT); |
6252 |
0 |
cdna.alignAs(alignment); |
6253 |
0 |
String newtitle = "cDNA " + MessageManager.getString("label.for") + " " |
6254 |
|
+ this.title; |
6255 |
0 |
Desktop.addInternalFrame(alignFrame, newtitle, AlignFrame.DEFAULT_WIDTH, |
6256 |
|
AlignFrame.DEFAULT_HEIGHT); |
6257 |
|
} |
6258 |
|
|
6259 |
|
|
6260 |
|
|
6261 |
|
|
6262 |
|
|
6263 |
|
@param |
6264 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
6265 |
0 |
@Override... |
6266 |
|
protected void showComplement_actionPerformed(boolean show) |
6267 |
|
{ |
6268 |
0 |
SplitContainerI sf = getSplitViewContainer(); |
6269 |
0 |
if (sf != null) |
6270 |
|
{ |
6271 |
0 |
sf.setComplementVisible(this, show); |
6272 |
|
} |
6273 |
|
} |
6274 |
|
|
6275 |
|
|
6276 |
|
|
6277 |
|
|
6278 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.25 |
|
6279 |
0 |
@Override... |
6280 |
|
protected void showReverse_actionPerformed(boolean complement) |
6281 |
|
{ |
6282 |
0 |
AlignmentI al = null; |
6283 |
0 |
try |
6284 |
|
{ |
6285 |
0 |
Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true)); |
6286 |
0 |
al = dna.reverseCdna(complement); |
6287 |
0 |
viewport.addAlignment(al, ""); |
6288 |
0 |
addHistoryItem(new EditCommand( |
6289 |
|
MessageManager.getString("label.add_sequences"), Action.PASTE, |
6290 |
|
al.getSequencesArray(), 0, al.getWidth(), |
6291 |
|
viewport.getAlignment())); |
6292 |
|
} catch (Exception ex) |
6293 |
|
{ |
6294 |
0 |
jalview.bin.Console.errPrintln(ex.getMessage()); |
6295 |
0 |
return; |
6296 |
|
} |
6297 |
|
} |
6298 |
|
|
6299 |
|
|
6300 |
|
|
6301 |
|
|
6302 |
|
|
6303 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.33 |
|
6304 |
0 |
@Override... |
6305 |
|
protected void runGroovy_actionPerformed() |
6306 |
|
{ |
6307 |
0 |
Jalview.getInstance().setCurrentAlignFrame(this); |
6308 |
0 |
groovy.console.ui.Console console = Desktop.getGroovyConsole(); |
6309 |
0 |
if (console != null) |
6310 |
|
{ |
6311 |
0 |
try |
6312 |
|
{ |
6313 |
0 |
console.setVariable(JalviewObjectI.currentAlFrameName, this); |
6314 |
0 |
console.runScript(); |
6315 |
|
} catch (Exception ex) |
6316 |
|
{ |
6317 |
0 |
jalview.bin.Console.errPrintln((ex.toString())); |
6318 |
0 |
JvOptionPane.showInternalMessageDialog(Desktop.desktop, |
6319 |
|
MessageManager.getString("label.couldnt_run_groovy_script"), |
6320 |
|
MessageManager.getString("label.groovy_support_failed"), |
6321 |
|
JvOptionPane.ERROR_MESSAGE); |
6322 |
|
} |
6323 |
|
} |
6324 |
|
else |
6325 |
|
{ |
6326 |
0 |
jalview.bin.Console |
6327 |
|
.errPrintln("Can't run Groovy script as console not found"); |
6328 |
|
} |
6329 |
|
} |
6330 |
|
|
6331 |
|
|
6332 |
|
|
6333 |
|
|
6334 |
|
|
6335 |
|
@param |
6336 |
|
@param |
6337 |
|
@return |
6338 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
6339 |
7 |
public boolean hideFeatureColumns(String featureType,... |
6340 |
|
boolean columnsContaining) |
6341 |
|
{ |
6342 |
7 |
boolean notForHiding = avc.markColumnsContainingFeatures( |
6343 |
|
columnsContaining, false, false, featureType); |
6344 |
7 |
if (notForHiding) |
6345 |
|
{ |
6346 |
5 |
if (avc.markColumnsContainingFeatures(!columnsContaining, false, |
6347 |
|
false, featureType)) |
6348 |
|
{ |
6349 |
4 |
getViewport().hideSelectedColumns(); |
6350 |
4 |
return true; |
6351 |
|
} |
6352 |
|
} |
6353 |
3 |
return false; |
6354 |
|
} |
6355 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
6356 |
0 |
@Override... |
6357 |
|
protected void selectHighlightedColumns_actionPerformed( |
6358 |
|
ActionEvent actionEvent) |
6359 |
|
{ |
6360 |
|
|
6361 |
0 |
avc.markHighlightedColumns( |
6362 |
|
(actionEvent.getModifiers() & ActionEvent.ALT_MASK) != 0, true, |
6363 |
|
(actionEvent.getModifiers() & (ActionEvent.META_MASK |
6364 |
|
| ActionEvent.CTRL_MASK)) != 0); |
6365 |
|
} |
6366 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
6367 |
0 |
@Override... |
6368 |
|
protected void copyHighlightedColumns_actionPerformed( |
6369 |
|
ActionEvent actionEvent) |
6370 |
|
{ |
6371 |
0 |
avc.copyHighlightedRegionsToClipboard(); |
6372 |
|
} |
6373 |
|
|
6374 |
|
|
6375 |
|
|
6376 |
|
|
6377 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
|
6378 |
453 |
public void buildColourMenu()... |
6379 |
|
{ |
6380 |
453 |
colourMenu.removeAll(); |
6381 |
|
|
6382 |
453 |
colourMenu.add(applyToAllGroups); |
6383 |
453 |
colourMenu.add(textColour); |
6384 |
453 |
colourMenu.addSeparator(); |
6385 |
|
|
6386 |
453 |
ButtonGroup bg = ColourMenuHelper.addMenuItems(colourMenu, this, |
6387 |
|
viewport.getAlignment(), false); |
6388 |
|
|
6389 |
453 |
colourMenu.add(annotationColour); |
6390 |
453 |
bg.add(annotationColour); |
6391 |
453 |
colourMenu.addSeparator(); |
6392 |
453 |
colourMenu.add(conservationMenuItem); |
6393 |
453 |
colourMenu.add(modifyConservation); |
6394 |
453 |
colourMenu.add(byConsensusSecondaryStructureMenuItem); |
6395 |
453 |
colourMenu.add(modifyConsensusSecondaryStructureThreshold); |
6396 |
453 |
colourMenu.add(abovePIDThreshold); |
6397 |
453 |
colourMenu.add(modifyPID); |
6398 |
|
|
6399 |
453 |
ColourSchemeI colourScheme = viewport.getGlobalColourScheme(); |
6400 |
453 |
ColourMenuHelper.setColourSelected(colourMenu, colourScheme); |
6401 |
|
} |
6402 |
|
|
6403 |
|
|
6404 |
|
|
6405 |
|
|
6406 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
6407 |
0 |
protected void openTreePcaDialog()... |
6408 |
|
{ |
6409 |
0 |
if (alignPanel.getCalculationDialog() == null) |
6410 |
|
{ |
6411 |
0 |
new CalculationChooser(AlignFrame.this); |
6412 |
|
} |
6413 |
|
} |
6414 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
|
6415 |
0 |
@Override... |
6416 |
|
protected void loadVcf_actionPerformed() |
6417 |
|
{ |
6418 |
0 |
JalviewFileChooser chooser = new JalviewFileChooser( |
6419 |
|
Cache.getProperty("LAST_DIRECTORY")); |
6420 |
0 |
chooser.setFileView(new JalviewFileView()); |
6421 |
0 |
chooser.setDialogTitle(MessageManager.getString("label.load_vcf_file")); |
6422 |
0 |
chooser.setToolTipText(MessageManager.getString("label.load_vcf_file")); |
6423 |
0 |
final AlignFrame us = this; |
6424 |
0 |
chooser.setResponseHandler(0, () -> { |
6425 |
0 |
String choice = chooser.getSelectedFile().getPath(); |
6426 |
0 |
Cache.setProperty("LAST_DIRECTORY", choice); |
6427 |
0 |
SequenceI[] seqs = viewport.getAlignment().getSequencesArray(); |
6428 |
0 |
new VCFLoader(choice).loadVCF(seqs, us); |
6429 |
|
}); |
6430 |
0 |
chooser.showOpenDialog(null); |
6431 |
|
|
6432 |
|
} |
6433 |
|
|
6434 |
|
private Rectangle lastFeatureSettingsBounds = null; |
6435 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
6436 |
1 |
@Override... |
6437 |
|
public void setFeatureSettingsGeometry(Rectangle bounds) |
6438 |
|
{ |
6439 |
1 |
lastFeatureSettingsBounds = bounds; |
6440 |
|
} |
6441 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
6442 |
2 |
@Override... |
6443 |
|
public Rectangle getFeatureSettingsGeometry() |
6444 |
|
{ |
6445 |
2 |
return lastFeatureSettingsBounds; |
6446 |
|
} |
6447 |
|
|
6448 |
|
} |
6449 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.56 |
|
6450 |
|
class PrintThread extends Thread |
6451 |
|
{ |
6452 |
|
AlignmentPanel ap; |
6453 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
6454 |
0 |
public PrintThread(AlignmentPanel ap)... |
6455 |
|
{ |
6456 |
0 |
this.ap = ap; |
6457 |
|
} |
6458 |
|
|
6459 |
|
static PageFormat pf; |
6460 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 4 |
Complexity Density: 0.5 |
|
6461 |
0 |
@Override... |
6462 |
|
public void run() |
6463 |
|
{ |
6464 |
0 |
PrinterJob printJob = PrinterJob.getPrinterJob(); |
6465 |
|
|
6466 |
0 |
if (pf != null) |
6467 |
|
{ |
6468 |
0 |
printJob.setPrintable(ap, pf); |
6469 |
|
} |
6470 |
|
else |
6471 |
|
{ |
6472 |
0 |
printJob.setPrintable(ap); |
6473 |
|
} |
6474 |
|
|
6475 |
0 |
if (printJob.printDialog()) |
6476 |
|
{ |
6477 |
0 |
try |
6478 |
|
{ |
6479 |
0 |
printJob.print(); |
6480 |
|
} catch (Exception PrintException) |
6481 |
|
{ |
6482 |
0 |
PrintException.printStackTrace(); |
6483 |
|
} |
6484 |
|
} |
6485 |
|
} |
6486 |
|
} |