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