X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fappletgui%2FAlignFrame.java;h=90b1a0507aed65faa06126154490b255856f7af9;hb=6a3f4318037072a77588afb951a5a53835d5da99;hp=c1dbf303c2923abee49fb2e73252531e9e5264a7;hpb=34d8b4dc08dcd27c3b5ac3bf7811f709b4db5938;p=jalview.git diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index c1dbf30..90b1a05 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -100,7 +100,6 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis String jalviewServletURL; - TCoffeeScoreFile tcoffeeScoreFile; public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet, String title, boolean embedded) { @@ -998,7 +997,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis changeColour(new Blosum62ColourScheme()); } else if (source == tcoffeeColour) { - changeColour(new TCoffeeColourScheme(tcoffeeScoreFile)); + changeColour(new TCoffeeColourScheme(alignPanel.getAlignment())); } else if (source == annotationColour) { @@ -2335,7 +2334,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis { try { - sg.cs = (ColourSchemeI) cs.getClass().newInstance(); + sg.cs = cs.getClass().newInstance(); } catch (Exception ex) { ex.printStackTrace(); @@ -3682,14 +3681,28 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis TCoffeeScoreFile file = TCoffeeScoreFile.load( new InputStreamReader( url.openStream() ) ); if( file == null ) { + // TODO: raise a dialog box here rather than bomb out. + throw new RuntimeException("The file provided does not match the T-Coffee scores file format"); } - tcoffeeColour.setEnabled(true); - tcoffeeScoreFile = file; + /* + * check that the score matrix matches the alignment dimensions + */ + AlignmentI aln; + if( (aln=viewport.alignment) != null && (aln.getHeight() != file.getHeight() || aln.getWidth() != file.getWidth()) ) { + // TODO: raise a dialog box here rather than bomb out. + throw new RuntimeException("The scores matrix does not match the alignment dimensions"); + + } - // switch to this color - changeColour(new TCoffeeColourScheme(tcoffeeScoreFile)); + // TODO add parameter to indicate if matching should be done + if (file.annotateAlignment(alignPanel.getAlignment(), false)) + { + tcoffeeColour.setEnabled(true); + // switch to this color + changeColour(new TCoffeeColourScheme(alignPanel.getAlignment())); + } }