GPL license added
[jalview.git] / src / jalview / gui / SeqPanel.java
index ca09c97..44cf4d4 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 java.awt.*;\r
@@ -6,6 +25,7 @@ import jalview.datamodel.*;
 import javax.swing.*;\r
 import java.util.*;\r
 import jalview.schemes.*;\r
+import jalview.analysis.Conservation;\r
 \r
 public class SeqPanel extends JPanel\r
 {\r
@@ -374,14 +394,33 @@ public class SeqPanel extends JPanel
     av.updateConservation();\r
     av.updateConsensus();\r
 \r
+    // Y O Y CLUSTALX\r
     ColourSchemeI cs = av.getGlobalColourScheme();\r
     if(cs instanceof ConservationColourScheme)\r
-      cs = ( (ConservationColourScheme) cs).cs;\r
+    {\r
+      ConservationColourScheme ccs =  (ConservationColourScheme) cs;\r
+      if(ccs.cs instanceof ClustalxColourScheme)\r
+     {\r
+        Conservation c = new Conservation("All",\r
+                                          ResidueProperties.propHash, 3,\r
+                                          av.alignment.getSequences(), 0,\r
+                                          av.alignment.getWidth() - 1);\r
+        c.calculate();\r
+        c.verdict(false, av.ConsPercGaps);\r
+\r
+        ClustalxColourScheme cxs = (ClustalxColourScheme)ccs.cs;\r
+        cxs.resetClustalX(av.alignment.getSequences(),  av.alignment.getWidth());\r
+        ccs = new ConservationColourScheme(c, cxs);\r
+        av.setGlobalColourScheme(ccs);\r
+     }\r
+    }\r
 \r
     if(cs instanceof ClustalxColourScheme)\r
-      cs = new ClustalxColourScheme(av.alignment.getSequences(), av.alignment.getWidth());\r
-\r
-    ap.alignFrame.changeColour(cs);\r
+    {\r
+      ((ClustalxColourScheme)cs).resetClustalX(av.alignment.getSequences(),\r
+                                    av.alignment.getWidth());\r
+      av.setGlobalColourScheme(cs);\r
+    }\r
 \r
   }\r
 \r
@@ -496,14 +535,7 @@ public class SeqPanel extends JPanel
        repaint();\r
     }\r
     else\r
-    {\r
-      if(stretchGroup.cs !=null && stretchGroup.cs.canThreshold())\r
-      {\r
-        ResidueColourScheme rcs =  (ResidueColourScheme) stretchGroup.cs;\r
         SliderPanel.setPIDSliderSource(ap, stretchGroup.cs, stretchGroup.getName());\r
-      }\r
-\r
-    }\r
 \r
 \r
     changeEndRes = false;\r