X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FPCAPanel.java;h=084311fa6b8942e46247dd52abeb2d55249ad660;hb=153dd62dc91da13ae732600e6ea55ddbe15eab39;hp=b397cf598a6bd0372c9534c6ddbd6ce6412ec6e2;hpb=506d60f0e188723ddc91c26824b41ac7034df3fe;p=jalview.git
diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java
index b397cf5..084311f 100755
--- a/src/jalview/gui/PCAPanel.java
+++ b/src/jalview/gui/PCAPanel.java
@@ -1,20 +1,19 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
*
- * This program 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 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
*
- * This program 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.
+ * 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.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 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 .
*/
package jalview.gui;
@@ -37,6 +36,7 @@ import jalview.jbgui.*;
*/
public class PCAPanel extends GPCAPanel implements Runnable
{
+
PCA pca;
int top;
@@ -55,9 +55,9 @@ public class PCAPanel extends GPCAPanel implements Runnable
* Creates a new PCAPanel object.
*
* @param av
- * DOCUMENT ME!
+ * DOCUMENT ME!
* @param s
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public PCAPanel(AlignmentPanel ap)
{
@@ -212,7 +212,7 @@ public class PCAPanel extends GPCAPanel implements Runnable
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void xCombobox_actionPerformed(ActionEvent e)
{
@@ -223,7 +223,7 @@ public class PCAPanel extends GPCAPanel implements Runnable
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void yCombobox_actionPerformed(ActionEvent e)
{
@@ -234,7 +234,7 @@ public class PCAPanel extends GPCAPanel implements Runnable
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
protected void zCombobox_actionPerformed(ActionEvent e)
{
@@ -244,9 +244,14 @@ public class PCAPanel extends GPCAPanel implements Runnable
public void outputValues_actionPerformed(ActionEvent e)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
- Desktop.addInternalFrame(cap, "PCA details", 500, 500);
-
- cap.setText(pca.getDetails());
+ try {
+ cap.setText(pca.getDetails());
+ Desktop.addInternalFrame(cap, "PCA details", 500, 500);
+ } catch (OutOfMemoryError oom)
+ {
+ new OOMWarning("opening PCA details",oom);
+ cap.dispose();
+ }
}
public void showLabels_actionPerformed(ActionEvent e)
@@ -322,8 +327,7 @@ public class PCAPanel extends GPCAPanel implements Runnable
* CutAndPasteTransfer cap = new CutAndPasteTransfer(); for (int i = 0; i <
* seqs.length; i++) { cap.appendText(new jalview.util.Format("%-" + 15 +
* "s").form( seqs[i].getName())); cap.appendText(" " + seqstrings[i] +
- * "\n");
- * }
+ * "\n"); }
*
* Desktop.addInternalFrame(cap, "Original Data", 400, 400);
*/
@@ -377,7 +381,7 @@ public class PCAPanel extends GPCAPanel implements Runnable
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void eps_actionPerformed(ActionEvent e)
{
@@ -388,7 +392,7 @@ public class PCAPanel extends GPCAPanel implements Runnable
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void png_actionPerformed(ActionEvent e)
{
@@ -488,5 +492,80 @@ public class PCAPanel extends GPCAPanel implements Runnable
associateViewsMenu.add(itemf);
}
+ /* (non-Javadoc)
+ * @see jalview.jbgui.GPCAPanel#outputPoints_actionPerformed(java.awt.event.ActionEvent)
+ */
+ protected void outputPoints_actionPerformed(ActionEvent e)
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer();
+ try {
+ cap.setText(getPointsasCsv(false));
+ Desktop.addInternalFrame(cap, "Points for "+getTitle(), 500, 500);
+ } catch (OutOfMemoryError oom)
+ {
+ new OOMWarning("exporting PCA points",oom);
+ cap.dispose();
+ }
+ }
+
+ private String getPointsasCsv(boolean transformed)
+ {
+ 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