*/
public class PCAPanel extends GPCAPanel implements Runnable
{
+
PCA pca;
int top;
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)
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<seqs.length;s++)
+ {
+ csv.append("\""+seqs[s].getName()+"\"");
+ double fl[];
+ if (!transformed) {
+ // output pca in correct order
+ fl = pca.component(s);
+ for (int d=fl.length-1; d>=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<fl.length;d++)
+ {
+ csv.append(",");
+ csv.append(fl[d]);
+ }
+ }
+ csv.append("\n");
+ }
+ return csv.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see jalview.jbgui.GPCAPanel#outputProjPoints_actionPerformed(java.awt.event.ActionEvent)
+ */
+ protected void outputProjPoints_actionPerformed(ActionEvent e)
+ {
+ CutAndPasteTransfer cap = new CutAndPasteTransfer();
+ try {
+ cap.setText(getPointsasCsv(true));
+ Desktop.addInternalFrame(cap, "Transformed points for "+getTitle(), 500, 500);
+ } catch (OutOfMemoryError oom)
+ {
+ new OOMWarning("exporting transformed PCA points",oom);
+ cap.dispose();
+ }
+ }
}
import java.awt.*;
import java.awt.event.*;
+
import javax.swing.*;
import javax.swing.event.*;
JMenuItem print = new JMenuItem();
JMenuItem outputValues = new JMenuItem();
+
+ JMenuItem outputPoints = new JMenuItem();
+ JMenuItem outputProjPoints = new JMenuItem();
protected JMenu viewMenu = new JMenu();
outputValues_actionPerformed(e);
}
});
+ outputPoints.setText("Output points...");
+ outputPoints.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ outputPoints_actionPerformed(e);
+ }
+ });
+ outputProjPoints.setText("Output transformed points...");
+ outputProjPoints.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ outputProjPoints_actionPerformed(e);
+ }
+ });
print.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
fileMenu.add(outputValues);
fileMenu.add(print);
fileMenu.add(originalSeqData);
+ fileMenu.add(outputPoints);
+ fileMenu.add(outputProjPoints);
saveMenu.add(eps);
saveMenu.add(png);
viewMenu.add(showLabels);
viewMenu.add(associateViewsMenu);
}
+ protected void outputPoints_actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void outputProjPoints_actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
protected void xCombobox_actionPerformed(ActionEvent e)
{
}