JAL-1065 + JAL-1066 + JAL-1067 - Added T-Coffee score size constraints
[jalview.git] / src / jalview / appletgui / AlignFrame.java
index c1dbf30..15904df 100644 (file)
@@ -2335,7 +2335,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
         {\r
           try\r
           {\r
-            sg.cs = (ColourSchemeI) cs.getClass().newInstance();\r
+            sg.cs = cs.getClass().newInstance();\r
           } catch (Exception ex)\r
           {\r
             ex.printStackTrace();\r
@@ -3685,6 +3685,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
                  throw new RuntimeException("The file provided does not match the T-Coffee scores file format");\r
          }\r
          \r
+         /*\r
+          * check that the score matrix matches the alignment dimensions\r
+          */\r
+         AlignmentI aln; \r
+         if( (aln=viewport.alignment) != null && (aln.getHeight() != file.getHeight() || aln.getWidth() != file.getWidth()) ) {\r
+                 throw new RuntimeException("The scores matrix does not match the alignment dimensions");\r
+         }\r
+         \r
          tcoffeeColour.setEnabled(true);\r
          tcoffeeScoreFile = file;\r
          \r