Clover icon

Coverage Report

  1. Project Clover database Fri Dec 6 2024 13:47:14 GMT
  2. Package jalview.gui

File PCAPanel.java

 

Coverage histogram

../../img/srcFileCovDistChart4.png
49% of files have more coverage

Code metrics

36
205
41
2
816
527
74
0.36
5
20.5
1.8

Classes

Class Line # Actions
PCAPanel 66 187 67
0.4173228441.7%
PCAPanel.PCAPrinter 386 18 7
0.00%
 

Contributing tests

This file is covered by 4 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
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    * The panel holding the Principal Component Analysis 3-D visualisation
65    */
 
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    * Constructor given sequence data, a similarity (or distance) score model
90    * name, and score calculation parameters
91    *
92    * @param alignPanel
93    * @param modelName
94    * @param params
95    */
 
96  2 toggle public PCAPanel(AlignmentPanel alignPanel, String modelName,
97    SimilarityParamsI params)
98    {
99  2 super();
100  2 this.setFrameIcon(null);
101  2 this.av = alignPanel.av;
102  2 this.ap = alignPanel;
103  2 boolean nucleotide = av.getAlignment().isNucleotide();
104   
105  2 progressBar = new ProgressBar(statusPanel, statusBar);
106   
107  2 addInternalFrameListener(new InternalFrameAdapter()
108    {
 
109  2 toggle @Override
110    public void internalFrameClosed(InternalFrameEvent e)
111    {
112  2 close_actionPerformed();
113    }
114    });
115   
116  2 boolean selected = av.getSelectionGroup() != null
117    && av.getSelectionGroup().getSize() > 0;
118  2 AlignmentView seqstrings = av.getAlignmentView(selected);
119  2 SequenceI[] seqs;
120  2 if (!selected)
121    {
122  2 seqs = av.getAlignment().getSequencesArray();
123    }
124    else
125    {
126  0 seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment());
127    }
128   
129  2 ScoreModelI scoreModel = ScoreModels.getInstance()
130    .getScoreModel(modelName, ap);
131  2 setPcaModel(
132    new PCAModel(seqstrings, seqs, nucleotide, scoreModel, params));
133   
134  2 newPcaTitle = alignPanel.alignFrame.formCalculationTitle(
135    MessageManager.formatMessage("label.calc_title", "PCA",
136    getPcaModel().getScoreModelName()),
137    selected, ap.alignFrame.getTitle());
138   
139  2 PaintRefresher.Register(this, av.getSequenceSetId());
140   
141  2 setRotatableCanvas(new RotatableCanvas(alignPanel));
142   
143  2 if (params.getSecondaryStructureSource() != null)
144    {
145    // Initialize and set subtitle text
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  2 this.getContentPane().add(getRotatableCanvas(), BorderLayout.CENTER);
154   
155  2 addKeyListener(getRotatableCanvas());
156  2 validate();
157    }
158   
159    /**
160    * Ensure references to potentially very large objects (the PCA matrices) are
161    * nulled when the frame is closed
162    */
 
163  2 toggle protected void close_actionPerformed()
164    {
165  2 setPcaModel(null);
166  2 if (this.rc != null)
167    {
168  2 this.rc.sequencePoints = null;
169  2 this.rc.setAxisEndPoints(null);
170  2 this.rc = null;
171    }
172    }
173   
 
