GPL license added
[jalview.git] / src / jalview / gui / PCAPanel.java
index 7875567..8f3ff73 100755 (executable)
@@ -1,3 +1,22 @@
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+*/\r
+\r
 package jalview.gui;\r
 \r
 import jalview.datamodel.*;\r
@@ -23,11 +42,11 @@ public class PCAPanel extends GPCAPanel implements Runnable
   public PCAPanel(AlignViewport av, SequenceI[] s) {\r
 \r
     this.av = av;\r
-    if(av.getSelection().size()>3)\r
+    if(av.getSelectionGroup()!=null && av.getSelectionGroup().getSize()>3)\r
     {\r
-      s = new Sequence[av.getSelection().size()];\r
+      s = new Sequence[av.getSelectionGroup().getSize()];\r
       for(int i=0; i<s.length; i++)\r
-        s[i] = av.getSelection().sequenceAt(i);\r
+        s[i] = av.getSelectionGroup().getSequenceAt(i);\r
     }\r
 \r
 \r
@@ -70,10 +89,12 @@ public class PCAPanel extends GPCAPanel implements Runnable
     Vector points = new Vector();\r
     float[][] scores = pca.getComponents(top-1,top-2,top-3,100);\r
 \r
-    for (int i =0; i < pca.getM().rows; i++ ) {\r
+    for (int i =0; i < pca.getM().rows; i++ )\r
+    {\r
       SequencePoint sp = new SequencePoint(s[i],scores[i]);\r
       points.addElement(sp);\r
     }\r
+\r
     rc = new RotatableCanvas(av,points,pca.getM().rows);\r
 \r
     //rc.printPoints();\r