X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FPCAPanel.java;h=922941b3ab13d6e6b2e715683c4aa38fd4aa1892;hb=506d60f0e188723ddc91c26824b41ac7034df3fe;hp=ee544784e258ee3616fdd557302453cf83cf9b78;hpb=60f2d6c034560415fd0139c8bc7df0c19cae1186;p=jalview.git diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java index ee54478..922941b 100755 --- a/src/jalview/appletgui/PCAPanel.java +++ b/src/jalview/appletgui/PCAPanel.java @@ -1,22 +1,21 @@ /* - * 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.*; @@ -27,14 +26,19 @@ import java.awt.event.*; 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) @@ -42,8 +46,7 @@ public class PCAPanel try { jbInit(); - } - catch (Exception e) + } catch (Exception e) { e.printStackTrace(); } @@ -72,7 +75,8 @@ public class PCAPanel { 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; } } @@ -82,7 +86,7 @@ public class PCAPanel add(rc, BorderLayout.CENTER); jalview.bin.JalviewLite.addFrame(this, "Principal component analysis", - 400, 400); + 400, 400); Thread worker = new Thread(this); worker.start(); @@ -99,7 +103,7 @@ public class PCAPanel // Now find the component coordinates int ii = 0; - while ( (ii < seqs.length) && (seqs[ii] != null)) + while ((ii < seqs.length) && (seqs[ii] != null)) { ii++; } @@ -114,7 +118,7 @@ public class PCAPanel } } - ////////////////// + // //////////////// xCombobox.select(0); yCombobox.select(1); zCombobox.select(2); @@ -150,7 +154,7 @@ public class PCAPanel 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; @@ -215,28 +219,31 @@ public class PCAPanel 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[]) char gc = '-'; - try { + 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) {}; + 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]); } } @@ -246,23 +253,36 @@ public class PCAPanel } 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);