174  0 toggle @Override
175    protected void bgcolour_actionPerformed()
176    {
177  0 String ttl = MessageManager.getString("label.select_background_colour");
178  0 ColourChooserListener listener = new ColourChooserListener()
179    {
 
180  0 toggle @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    * Calculates the PCA and displays the results
193    */
 
194  1 toggle @Override
195    public void run()
196    {
197  1 working = true;
198  1 long progId = System.currentTimeMillis();
199  1 IProgressIndicator progress = this;
200  1 String message = MessageManager.getString("label.pca_recalculating");
201  1 if (getParent() == null)
202    {
203  1 progress = ap.alignFrame;
204  1 message = MessageManager.getString("label.pca_calculating");
205    }
206  1 progress.setProgressBar(message, progId);
207  1 try
208    {
209  1 getPcaModel().calculate();
210   
211  1 xCombobox.setSelectedIndex(0);
212  1 yCombobox.setSelectedIndex(1);
213  1 zCombobox.setSelectedIndex(2);
214   
215  1 getPcaModel().updateRc(getRotatableCanvas());
216    // rc.invalidate();
217  1 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  1 progress.setProgressBar("", progId);
227    }
228   
229  1 repaint();
230  1 if (getParent() == null)
231    {
232  1 Desktop.addInternalFrame(this, newPcaTitle,
233    475, 450);
234  1 this.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
235    }
236  1 working = false;
237    }
238   
239    /**
240    * Updates the PCA display after a change of component to use for x, y or z
241    * axis
242    */
 
243  12 toggle @Override
244    protected void doDimensionChange()
245    {
246  12 if (getTop() == 0)
247    {
248  12 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    * Sets the selected checkbox item index for PCA dimension (1, 2, 3...) for
260    * the given axis (X/Y/Z)
261    *
262    * @param index
263    * @param axis
264    */
 
265  3 toggle public void setSelectedDimensionIndex(int index, Axis axis)
266    {
267  3 switch (axis)
268    {
269  1 case X:
270  1 xCombobox.setSelectedIndex(index);
271  1 break;
272  1 case Y:
273  1 yCombobox.setSelectedIndex(index);
274  1 break;
275  1 case Z:
276  1 zCombobox.setSelectedIndex(index);
277  1 break;
278  0 default:
279    }
280    }
281   
 
282  0 toggle @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   
 
298  0 toggle @Override
299    protected void showLabels_actionPerformed()
300    {
301  0 getRotatableCanvas().showLabels(showLabels.getState());
302    }
303   
 
304  0 toggle @Override
305    protected void print_actionPerformed()
306    {
307  0 PCAPrinter printer = new PCAPrinter();
308  0 printer.start();
309    }
310   
311    /**
312    * If available, shows the data which formed the inputs for the PCA as a new
313    * alignment
314    */
 
315  0 toggle @Override
316    public void originalSeqData_actionPerformed()
317    {
318    // JAL-2647 disabled after load from project (until save to project done)
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    // decide if av alignment is sufficiently different to original data to
326    // warrant a new window to be created
327    // create new alignment window with hidden regions (unhiding hidden regions
328    // yields unaligned seqs)
329    // or create a selection box around columns in alignment view
330    // test Alignment(SeqCigar[])
331  0 char gc = '-';
332  0 try
333    {
334    // we try to get the associated view's gap character
335    // but this may fail if the view was closed...
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    // AlignmentOrder origorder = new AlignmentOrder(alAndColsel[0]);
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    // make a new frame!
360  0 AlignFrame af = new AlignFrame(al, (HiddenColumns) alAndColsel[1],
361    AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
362   
363    // >>>This is a fix for the moment, until a better solution is
364    // found!!<<<
365    // af.getFeatureRenderer().transferSettings(alignFrame.getFeatureRenderer());
366   
367    // af.addSortByOrderMenuItem(ServiceName + " Ordering",
368    // msaorder);
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    * CutAndPasteTransfer cap = new CutAndPasteTransfer(); for (int i = 0; i <
378    * seqs.length; i++) { cap.appendText(new jalview.util.Format("%-" + 15 +
379    * "s").form( seqs[i].getName())); cap.appendText(" " + seqstrings[i] +
380    * "\n"); }
381    *
382    * Desktop.addInternalFrame(cap, "Original Data", 400, 400);
383    */
384    }
385   
 
386    class PCAPrinter extends Thread implements Printable
387    {
 
388  0 toggle @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    * user cancelled
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   
 
417  0 toggle @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   
 
441  0 toggle 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    {
 
447  0 toggle @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   
 
471  0 toggle @Override
472    protected void viewMenu_menuSelected()
473    {
474  0 buildAssociatedViewMenu();
475    }
476   
477    /**
478    * Builds the menu showing the choice of possible views (for the associated
479    * sequence data) to which the PCA may be linked
480    */
 
481  0 toggle 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    {
 
513  0 toggle @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    {
 
531  0 toggle @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    * (non-Javadoc)
543    *
544    * @see
545    * jalview.jbgui.GPCAPanel#outputPoints_actionPerformed(java.awt.event.ActionEvent
546    * )
547    */
 
548  0 toggle @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    * (non-Javadoc)
569    *
570    * @see
571    * jalview.jbgui.GPCAPanel#outputProjPoints_actionPerformed(java.awt.event
572    * .ActionEvent)
573    */
 
574  0 toggle @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    * (non-Javadoc)
595    *
596    * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
597    */
 
598  0 toggle @Override
599    public void setProgressBar(String message, long id)
600    {
601  0 progressBar.setProgressBar(message, id);
602    // if (progressBars == null)
603    // {
604    // progressBars = new Hashtable();
605    // progressBarHandlers = new Hashtable();
606    // }
607    //
608    // JPanel progressPanel;
609    // Long lId = Long.valueOf(id);
610    // GridLayout layout = (GridLayout) statusPanel.getLayout();
611    // if (progressBars.get(lId) != null)
612    // {
613    // progressPanel = (JPanel) progressBars.get(Long.valueOf(id));
614    // statusPanel.remove(progressPanel);
615    // progressBars.remove(lId);
616    // progressPanel = null;
617    // if (message != null)
618    // {
619    // statusBar.setText(message);
620    // }
621    // if (progressBarHandlers.contains(lId))
622    // {
623    // progressBarHandlers.remove(lId);
624    // }
625    // layout.setRows(layout.getRows() - 1);
626    // }
627    // else
628    // {
629    // progressPanel = new JPanel(new BorderLayout(10, 5));
630    //
631    // JProgressBar progressBar = new JProgressBar();
632    // progressBar.setIndeterminate(true);
633    //
634    // progressPanel.add(new JLabel(message), BorderLayout.WEST);
635    // progressPanel.add(progressBar, BorderLayout.CENTER);
636    //
637    // layout.setRows(layout.getRows() + 1);
638    // statusPanel.add(progressPanel);
639    //
640    // progressBars.put(lId, progressPanel);
641    // }
642    // // update GUI
643    // // setMenusForViewport();
644    // validate();
645    }
646   
 
647  0 toggle @Override
648    public void registerHandler(final long id,
649    final IProgressIndicatorHandler handler)
650    {
651  0 progressBar.registerHandler(id, handler);
652    // if (progressBarHandlers == null ||
653    // !progressBars.contains(Long.valueOf(id)))
654    // {
655    // throw new
656    // Error(MessageManager.getString("error.call_setprogressbar_before_registering_handler"));
657    // }
658    // progressBarHandlers.put(Long.valueOf(id), handler);
659    // final JPanel progressPanel = (JPanel) progressBars.get(Long.valueOf(id));
660    // if (handler.canCancel())
661    // {
662    // JButton cancel = new JButton(
663    // MessageManager.getString("action.cancel"));
664    // final IProgressIndicator us = this;
665    // cancel.addActionListener(new ActionListener()
666    // {
667    //
668    // @Override
669    // public void actionPerformed(ActionEvent e)
670    // {
671    // handler.cancelActivity(id);
672    // us.setProgressBar(MessageManager.formatMessage("label.cancelled_params",
673    // new String[]{((JLabel) progressPanel.getComponent(0)).getText()}), id);
674    // }
675    // });
676    // progressPanel.add(cancel, BorderLayout.EAST);
677    // }
678    }
679   
680    /**
681    *
682    * @return true if any progress bars are still active
683    */
 
684  0 toggle @Override
685    public boolean operationInProgress()
686    {
687  0 return progressBar.operationInProgress();
688    }
689   
 
690  0 toggle @Override
691    protected void resetButton_actionPerformed()
692    {
693  0 int t = getTop();
694  0 setTop(0); // ugly - prevents dimensionChanged events from being processed
695  0 xCombobox.setSelectedIndex(0);
696  0 yCombobox.setSelectedIndex(1);
697  0 setTop(t);
698  0 zCombobox.setSelectedIndex(2);
699    }
700   
701    /**
702    * Answers true if PCA calculation is in progress, else false
703    *
704    * @return
705    */
 
706  0 toggle public boolean isWorking()
707    {
708  0 return working;
709    }
710   
711    /**
712    * Answers the selected checkbox item index for PCA dimension for the X, Y or
713    * Z axis of the display
714    *
715    * @param axis
716    * @return
717    */
 
718  3 toggle public int getSelectedDimensionIndex(Axis axis)
719    {
720  3 switch (axis)
721    {
722  1 case X:
723  1 return xCombobox.getSelectedIndex();
724  1 case Y:
725  1 return yCombobox.getSelectedIndex();
726  1 default:
727  1 return zCombobox.getSelectedIndex();
728    }
729    }
730   
 
731  1 toggle public void setShowLabels(boolean show)
732    {
733  1 showLabels.setSelected(show);
734    }
735   
736    /**
737    * Sets the input data used to calculate the PCA. This is provided for
738    * 'restore from project', which does not currently support this (AL-2647), so
739    * sets the value to null, and hides the menu option for "Input Data...". J
740    *
741    * @param data
742    */
 
743  1 toggle public void setInputData(AlignmentView data)
744    {
745  1 getPcaModel().setInputData(data);
746  1 originalSeqData.setVisible(data != null);
747    }
748   
 
749  10 toggle public AlignViewportI getAlignViewport()
750    {
751  10 return av;
752    }
753   
 
754  10 toggle public PCAModel getPcaModel()
755    {
756  10 return pcaModel;
757    }
758   
 
759  4 toggle public void setPcaModel(PCAModel pcaModel)
760    {
761  4 this.pcaModel = pcaModel;
762    }
763   
 
764  24 toggle public RotatableCanvas getRotatableCanvas()
765    {
766  24 return rc;
767    }
768   
 
769  2 toggle public void setRotatableCanvas(RotatableCanvas rc)
770    {
771  2 this.rc = rc;
772    }
773   
 
774  12 toggle public int getTop()
775    {
776  12 return top;
777    }
778   
 
779  2 toggle public void setTop(int top)
780    {
781  2 this.top = top;
782    }
783   
784    /**
785    * set the associated view for this PCA.
786    *
787    * @param panel
788    */
 
789  1 toggle public void selectAssociatedView(AlignmentPanel panel)
790    {
791  1 getRotatableCanvas().setApplyToAllViews(false);
792   
793  1 ap = panel;
794  1 av = panel.av;
795   
796  1 getRotatableCanvas().av = panel.av;
797  1 getRotatableCanvas().ap = panel;
798  1 PaintRefresher.Register(PCAPanel.this, panel.av.getSequenceSetId());
799    }
800   
 
801  0 toggle @Override
802    public JProgressBar getProgressBar(long id)
803    {
804  0 return progressBar.getProgressBar(id);
805    }
806   
 
807  0 toggle public String getMessage(long id)
808    {
809  0 return progressBar.getMessage(id);
810    }
811   
 
812  0 toggle public void setProgressBarMessage(long id, String message)
813    {
814  0 progressBar.setProgressBarMessage(id, message);
815    }
816    }