/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 AM Waterhouse, J Procter, 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 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.
- *
+ *
* 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
*/
-
package jalview.appletgui;
import java.util.*;
import jalview.analysis.*;
import jalview.datamodel.*;
-public class PCAPanel
- extends EmbmenuFrame implements Runnable, ActionListener, ItemListener
+public class PCAPanel extends EmbmenuFrame implements Runnable,
+ ActionListener, ItemListener
{
PCA pca;
+
int top;
+
RotatableCanvas rc;
+
AlignViewport av;
+
SequenceI[] seqs;
+
AlignmentView seqstrings;
public PCAPanel(AlignViewport av)
try
{
jbInit();
- }
- catch (Exception e)
+ } catch (Exception e)
{
e.printStackTrace();
}
{
if (sq[i].getWidth() != length)
{
- System.out.println("Sequences must be equal length for PCA analysis");
+ System.out
+ .println("Sequences must be equal length for PCA analysis");
return;
}
}
add(rc, BorderLayout.CENTER);
jalview.bin.JalviewLite.addFrame(this, "Principal component analysis",
- 400, 400);
+ 400, 400);
Thread worker = new Thread(this);
worker.start();
// Now find the component coordinates
int ii = 0;
- while ( (ii < seqs.length) && (seqs[ii] != null))
+ while ((ii < seqs.length) && (seqs[ii] != null))
{
ii++;
}
}
}
- //////////////////
+ // ////////////////
xCombobox.select(0);
yCombobox.select(1);
zCombobox.select(2);
float[][] scores = pca.getComponents(dim1, dim2, dim3, 100);
for (int i = 0; i < pca.getM().rows; i++)
{
- ( (SequencePoint) rc.points.elementAt(i)).coord = scores[i];
+ ((SequencePoint) rc.points.elementAt(i)).coord = scores[i];
}
rc.img = null;
void showOriginalData()
{
- // 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 yields unaligned seqs)
+ // 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
+ // yields unaligned seqs)
// or create a selection box around columns in alignment view
// test Alignment(SeqCigar[])
- Object[] alAndColsel = seqstrings.getAlignmentAndColumnSelection(av.
- getGapCharacter());
+ char gc = '-';
+ try
+ {
+ // we try to get the associated view's gap character
+ // but this may fail if the view was closed...
+ gc = av.getGapCharacter();
+ } catch (Exception ex)
+ {
+ }
+ ;
+ Object[] alAndColsel = seqstrings.getAlignmentAndColumnSelection(gc);
if (alAndColsel != null && alAndColsel[0] != null)
{
- Alignment al = new Alignment( (SequenceI[]) alAndColsel[0]);
- AlignFrame af = new AlignFrame(al,
- av.applet,
- "Original Data for PCA",
- false);
+ Alignment al = new Alignment((SequenceI[]) alAndColsel[0]);
+ AlignFrame af = new AlignFrame(al, av.applet,
+ "Original Data for PCA", false);
- af.viewport.setHiddenColumns( (ColumnSelection) alAndColsel[1]);
+ af.viewport.setHiddenColumns((ColumnSelection) alAndColsel[1]);
}
}
}
Panel jPanel2 = new Panel();
+
Label jLabel1 = new Label();
+
Label jLabel2 = new Label();
+
Label jLabel3 = new Label();
+
protected Choice xCombobox = new Choice();
+
protected Choice yCombobox = new Choice();
+
protected Choice zCombobox = new Choice();
+
FlowLayout flowLayout1 = new FlowLayout();
+
BorderLayout borderLayout1 = new BorderLayout();
+
MenuBar menuBar1 = new MenuBar();
+
Menu menu1 = new Menu();
+
Menu menu2 = new Menu();
+
protected CheckboxMenuItem labels = new CheckboxMenuItem();
+
MenuItem values = new MenuItem();
+
MenuItem inputData = new MenuItem();
- private void jbInit()
- throws Exception
+ private void jbInit() throws Exception
{
this.setLayout(borderLayout1);
jPanel2.setLayout(flowLayout1);