Clover icon

Coverage Report

  1. Project Clover database Mon Nov 18 2024 09:38:20 GMT
  2. Package jalview.gui

File PCAPanel.java

 

Coverage histogram

../../img/srcFileCovDistChart0.png
54% 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.00%
PCAPanel.PCAPrinter 386 18 7
0.00%
 

Contributing tests

No tests hitting this source file were found.

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  0 toggle 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    {
 
109  0 toggle @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    // 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  0 this.getContentPane().add(getRotatableCanvas(), BorderLayout.CENTER);
154   
155  0 addKeyListener(getRotatableCanvas());
156  0 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  0 toggle 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   
 
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  0 toggle @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    // rc.invalidate();
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    * Updates the PCA display after a change of component to use for x, y or z
241    * axis
242    */
 
243  0 toggle @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    * 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  0 toggle 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   
 
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  0 toggle 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   
 
731  0 toggle public void setShowLabels(boolean show)
732    {
733  0 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  0 toggle public void setInputData(AlignmentView data)
744    {
745  0 getPcaModel().setInputData(data);
746  0 originalSeqData.setVisible(data != null);
747    }
748   
 
749  0 toggle public AlignViewportI getAlignViewport()
750    {
751  0 return av;
752    }
753   
 
754  0 toggle public PCAModel getPcaModel()
755    {
756  0 return pcaModel;
757    }
758   
 
759  0 toggle public void setPcaModel(PCAModel pcaModel)
760    {
761  0 this.pcaModel = pcaModel;
762    }
763   
 
764  0 toggle public RotatableCanvas getRotatableCanvas()
765    {
766  0 return rc;
767    }
768   
 
769  0 toggle public void setRotatableCanvas(RotatableCanvas rc)
770    {
771  0 this.rc = rc;
772    }
773   
 
774  0 toggle public int getTop()
775    {
776  0 return top;
777    }
778   
 
779  0 toggle public void setTop(int top)
780    {
781  0 this.top = top;
782    }
783   
784    /**
785    * set the associated view for this PCA.
786    *
787    * @param panel
788    */
 
789  0 toggle 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   
 
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    }