From: jprocter Date: Wed, 18 Aug 2010 16:52:54 +0000 (+0000) Subject: JAL-617 - new menu items for exporting current view or complete PCA pointset X-Git-Tag: Release_2_6~111 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fbd03b3f123f3462c5fe685c988e5c4ae601558c;p=jalview.git JAL-617 - new menu items for exporting current view or complete PCA pointset --- diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 9c852c5..3d38a87 100755 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -36,6 +36,7 @@ import jalview.jbgui.*; */ public class PCAPanel extends GPCAPanel implements Runnable { + PCA pca; int top; @@ -243,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) @@ -486,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