1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import jalview.analysis.scoremodels.ScoreModels; |
24 |
|
import jalview.analysis.scoremodels.SimilarityParams; |
25 |
|
import jalview.api.analysis.ScoreModelI; |
26 |
|
import jalview.api.analysis.SimilarityParamsI; |
27 |
|
import jalview.datamodel.Alignment; |
28 |
|
import jalview.datamodel.AlignmentI; |
29 |
|
import jalview.datamodel.AlignmentView; |
30 |
|
import jalview.datamodel.HiddenColumns; |
31 |
|
import jalview.datamodel.SequenceI; |
32 |
|
import jalview.gui.ImageExporter.ImageWriterI; |
33 |
|
import jalview.gui.JalviewColourChooser.ColourChooserListener; |
34 |
|
import jalview.jbgui.GPCAPanel; |
35 |
|
import jalview.util.ImageMaker; |
36 |
|
import jalview.util.MessageManager; |
37 |
|
import jalview.viewmodel.AlignmentViewport; |
38 |
|
import jalview.viewmodel.PCAModel; |
39 |
|
|
40 |
|
import java.awt.BorderLayout; |
41 |
|
import java.awt.Color; |
42 |
|
import java.awt.Dimension; |
43 |
|
import java.awt.Graphics; |
44 |
|
import java.awt.event.ActionEvent; |
45 |
|
import java.awt.event.ActionListener; |
46 |
|
import java.awt.print.PageFormat; |
47 |
|
import java.awt.print.Printable; |
48 |
|
import java.awt.print.PrinterException; |
49 |
|
import java.awt.print.PrinterJob; |
50 |
|
|
51 |
|
import javax.swing.ButtonGroup; |
52 |
|
import javax.swing.JCheckBoxMenuItem; |
53 |
|
import javax.swing.JMenuItem; |
54 |
|
import javax.swing.JRadioButtonMenuItem; |
55 |
|
import javax.swing.event.InternalFrameAdapter; |
56 |
|
import javax.swing.event.InternalFrameEvent; |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
@author |
62 |
|
@version |
63 |
|
|
|
|
| 0% |
Uncovered Elements: 248 (248) |
Complexity: 60 |
Complexity Density: 0.33 |
|
64 |
|
public class PCAPanel extends GPCAPanel |
65 |
|
implements Runnable, IProgressIndicator |
66 |
|
{ |
67 |
|
|
68 |
|
private IProgressIndicator progressBar; |
69 |
|
|
70 |
|
RotatableCanvas rc; |
71 |
|
|
72 |
|
AlignmentPanel ap; |
73 |
|
|
74 |
|
AlignmentViewport av; |
75 |
|
|
76 |
|
PCAModel pcaModel; |
77 |
|
|
78 |
|
private static final int MIN_WIDTH = 470; |
79 |
|
|
80 |
|
private static final int MIN_HEIGHT = 250; |
81 |
|
|
82 |
|
int top = 0; |
83 |
|
|
84 |
|
private boolean working; |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
@param |
90 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
91 |
0 |
public PCAPanel(AlignmentPanel alignPanel)... |
92 |
|
{ |
93 |
0 |
this(alignPanel, |
94 |
|
ScoreModels.getInstance() |
95 |
|
.getDefaultModel( |
96 |
|
!alignPanel.av.getAlignment().isNucleotide()) |
97 |
|
.getName(), |
98 |
|
SimilarityParams.SeqSpace); |
99 |
|
} |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
@param |
106 |
|
@param |
107 |
|
@param |
108 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 2 |
Complexity Density: 0.11 |
|
109 |
0 |
public PCAPanel(AlignmentPanel alignPanel, String modelName,... |
110 |
|
SimilarityParamsI params) |
111 |
|
{ |
112 |
0 |
super(); |
113 |
0 |
this.av = alignPanel.av; |
114 |
0 |
this.ap = alignPanel; |
115 |
0 |
boolean nucleotide = av.getAlignment().isNucleotide(); |
116 |
|
|
117 |
0 |
progressBar = new ProgressBar(statusPanel, statusBar); |
118 |
|
|
119 |
0 |
addInternalFrameListener(new InternalFrameAdapter() |
120 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
121 |
0 |
@Override... |
122 |
|
public void internalFrameClosed(InternalFrameEvent e) |
123 |
|
{ |
124 |
0 |
close_actionPerformed(); |
125 |
|
} |
126 |
|
}); |
127 |
|
|
128 |
0 |
boolean selected = av.getSelectionGroup() != null |
129 |
|
&& av.getSelectionGroup().getSize() > 0; |
130 |
0 |
AlignmentView seqstrings = av.getAlignmentView(selected); |
131 |
0 |
SequenceI[] seqs; |
132 |
0 |
if (!selected) |
133 |
|
{ |
134 |
0 |
seqs = av.getAlignment().getSequencesArray(); |
135 |
|
} |
136 |
|
else |
137 |
|
{ |
138 |
0 |
seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment()); |
139 |
|
} |
140 |
|
|
141 |
0 |
ScoreModelI scoreModel = ScoreModels.getInstance() |
142 |
|
.getScoreModel(modelName, ap); |
143 |
0 |
pcaModel = new PCAModel(seqstrings, seqs, nucleotide, scoreModel, |
144 |
|
params); |
145 |
0 |
PaintRefresher.Register(this, av.getSequenceSetId()); |
146 |
|
|
147 |
0 |
rc = new RotatableCanvas(alignPanel); |
148 |
0 |
this.getContentPane().add(rc, BorderLayout.CENTER); |
149 |
0 |
Thread worker = new Thread(this); |
150 |
0 |
worker.start(); |
151 |
|
} |
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
157 |
0 |
protected void close_actionPerformed()... |
158 |
|
{ |
159 |
0 |
pcaModel = null; |
160 |
|
} |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 6 |
Complexity Density: 0.5 |
|
168 |
0 |
@Override... |
169 |
|
protected void scoreModel_menuSelected() |
170 |
|
{ |
171 |
0 |
scoreModelMenu.removeAll(); |
172 |
0 |
for (final ScoreModelI sm : ScoreModels.getInstance().getModels()) |
173 |
|
{ |
174 |
0 |
final String name = sm.getName(); |
175 |
0 |
JCheckBoxMenuItem jm = new JCheckBoxMenuItem(name); |
176 |
|
|
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
|
181 |
0 |
String tooltip = sm.getDescription(); |
182 |
0 |
if (tooltip == null) |
183 |
|
{ |
184 |
0 |
tooltip = MessageManager.getStringOrReturn("label.score_model_", |
185 |
|
name); |
186 |
|
} |
187 |
0 |
jm.setToolTipText(tooltip); |
188 |
0 |
jm.setSelected(pcaModel.getScoreModelName().equals(name)); |
189 |
0 |
if ((pcaModel.isNucleotide() && sm.isDNA()) |
190 |
|
|| (!pcaModel.isNucleotide() && sm.isProtein())) |
191 |
|
{ |
192 |
0 |
jm.addActionListener(new ActionListener() |
193 |
|
{ |
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
194 |
0 |
@Override... |
195 |
|
public void actionPerformed(ActionEvent e) |
196 |
|
{ |
197 |
0 |
if (!pcaModel.getScoreModelName().equals(name)) |
198 |
|
{ |
199 |
0 |
ScoreModelI sm2 = ScoreModels.getInstance() |
200 |
|
.getScoreModel(name, ap); |
201 |
0 |
pcaModel.setScoreModel(sm2); |
202 |
0 |
Thread worker = new Thread(PCAPanel.this); |
203 |
0 |
worker.start(); |
204 |
|
} |
205 |
|
} |
206 |
|
}); |
207 |
0 |
scoreModelMenu.add(jm); |
208 |
|
} |
209 |
|
} |
210 |
|
} |
211 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
212 |
0 |
@Override... |
213 |
|
public void bgcolour_actionPerformed(ActionEvent e) |
214 |
|
{ |
215 |
0 |
String ttl = MessageManager.getString("label.select_background_colour"); |
216 |
0 |
ColourChooserListener listener = new ColourChooserListener() |
217 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
218 |
0 |
@Override... |
219 |
|
public void colourSelected(Color c) |
220 |
|
{ |
221 |
0 |
rc.bgColour = c; |
222 |
0 |
rc.repaint(); |
223 |
|
} |
224 |
|
}; |
225 |
0 |
JalviewColourChooser.showColourChooser(this, ttl, rc.bgColour, |
226 |
|
listener); |
227 |
|
} |
228 |
|
|
229 |
|
|
230 |
|
|
231 |
|
|
|
|
| 0% |
Uncovered Elements: 33 (33) |
Complexity: 4 |
Complexity Density: 0.14 |
|
232 |
0 |
@Override... |
233 |
|
public void run() |
234 |
|
{ |
235 |
0 |
long progId = System.currentTimeMillis(); |
236 |
0 |
IProgressIndicator progress = this; |
237 |
0 |
String message = MessageManager.getString("label.pca_recalculating"); |
238 |
0 |
if (getParent() == null) |
239 |
|
{ |
240 |
0 |
progress = ap.alignFrame; |
241 |
0 |
message = MessageManager.getString("label.pca_calculating"); |
242 |
|
} |
243 |
0 |
progress.setProgressBar(message, progId); |
244 |
0 |
working = true; |
245 |
0 |
try |
246 |
|
{ |
247 |
0 |
calcSettings.setEnabled(false); |
248 |
0 |
pcaModel.run(); |
249 |
|
|
250 |
0 |
xCombobox.setSelectedIndex(0); |
251 |
0 |
yCombobox.setSelectedIndex(1); |
252 |
0 |
zCombobox.setSelectedIndex(2); |
253 |
|
|
254 |
0 |
pcaModel.updateRc(rc); |
255 |
|
|
256 |
0 |
nuclSetting.setSelected(pcaModel.isNucleotide()); |
257 |
0 |
protSetting.setSelected(!pcaModel.isNucleotide()); |
258 |
0 |
top = pcaModel.getTop(); |
259 |
|
|
260 |
|
} catch (OutOfMemoryError er) |
261 |
|
{ |
262 |
0 |
new OOMWarning("calculating PCA", er); |
263 |
0 |
working = false; |
264 |
0 |
return; |
265 |
|
} finally |
266 |
|
{ |
267 |
0 |
progress.setProgressBar("", progId); |
268 |
|
} |
269 |
0 |
calcSettings.setEnabled(true); |
270 |
0 |
repaint(); |
271 |
0 |
if (getParent() == null) |
272 |
|
{ |
273 |
0 |
addKeyListener(rc); |
274 |
0 |
Desktop.addInternalFrame(this, MessageManager |
275 |
|
.getString("label.principal_component_analysis"), 475, 450); |
276 |
0 |
this.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); |
277 |
|
} |
278 |
0 |
working = false; |
279 |
|
} |
280 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
281 |
0 |
@Override... |
282 |
|
protected void nuclSetting_actionPerfomed(ActionEvent arg0) |
283 |
|
{ |
284 |
0 |
if (!pcaModel.isNucleotide()) |
285 |
|
{ |
286 |
0 |
pcaModel.setNucleotide(true); |
287 |
0 |
pcaModel.setScoreModel( |
288 |
|
ScoreModels.getInstance().getDefaultModel(false)); |
289 |
0 |
Thread worker = new Thread(this); |
290 |
0 |
worker.start(); |
291 |
|
} |
292 |
|
|
293 |
|
} |
294 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
295 |
0 |
@Override... |
296 |
|
protected void protSetting_actionPerfomed(ActionEvent arg0) |
297 |
|
{ |
298 |
|
|
299 |
0 |
if (pcaModel.isNucleotide()) |
300 |
|
{ |
301 |
0 |
pcaModel.setNucleotide(false); |
302 |
0 |
pcaModel.setScoreModel( |
303 |
|
ScoreModels.getInstance().getDefaultModel(true)); |
304 |
0 |
Thread worker = new Thread(this); |
305 |
0 |
worker.start(); |
306 |
|
} |
307 |
|
} |
308 |
|
|
309 |
|
|
310 |
|
|
311 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
312 |
0 |
void doDimensionChange()... |
313 |
|
{ |
314 |
0 |
if (top == 0) |
315 |
|
{ |
316 |
0 |
return; |
317 |
|
} |
318 |
|
|
319 |
0 |
int dim1 = top - xCombobox.getSelectedIndex(); |
320 |
0 |
int dim2 = top - yCombobox.getSelectedIndex(); |
321 |
0 |
int dim3 = top - zCombobox.getSelectedIndex(); |
322 |
0 |
pcaModel.updateRcView(dim1, dim2, dim3); |
323 |
0 |
rc.img = null; |
324 |
0 |
rc.rotmat.setIdentity(); |
325 |
0 |
rc.initAxes(); |
326 |
0 |
rc.paint(rc.getGraphics()); |
327 |
|
} |
328 |
|
|
329 |
|
|
330 |
|
|
331 |
|
|
332 |
|
@param |
333 |
|
|
334 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
335 |
0 |
@Override... |
336 |
|
protected void xCombobox_actionPerformed(ActionEvent e) |
337 |
|
{ |
338 |
0 |
doDimensionChange(); |
339 |
|
} |
340 |
|
|
341 |
|
|
342 |
|
|
343 |
|
|
344 |
|
@param |
345 |
|
|
346 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
347 |
0 |
@Override... |
348 |
|
protected void yCombobox_actionPerformed(ActionEvent e) |
349 |
|
{ |
350 |
0 |
doDimensionChange(); |
351 |
|
} |
352 |
|
|
353 |
|
|
354 |
|
|
355 |
|
|
356 |
|
@param |
357 |
|
|
358 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
359 |
0 |
@Override... |
360 |
|
protected void zCombobox_actionPerformed(ActionEvent e) |
361 |
|
{ |
362 |
0 |
doDimensionChange(); |
363 |
|
} |
364 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
365 |
0 |
@Override... |
366 |
|
public void outputValues_actionPerformed(ActionEvent e) |
367 |
|
{ |
368 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
369 |
0 |
try |
370 |
|
{ |
371 |
0 |
cap.setText(pcaModel.getDetails()); |
372 |
0 |
Desktop.addInternalFrame(cap, |
373 |
|
MessageManager.getString("label.pca_details"), 500, 500); |
374 |
|
} catch (OutOfMemoryError oom) |
375 |
|
{ |
376 |
0 |
new OOMWarning("opening PCA details", oom); |
377 |
0 |
cap.dispose(); |
378 |
|
} |
379 |
|
} |
380 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
381 |
0 |
@Override... |
382 |
|
public void showLabels_actionPerformed(ActionEvent e) |
383 |
|
{ |
384 |
0 |
rc.showLabels(showLabels.getState()); |
385 |
|
} |
386 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
387 |
0 |
@Override... |
388 |
|
public void print_actionPerformed(ActionEvent e) |
389 |
|
{ |
390 |
0 |
PCAPrinter printer = new PCAPrinter(); |
391 |
0 |
printer.start(); |
392 |
|
} |
393 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 8 |
Complexity Density: 0.5 |
|
394 |
0 |
@Override... |
395 |
|
public void originalSeqData_actionPerformed(ActionEvent e) |
396 |
|
{ |
397 |
|
|
398 |
|
|
399 |
0 |
if (pcaModel.getSeqtrings() == null) |
400 |
|
{ |
401 |
0 |
jalview.bin.Cache.log.info( |
402 |
|
"Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); |
403 |
0 |
return; |
404 |
|
} |
405 |
|
|
406 |
|
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
0 |
char gc = '-'; |
412 |
0 |
try |
413 |
|
{ |
414 |
|
|
415 |
|
|
416 |
0 |
gc = av.getGapCharacter(); |
417 |
|
} catch (Exception ex) |
418 |
|
{ |
419 |
|
} |
420 |
0 |
; |
421 |
0 |
Object[] alAndColsel = pcaModel.getSeqtrings() |
422 |
|
.getAlignmentAndHiddenColumns(gc); |
423 |
|
|
424 |
0 |
if (alAndColsel != null && alAndColsel[0] != null) |
425 |
|
{ |
426 |
|
|
427 |
|
|
428 |
0 |
AlignmentI al = new Alignment((SequenceI[]) alAndColsel[0]); |
429 |
0 |
AlignmentI dataset = (av != null && av.getAlignment() != null) |
430 |
|
? av.getAlignment().getDataset() |
431 |
|
: null; |
432 |
0 |
if (dataset != null) |
433 |
|
{ |
434 |
0 |
al.setDataset(dataset); |
435 |
|
} |
436 |
|
|
437 |
0 |
if (true) |
438 |
|
{ |
439 |
|
|
440 |
0 |
AlignFrame af = new AlignFrame(al, (HiddenColumns) alAndColsel[1], |
441 |
|
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); |
442 |
|
|
443 |
|
|
444 |
|
|
445 |
|
|
446 |
|
|
447 |
|
|
448 |
|
|
449 |
|
|
450 |
0 |
Desktop.addInternalFrame(af, MessageManager.formatMessage( |
451 |
|
"label.original_data_for_params", new String[] |
452 |
|
{ this.title }), AlignFrame.DEFAULT_WIDTH, |
453 |
|
AlignFrame.DEFAULT_HEIGHT); |
454 |
|
} |
455 |
|
} |
456 |
|
|
457 |
|
|
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
|
|
463 |
|
|
464 |
|
} |
465 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 7 |
Complexity Density: 0.39 |
|
466 |
|
class PCAPrinter extends Thread implements Printable |
467 |
|
{ |
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.4 |
|
468 |
0 |
@Override... |
469 |
|
public void run() |
470 |
|
{ |
471 |
0 |
PrinterJob printJob = PrinterJob.getPrinterJob(); |
472 |
0 |
PageFormat defaultPage = printJob.defaultPage(); |
473 |
0 |
PageFormat pf = printJob.pageDialog(defaultPage); |
474 |
|
|
475 |
0 |
if (defaultPage == pf) |
476 |
|
{ |
477 |
|
|
478 |
|
|
479 |
|
|
480 |
0 |
return; |
481 |
|
} |
482 |
|
|
483 |
0 |
printJob.setPrintable(this, pf); |
484 |
|
|
485 |
0 |
if (printJob.printDialog()) |
486 |
|
{ |
487 |
0 |
try |
488 |
|
{ |
489 |
0 |
printJob.print(); |
490 |
|
} catch (Exception PrintException) |
491 |
|
{ |
492 |
0 |
PrintException.printStackTrace(); |
493 |
|
} |
494 |
|
} |
495 |
|
} |
496 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
497 |
0 |
@Override... |
498 |
|
public int print(Graphics pg, PageFormat pf, int pi) |
499 |
|
throws PrinterException |
500 |
|
{ |
501 |
0 |
pg.translate((int) pf.getImageableX(), (int) pf.getImageableY()); |
502 |
|
|
503 |
0 |
rc.drawBackground(pg, rc.bgColour); |
504 |
0 |
rc.drawScene(pg); |
505 |
0 |
if (rc.drawAxes == true) |
506 |
|
{ |
507 |
0 |
rc.drawAxes(pg); |
508 |
|
} |
509 |
|
|
510 |
0 |
if (pi == 0) |
511 |
|
{ |
512 |
0 |
return Printable.PAGE_EXISTS; |
513 |
|
} |
514 |
|
else |
515 |
|
{ |
516 |
0 |
return Printable.NO_SUCH_PAGE; |
517 |
|
} |
518 |
|
} |
519 |
|
} |
520 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
521 |
0 |
public void makePCAImage(ImageMaker.TYPE type)... |
522 |
|
{ |
523 |
0 |
int width = rc.getWidth(); |
524 |
0 |
int height = rc.getHeight(); |
525 |
0 |
ImageWriterI writer = new ImageWriterI() |
526 |
|
{ |
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
527 |
0 |
@Override... |
528 |
|
public void exportImage(Graphics g) throws Exception |
529 |
|
{ |
530 |
0 |
rc.drawBackground(g, Color.black); |
531 |
0 |
rc.drawScene(g); |
532 |
0 |
if (rc.drawAxes) |
533 |
|
{ |
534 |
0 |
rc.drawAxes(g); |
535 |
|
} |
536 |
|
} |
537 |
|
}; |
538 |
0 |
String pca = MessageManager.getString("label.pca"); |
539 |
0 |
ImageExporter exporter = new ImageExporter(writer, null, type, pca); |
540 |
0 |
exporter.doExport(null, this, width, height, pca); |
541 |
|
} |
542 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
543 |
0 |
@Override... |
544 |
|
public void viewMenu_menuSelected() |
545 |
|
{ |
546 |
0 |
buildAssociatedViewMenu(); |
547 |
|
} |
548 |
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 5 |
Complexity Density: 0.22 |
|
549 |
0 |
void buildAssociatedViewMenu()... |
550 |
|
{ |
551 |
0 |
AlignmentPanel[] aps = PaintRefresher |
552 |
|
.getAssociatedPanels(av.getSequenceSetId()); |
553 |
0 |
if (aps.length == 1 && rc.av == aps[0].av) |
554 |
|
{ |
555 |
0 |
associateViewsMenu.setVisible(false); |
556 |
0 |
return; |
557 |
|
} |
558 |
|
|
559 |
0 |
associateViewsMenu.setVisible(true); |
560 |
|
|
561 |
0 |
if ((viewMenu |
562 |
|
.getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem)) |
563 |
|
{ |
564 |
0 |
viewMenu.insertSeparator(viewMenu.getItemCount() - 1); |
565 |
|
} |
566 |
|
|
567 |
0 |
associateViewsMenu.removeAll(); |
568 |
|
|
569 |
0 |
JRadioButtonMenuItem item; |
570 |
0 |
ButtonGroup buttonGroup = new ButtonGroup(); |
571 |
0 |
int i, iSize = aps.length; |
572 |
0 |
final PCAPanel thisPCAPanel = this; |
573 |
0 |
for (i = 0; i < iSize; i++) |
574 |
|
{ |
575 |
0 |
final AlignmentPanel ap = aps[i]; |
576 |
0 |
item = new JRadioButtonMenuItem(ap.av.viewName, ap.av == rc.av); |
577 |
0 |
buttonGroup.add(item); |
578 |
0 |
item.addActionListener(new ActionListener() |
579 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
580 |
0 |
@Override... |
581 |
|
public void actionPerformed(ActionEvent evt) |
582 |
|
{ |
583 |
0 |
rc.applyToAllViews = false; |
584 |
0 |
rc.av = ap.av; |
585 |
0 |
rc.ap = ap; |
586 |
0 |
PaintRefresher.Register(thisPCAPanel, ap.av.getSequenceSetId()); |
587 |
|
} |
588 |
|
}); |
589 |
|
|
590 |
0 |
associateViewsMenu.add(item); |
591 |
|
} |
592 |
|
|
593 |
0 |
final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem( |
594 |
|
"All Views"); |
595 |
|
|
596 |
0 |
buttonGroup.add(itemf); |
597 |
|
|
598 |
0 |
itemf.setSelected(rc.applyToAllViews); |
599 |
0 |
itemf.addActionListener(new ActionListener() |
600 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
601 |
0 |
@Override... |
602 |
|
public void actionPerformed(ActionEvent evt) |
603 |
|
{ |
604 |
0 |
rc.applyToAllViews = itemf.isSelected(); |
605 |
|
} |
606 |
|
}); |
607 |
0 |
associateViewsMenu.add(itemf); |
608 |
|
|
609 |
|
} |
610 |
|
|
611 |
|
|
612 |
|
|
613 |
|
|
614 |
|
@see |
615 |
|
|
616 |
|
|
617 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
618 |
0 |
@Override... |
619 |
|
protected void outputPoints_actionPerformed(ActionEvent e) |
620 |
|
{ |
621 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
622 |
0 |
try |
623 |
|
{ |
624 |
0 |
cap.setText(pcaModel.getPointsasCsv(false, |
625 |
|
xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), |
626 |
|
zCombobox.getSelectedIndex())); |
627 |
0 |
Desktop.addInternalFrame(cap, MessageManager |
628 |
|
.formatMessage("label.points_for_params", new String[] |
629 |
|
{ this.getTitle() }), 500, 500); |
630 |
|
} catch (OutOfMemoryError oom) |
631 |
|
{ |
632 |
0 |
new OOMWarning("exporting PCA points", oom); |
633 |
0 |
cap.dispose(); |
634 |
|
} |
635 |
|
} |
636 |
|
|
637 |
|
|
638 |
|
|
639 |
|
|
640 |
|
@see |
641 |
|
|
642 |
|
|
643 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
644 |
0 |
@Override... |
645 |
|
protected void outputProjPoints_actionPerformed(ActionEvent e) |
646 |
|
{ |
647 |
0 |
CutAndPasteTransfer cap = new CutAndPasteTransfer(); |
648 |
0 |
try |
649 |
|
{ |
650 |
0 |
cap.setText(pcaModel.getPointsasCsv(true, |
651 |
|
xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), |
652 |
|
zCombobox.getSelectedIndex())); |
653 |
0 |
Desktop.addInternalFrame(cap, MessageManager.formatMessage( |
654 |
|
"label.transformed_points_for_params", new String[] |
655 |
|
{ this.getTitle() }), 500, 500); |
656 |
|
} catch (OutOfMemoryError oom) |
657 |
|
{ |
658 |
0 |
new OOMWarning("exporting transformed PCA points", oom); |
659 |
0 |
cap.dispose(); |
660 |
|
} |
661 |
|
} |
662 |
|
|
663 |
|
|
664 |
|
|
665 |
|
|
666 |
|
@see |
667 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
668 |
0 |
@Override... |
669 |
|
public void setProgressBar(String message, long id) |
670 |
|
{ |
671 |
0 |
progressBar.setProgressBar(message, id); |
672 |
|
|
673 |
|
|
674 |
|
|
675 |
|
|
676 |
|
|
677 |
|
|
678 |
|
|
679 |
|
|
680 |
|
|
681 |
|
|
682 |
|
|
683 |
|
|
684 |
|
|
685 |
|
|
686 |
|
|
687 |
|
|
688 |
|
|
689 |
|
|
690 |
|
|
691 |
|
|
692 |
|
|
693 |
|
|
694 |
|
|
695 |
|
|
696 |
|
|
697 |
|
|
698 |
|
|
699 |
|
|
700 |
|
|
701 |
|
|
702 |
|
|
703 |
|
|
704 |
|
|
705 |
|
|
706 |
|
|
707 |
|
|
708 |
|
|
709 |
|
|
710 |
|
|
711 |
|
|
712 |
|
|
713 |
|
|
714 |
|
|
715 |
|
} |
716 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
717 |
0 |
@Override... |
718 |
|
public void registerHandler(final long id, |
719 |
|
final IProgressIndicatorHandler handler) |
720 |
|
{ |
721 |
0 |
progressBar.registerHandler(id, handler); |
722 |
|
|
723 |
|
|
724 |
|
|
725 |
|
|
726 |
|
|
727 |
|
|
728 |
|
|
729 |
|
|
730 |
|
|
731 |
|
|
732 |
|
|
733 |
|
|
734 |
|
|
735 |
|
|
736 |
|
|
737 |
|
|
738 |
|
|
739 |
|
|
740 |
|
|
741 |
|
|
742 |
|
|
743 |
|
|
744 |
|
|
745 |
|
|
746 |
|
|
747 |
|
} |
748 |
|
|
749 |
|
|
750 |
|
|
751 |
|
@return |
752 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
753 |
0 |
@Override... |
754 |
|
public boolean operationInProgress() |
755 |
|
{ |
756 |
0 |
return progressBar.operationInProgress(); |
757 |
|
} |
758 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
759 |
0 |
@Override... |
760 |
|
protected void resetButton_actionPerformed(ActionEvent e) |
761 |
|
{ |
762 |
0 |
int t = top; |
763 |
0 |
top = 0; |
764 |
0 |
xCombobox.setSelectedIndex(0); |
765 |
0 |
yCombobox.setSelectedIndex(1); |
766 |
0 |
top = t; |
767 |
0 |
zCombobox.setSelectedIndex(2); |
768 |
|
} |
769 |
|
|
770 |
|
|
771 |
|
|
772 |
|
|
773 |
|
@return |
774 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
775 |
0 |
public boolean isWorking()... |
776 |
|
{ |
777 |
0 |
return working; |
778 |
|
} |
779 |
|
} |