X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FPCAPanel.java;h=1dd05e0e9afe1f82d92d2554a3cfa8e77c1e98e3;hb=588042b69abf8e60bcc950b24c283933c7dd422f;hp=f652aae504245316c29cc2aa225fc00b6b5baa13;hpb=5cd8e373c75fb348ecda4d94d8a46468fb92756d;p=jalview.git diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java index f652aae..1dd05e0 100755 --- a/src/jalview/appletgui/PCAPanel.java +++ b/src/jalview/appletgui/PCAPanel.java @@ -1,33 +1,35 @@ /* -* Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 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 -*/ + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2005 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 jalview.datamodel.*; -import jalview.analysis.PCA; -import jalview.jbappletgui.*; +import java.util.*; + import java.awt.*; import java.awt.event.*; -import java.util.*; +import jalview.analysis.*; +import jalview.datamodel.*; +import jalview.jbappletgui.*; -public class PCAPanel extends GPCAPanel implements Runnable +public class PCAPanel + extends GPCAPanel implements Runnable { PCA pca; int top; @@ -39,30 +41,34 @@ public class PCAPanel extends GPCAPanel implements Runnable // do stuff } - public PCAPanel(AlignViewport av, SequenceI[] s) { + public PCAPanel(AlignViewport av, SequenceI[] s) + { this.av = av; - if(av.getSelectionGroup().getSize()>3) + if (av.getSelectionGroup().getSize() > 3) { s = new Sequence[av.getSelectionGroup().getSize()]; - for(int i=0; i 1e-4) { - comps[i] = pca.component(i); + comps[i] = pca.component(i); } } @@ -84,37 +90,39 @@ public class PCAPanel extends GPCAPanel implements Runnable yCombobox.select(1); zCombobox.select(2); - top = pca.getM().rows-1; + top = pca.getM().rows - 1; Vector points = new Vector(); - float[][] scores = pca.getComponents(top-1,top-2,top-3,100); + float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100); - for (int i =0; i < pca.getM().rows; i++ ) + for (int i = 0; i < pca.getM().rows; i++) { - SequencePoint sp = new SequencePoint(s[i],scores[i]); + SequencePoint sp = new SequencePoint(s[i], scores[i]); points.addElement(sp); } - rc = new RotatableCanvas(av,points,pca.getM().rows); + rc = new RotatableCanvas(av, points, pca.getM().rows); //rc.printPoints(); add(rc, BorderLayout.CENTER); } - void doDimensionChange() { - if(top==0) + if (top == 0) + { return; + } int dim1 = top - xCombobox.getSelectedIndex(); int dim2 = top - yCombobox.getSelectedIndex(); int dim3 = top - zCombobox.getSelectedIndex(); - 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]; + 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]; } rc.img = null;