X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPCAPanel.java;h=576f3b2954a7fc07a70832fcd6a2c612158309a9;hb=5640ec0623c6d1205e62f9fe15292f32bfdab7d9;hp=3d38a873ec2245c1fa88e5ed392c8d6a8433afe5;hpb=fbd03b3f123f3462c5fe685c988e5c4ae601558c;p=jalview.git
diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java
old mode 100755
new mode 100644
index 3d38a87..576f3b2
--- a/src/jalview/gui/PCAPanel.java
+++ b/src/jalview/gui/PCAPanel.java
@@ -1,283 +1,311 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.print.*;
-import javax.swing.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.jbgui.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JMenuItem;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
+
+import jalview.analysis.scoremodels.ScoreModels;
+import jalview.api.AlignViewportI;
+import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.SimilarityParamsI;
+import jalview.bin.Console;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.SequenceI;
+import jalview.gui.ImageExporter.ImageWriterI;
+import jalview.gui.JalviewColourChooser.ColourChooserListener;
+import jalview.io.exceptions.ImageOutputException;
+import jalview.jbgui.GPCAPanel;
+import jalview.math.RotatableMatrix.Axis;
+import jalview.util.ImageMaker;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.viewmodel.PCAModel;
/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
+ * The panel holding the Principal Component Analysis 3-D visualisation
*/
-public class PCAPanel extends GPCAPanel implements Runnable
+public class PCAPanel extends GPCAPanel
+ implements Runnable, IProgressIndicator
{
+ private static final int MIN_WIDTH = 470;
- PCA pca;
+ private static final int MIN_HEIGHT = 250;
- int top;
-
- RotatableCanvas rc;
+ private RotatableCanvas rc;
AlignmentPanel ap;
- AlignViewport av;
+ AlignmentViewport av;
+
+ private PCAModel pcaModel;
+
+ private int top = 0;
- AlignmentView seqstrings;
+ private IProgressIndicator progressBar;
- SequenceI[] seqs;
+ private boolean working;
/**
- * Creates a new PCAPanel object.
+ * Constructor given sequence data, a similarity (or distance) score model
+ * name, and score calculation parameters
*
- * @param av
- * DOCUMENT ME!
- * @param s
- * DOCUMENT ME!
+ * @param alignPanel
+ * @param modelName
+ * @param params
*/
- public PCAPanel(AlignmentPanel ap)
+ public PCAPanel(AlignmentPanel alignPanel, String modelName,
+ SimilarityParamsI params)
{
- this.av = ap.av;
- this.ap = ap;
+ super();
+ this.setFrameIcon(null);
+ this.av = alignPanel.av;
+ this.ap = alignPanel;
+ boolean nucleotide = av.getAlignment().isNucleotide();
- boolean sameLength = true;
-
- seqstrings = av.getAlignmentView(av.getSelectionGroup() != null);
- if (av.getSelectionGroup() == null)
- {
- seqs = av.alignment.getSequencesArray();
- }
- else
- {
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
- }
- SeqCigar sq[] = seqstrings.getSequences();
- int length = sq[0].getWidth();
+ progressBar = new ProgressBar(statusPanel, statusBar);
- for (int i = 0; i < seqs.length; i++)
+ addInternalFrameListener(new InternalFrameAdapter()
{
- if (sq[i].getWidth() != length)
+ @Override
+ public void internalFrameClosed(InternalFrameEvent e)
{
- sameLength = false;
- break;
+ close_actionPerformed();
}
- }
+ });
- if (!sameLength)
+ boolean selected = av.getSelectionGroup() != null
+ && av.getSelectionGroup().getSize() > 0;
+ AlignmentView seqstrings = av.getAlignmentView(selected);
+ SequenceI[] seqs;
+ if (!selected)
{
- JOptionPane
- .showMessageDialog(
- Desktop.desktop,
- "The sequences must be aligned before calculating PCA.\n"
- + "Try using the Pad function in the edit menu,\n"
- + "or one of the multiple sequence alignment web services.",
- "Sequences not aligned", JOptionPane.WARNING_MESSAGE);
-
- return;
+ seqs = av.getAlignment().getSequencesArray();
+ }
+ else
+ {
+ seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment());
}
- Desktop
- .addInternalFrame(this, "Principal component analysis", 400,
- 400);
-
+ ScoreModelI scoreModel = ScoreModels.getInstance()
+ .getScoreModel(modelName, ap);
+ setPcaModel(
+ new PCAModel(seqstrings, seqs, nucleotide, scoreModel, params));
PaintRefresher.Register(this, av.getSequenceSetId());
- rc = new RotatableCanvas(ap);
- this.getContentPane().add(rc, BorderLayout.CENTER);
- Thread worker = new Thread(this);
- worker.start();
+ setRotatableCanvas(new RotatableCanvas(alignPanel));
+ this.getContentPane().add(getRotatableCanvas(), BorderLayout.CENTER);
+
+ addKeyListener(getRotatableCanvas());
+ validate();
}
- public void bgcolour_actionPerformed(ActionEvent e)
+ /**
+ * Ensure references to potentially very large objects (the PCA matrices) are
+ * nulled when the frame is closed
+ */
+ protected void close_actionPerformed()
{
- Color col = JColorChooser.showDialog(this, "Select Background Colour",
- rc.bgColour);
-
- if (col != null)
+ setPcaModel(null);
+ if (this.rc != null)
{
- rc.bgColour = col;
+ this.rc.sequencePoints = null;
+ this.rc.setAxisEndPoints(null);
+ this.rc = null;
}
- rc.repaint();
+ }
+
+ @Override
+ protected void bgcolour_actionPerformed()
+ {
+ String ttl = MessageManager.getString("label.select_background_colour");
+ ColourChooserListener listener = new ColourChooserListener()
+ {
+ @Override
+ public void colourSelected(Color c)
+ {
+ rc.setBgColour(c);
+ rc.repaint();
+ }
+ };
+ JalviewColourChooser.showColourChooser(this, ttl, rc.getBgColour(),
+ listener);
}
/**
- * DOCUMENT ME!
+ * Calculates the PCA and displays the results
*/
+ @Override
public void run()
{
+ working = true;
+ long progId = System.currentTimeMillis();
+ IProgressIndicator progress = this;
+ String message = MessageManager.getString("label.pca_recalculating");
+ if (getParent() == null)
+ {
+ progress = ap.alignFrame;
+ message = MessageManager.getString("label.pca_calculating");
+ }
+ progress.setProgressBar(message, progId);
try
{
- pca = new PCA(seqstrings.getSequenceStrings(' '));
- pca.run();
-
- // Now find the component coordinates
- int ii = 0;
-
- while ((ii < seqs.length) && (seqs[ii] != null))
- {
- ii++;
- }
-
- double[][] comps = new double[ii][ii];
+ getPcaModel().calculate();
- for (int i = 0; i < ii; i++)
- {
- if (pca.getEigenvalue(i) > 1e-4)
- {
- comps[i] = pca.component(i);
- }
- }
-
- // ////////////////
xCombobox.setSelectedIndex(0);
yCombobox.setSelectedIndex(1);
zCombobox.setSelectedIndex(2);
- top = pca.getM().rows - 1;
-
- Vector points = new Vector();
- float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100);
-
- for (int i = 0; i < pca.getM().rows; i++)
- {
- SequencePoint sp = new SequencePoint(seqs[i], scores[i]);
- points.addElement(sp);
- }
-
- rc.setPoints(points, pca.getM().rows);
- rc.repaint();
-
- addKeyListener(rc);
+ getPcaModel().updateRc(getRotatableCanvas());
+ // rc.invalidate();
+ setTop(getPcaModel().getTop());
} catch (OutOfMemoryError er)
{
new OOMWarning("calculating PCA", er);
-
- }
-
- }
-
- /**
- * DOCUMENT ME!
- */
- void doDimensionChange()
- {
- if (top == 0)
- {
+ working = false;
return;
+ } finally
+ {
+ progress.setProgressBar("", progId);
}
- int dim1 = top - xCombobox.getSelectedIndex();
- int dim2 = top - yCombobox.getSelectedIndex();
- int dim3 = top - zCombobox.getSelectedIndex();
-
- float[][] scores = pca.getComponents(dim1, dim2, dim3, 100);
-
- for (int i = 0; i < pca.getM().rows; i++)
+ repaint();
+ if (getParent() == null)
{
- ((SequencePoint) rc.points.elementAt(i)).coord = scores[i];
+ Desktop.addInternalFrame(this,
+ MessageManager.formatMessage("label.calc_title", "PCA",
+ getPcaModel().getScoreModelName()),
+ 475, 450);
+ this.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
}
-
- rc.img = null;
- rc.rotmat.setIdentity();
- rc.initAxes();
- rc.paint(rc.getGraphics());
+ working = false;
}
/**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
+ * Updates the PCA display after a change of component to use for x, y or z
+ * axis
*/
- protected void xCombobox_actionPerformed(ActionEvent e)
+ @Override
+ protected void doDimensionChange()
{
- doDimensionChange();
- }
+ if (getTop() == 0)
+ {
+ return;
+ }
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void yCombobox_actionPerformed(ActionEvent e)
- {
- doDimensionChange();
+ int dim1 = getTop() - xCombobox.getSelectedIndex();
+ int dim2 = getTop() - yCombobox.getSelectedIndex();
+ int dim3 = getTop() - zCombobox.getSelectedIndex();
+ getPcaModel().updateRcView(dim1, dim2, dim3);
+ getRotatableCanvas().resetView();
}
/**
- * DOCUMENT ME!
+ * Sets the selected checkbox item index for PCA dimension (1, 2, 3...) for
+ * the given axis (X/Y/Z)
*
- * @param e
- * DOCUMENT ME!
+ * @param index
+ * @param axis
*/
- protected void zCombobox_actionPerformed(ActionEvent e)
+ public void setSelectedDimensionIndex(int index, Axis axis)
{
- doDimensionChange();
+ switch (axis)
+ {
+ case X:
+ xCombobox.setSelectedIndex(index);
+ break;
+ case Y:
+ yCombobox.setSelectedIndex(index);
+ break;
+ case Z:
+ zCombobox.setSelectedIndex(index);
+ break;
+ default:
+ }
}
- public void outputValues_actionPerformed(ActionEvent e)
+ @Override
+ protected void outputValues_actionPerformed()
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
- try {
- cap.setText(pca.getDetails());
- Desktop.addInternalFrame(cap, "PCA details", 500, 500);
+ try
+ {
+ cap.setText(getPcaModel().getDetails());
+ Desktop.addInternalFrame(cap,
+ MessageManager.getString("label.pca_details"), 500, 500);
} catch (OutOfMemoryError oom)
{
- new OOMWarning("opening PCA details",oom);
+ new OOMWarning("opening PCA details", oom);
cap.dispose();
}
}
- public void showLabels_actionPerformed(ActionEvent e)
+ @Override
+ protected void showLabels_actionPerformed()
{
- rc.showLabels(showLabels.getState());
+ getRotatableCanvas().showLabels(showLabels.getState());
}
- public void print_actionPerformed(ActionEvent e)
+ @Override
+ protected void print_actionPerformed()
{
PCAPrinter printer = new PCAPrinter();
printer.start();
}
- public void originalSeqData_actionPerformed(ActionEvent e)
+ /**
+ * If available, shows the data which formed the inputs for the PCA as a new
+ * alignment
+ */
+ @Override
+ public void originalSeqData_actionPerformed()
{
- // this was cut'n'pasted from the equivalent TreePanel method - we should
- // make this an abstract function of all jalview analysis windows
- if (seqstrings == null)
+ // JAL-2647 disabled after load from project (until save to project done)
+ if (getPcaModel().getInputData() == null)
{
- jalview.bin.Cache.log
- .info("Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action.");
+ Console.info(
+ "Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action.");
return;
}
// decide if av alignment is sufficiently different to original data to
// warrant a new window to be created
- // create new alignmnt window with hidden regions (unhiding hidden regions
+ // create new alignment window with hidden regions (unhiding hidden regions
// yields unaligned seqs)
// or create a selection box around columns in alignment view
// test Alignment(SeqCigar[])
@@ -290,16 +318,18 @@ public class PCAPanel extends GPCAPanel implements Runnable
} catch (Exception ex)
{
}
- ;
- Object[] alAndColsel = seqstrings.getAlignmentAndColumnSelection(gc);
+
+ Object[] alAndColsel = getPcaModel().getInputData()
+ .getAlignmentAndHiddenColumns(gc);
if (alAndColsel != null && alAndColsel[0] != null)
{
// AlignmentOrder origorder = new AlignmentOrder(alAndColsel[0]);
- Alignment al = new Alignment((SequenceI[]) alAndColsel[0]);
- Alignment dataset = (av != null && av.getAlignment() != null) ? av
- .getAlignment().getDataset() : null;
+ AlignmentI al = new Alignment((SequenceI[]) alAndColsel[0]);
+ AlignmentI dataset = (av != null && av.getAlignment() != null)
+ ? av.getAlignment().getDataset()
+ : null;
if (dataset != null)
{
al.setDataset(dataset);
@@ -308,9 +338,8 @@ public class PCAPanel extends GPCAPanel implements Runnable
if (true)
{
// make a new frame!
- AlignFrame af = new AlignFrame(al,
- (ColumnSelection) alAndColsel[1], AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
+ AlignFrame af = new AlignFrame(al, (HiddenColumns) alAndColsel[1],
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
// >>>This is a fix for the moment, until a better solution is
// found!!<<<
@@ -319,8 +348,10 @@ public class PCAPanel extends GPCAPanel implements Runnable
// af.addSortByOrderMenuItem(ServiceName + " Ordering",
// msaorder);
- Desktop.addInternalFrame(af, "Original Data for " + this.title,
- AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ Desktop.addInternalFrame(af, MessageManager.formatMessage(
+ "label.original_data_for_params", new String[]
+ { this.title }), AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
}
}
/*
@@ -335,10 +366,20 @@ public class PCAPanel extends GPCAPanel implements Runnable
class PCAPrinter extends Thread implements Printable
{
+ @Override
public void run()
{
PrinterJob printJob = PrinterJob.getPrinterJob();
- PageFormat pf = printJob.pageDialog(printJob.defaultPage());
+ PageFormat defaultPage = printJob.defaultPage();
+ PageFormat pf = printJob.pageDialog(defaultPage);
+
+ if (defaultPage == pf)
+ {
+ /*
+ * user cancelled
+ */
+ return;
+ }
printJob.setPrintable(this, pf);
@@ -354,16 +395,17 @@ public class PCAPanel extends GPCAPanel implements Runnable
}
}
+ @Override
public int print(Graphics pg, PageFormat pf, int pi)
throws PrinterException
{
pg.translate((int) pf.getImageableX(), (int) pf.getImageableY());
- rc.drawBackground(pg, rc.bgColour);
- rc.drawScene(pg);
- if (rc.drawAxes == true)
+ getRotatableCanvas().drawBackground(pg);
+ getRotatableCanvas().drawScene(pg);
+ if (getRotatableCanvas().drawAxes)
{
- rc.drawAxes(pg);
+ getRotatableCanvas().drawAxes(pg);
}
if (pi == 0)
@@ -377,69 +419,51 @@ public class PCAPanel extends GPCAPanel implements Runnable
}
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- public void eps_actionPerformed(ActionEvent e)
- {
- makePCAImage(jalview.util.ImageMaker.EPS);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- public void png_actionPerformed(ActionEvent e)
- {
- makePCAImage(jalview.util.ImageMaker.PNG);
- }
-
- void makePCAImage(int type)
+ public void makePCAImage(ImageMaker.TYPE type)
{
- int width = rc.getWidth();
- int height = rc.getHeight();
-
- jalview.util.ImageMaker im;
-
- if (type == jalview.util.ImageMaker.PNG)
+ int width = getRotatableCanvas().getWidth();
+ int height = getRotatableCanvas().getHeight();
+ ImageWriterI writer = new ImageWriterI()
{
- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.PNG,
- "Make PNG image from PCA", width, height, null, null);
- }
- else
- {
- im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.EPS,
- "Make EPS file from PCA", width, height, null, this
- .getTitle());
- }
-
- if (im.getGraphics() != null)
- {
- rc.drawBackground(im.getGraphics(), Color.black);
- rc.drawScene(im.getGraphics());
- if (rc.drawAxes == true)
+ @Override
+ public void exportImage(Graphics g) throws Exception
{
- rc.drawAxes(im.getGraphics());
+ RotatableCanvas canvas = getRotatableCanvas();
+ canvas.drawBackground(g);
+ canvas.drawScene(g);
+ if (canvas.drawAxes)
+ {
+ canvas.drawAxes(g);
+ }
}
- im.writeImage();
+ };
+ String pca = MessageManager.getString("label.pca");
+ ImageExporter exporter = new ImageExporter(writer, null, type, pca);
+ try
+ {
+ exporter.doExport(null, this, width, height, pca);
+ } catch (ImageOutputException ioex)
+ {
+ Console.error("Unexpected error whilst writing " + type.toString(),
+ ioex);
}
}
- public void viewMenu_menuSelected()
+ @Override
+ protected void viewMenu_menuSelected()
{
buildAssociatedViewMenu();
}
+ /**
+ * Builds the menu showing the choice of possible views (for the associated
+ * sequence data) to which the PCA may be linked
+ */
void buildAssociatedViewMenu()
{
- AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(av
- .getSequenceSetId());
- if (aps.length == 1 && rc.av == aps[0].av)
+ AlignmentPanel[] aps = PaintRefresher
+ .getAssociatedPanels(av.getSequenceSetId());
+ if (aps.length == 1 && getRotatableCanvas().av == aps[0].av)
{
associateViewsMenu.setVisible(false);
return;
@@ -447,7 +471,8 @@ public class PCAPanel extends GPCAPanel implements Runnable
associateViewsMenu.setVisible(true);
- if ((viewMenu.getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem))
+ if ((viewMenu
+ .getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem))
{
viewMenu.insertSeparator(viewMenu.getItemCount() - 1);
}
@@ -456,116 +481,301 @@ public class PCAPanel extends GPCAPanel implements Runnable
JRadioButtonMenuItem item;
ButtonGroup buttonGroup = new ButtonGroup();
- int i, iSize = aps.length;
- final PCAPanel thisPCAPanel = this;
- for (i = 0; i < iSize; i++)
+ int iSize = aps.length;
+
+ for (int i = 0; i < iSize; i++)
{
- final AlignmentPanel ap = aps[i];
- item = new JRadioButtonMenuItem(ap.av.viewName, ap.av == rc.av);
+ final AlignmentPanel panel = aps[i];
+ item = new JRadioButtonMenuItem(panel.av.getViewName(),
+ panel.av == getRotatableCanvas().av);
buttonGroup.add(item);
item.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
- rc.applyToAllViews = false;
- rc.av = ap.av;
- rc.ap = ap;
- PaintRefresher.Register(thisPCAPanel, ap.av.getSequenceSetId());
+ selectAssociatedView(panel);
}
});
associateViewsMenu.add(item);
}
- final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem("All Views");
+ final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem(
+ "All Views");
buttonGroup.add(itemf);
- itemf.setSelected(rc.applyToAllViews);
+ itemf.setSelected(getRotatableCanvas().isApplyToAllViews());
itemf.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
- rc.applyToAllViews = itemf.isSelected();
+ getRotatableCanvas().setApplyToAllViews(itemf.isSelected());
}
});
associateViewsMenu.add(itemf);
}
- /* (non-Javadoc)
- * @see jalview.jbgui.GPCAPanel#outputPoints_actionPerformed(java.awt.event.ActionEvent)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GPCAPanel#outputPoints_actionPerformed(java.awt.event.ActionEvent
+ * )
*/
- protected void outputPoints_actionPerformed(ActionEvent e)
+ @Override
+ protected void outputPoints_actionPerformed()
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
- try {
- cap.setText(getPointsasCsv(false));
- Desktop.addInternalFrame(cap, "Points for "+getTitle(), 500, 500);
+ try
+ {
+ cap.setText(getPcaModel().getPointsasCsv(false,
+ xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(),
+ zCombobox.getSelectedIndex()));
+ Desktop.addInternalFrame(cap, MessageManager
+ .formatMessage("label.points_for_params", new String[]
+ { this.getTitle() }), 500, 500);
} catch (OutOfMemoryError oom)
{
- new OOMWarning("exporting PCA points",oom);
+ new OOMWarning("exporting PCA points", oom);
cap.dispose();
}
}
- private String getPointsasCsv(boolean transformed)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GPCAPanel#outputProjPoints_actionPerformed(java.awt.event
+ * .ActionEvent)
+ */
+ @Override
+ protected void outputProjPoints_actionPerformed()
{
- StringBuffer csv = new StringBuffer();
- csv.append("\"Sequence\"");
- if (transformed) {
- csv.append(",");
- csv.append(xCombobox.getSelectedIndex());
- csv.append(",");
- csv.append(yCombobox.getSelectedIndex());
- csv.append(",");
- csv.append(zCombobox.getSelectedIndex());
- } else {
- for (int d=1,dmax=pca.component(1).length;d<=dmax;d++)
- {
- csv.append(","+d);
- }
- }
- csv.append("\n");
- for (int s=0;s=0;d--)
- {
- csv.append(",");
- csv.append(fl[d]);
- }
- } else {
- // output current x,y,z coords for points
- fl = rc.getPointPosition(s);
- for (int d=0; d