From: jprocter Date: Fri, 4 May 2012 16:08:21 +0000 (+0100) Subject: Merge branch 'test_paolo_JAL-1065' into Tcoffee_JAL-1065 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6a3f4318037072a77588afb951a5a53835d5da99;p=jalview.git Merge branch 'test_paolo_JAL-1065' into Tcoffee_JAL-1065 Conflicts: src/jalview/appletgui/AlignFrame.java src/jalview/gui/AlignFrame.java updated handler methods for creating colourscheme for new 'jalviewish' approach to storing tcoffee scores. --- 6a3f4318037072a77588afb951a5a53835d5da99 diff --cc src/jalview/appletgui/AlignFrame.java index 15904df,cc2c966..90b1a05 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@@ -3682,22 -3681,16 +3681,28 @@@ public class AlignFrame extends Embmenu 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"); } - // TODO add parameter to indicate if matching should be done + + /* + * check that the score matrix matches the alignment dimensions + */ + AlignmentI aln; + if( (aln=viewport.alignment) != null && (aln.getHeight() != file.getHeight() || aln.getWidth() != file.getWidth()) ) { - throw new RuntimeException("The scores matrix does not match the alignment dimensions"); ++ // TODO: raise a dialog box here rather than bomb out. ++ throw new RuntimeException("The scores matrix does not match the alignment dimensions"); ++ + } + - tcoffeeColour.setEnabled(true); - tcoffeeScoreFile = file; - - // 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())); + } - } diff --cc src/jalview/gui/AlignFrame.java index 3ba7319,2ba0d59..221d52c --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@@ -3883,23 -3881,19 +3881,30 @@@ public class AlignFrame extends GAlignF try { TCoffeeScoreFile result = TCoffeeScoreFile.load(new File(sFilePath)); - if( result == null ) { throw new RuntimeException("The file provided does not match the T-Coffee scores file format"); } - - // TODO check that the loaded scores matches the current MSA 'dimension' + if( result == 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"); + } + + /* + * check that the score matrix matches the alignment dimensions + */ + AlignmentI aln; + if( (aln=viewport.alignment) != null && (aln.getHeight() != result.getHeight() || aln.getWidth() != result.getWidth()) ) { - throw new RuntimeException("The scores matrix does not match the alignment dimensions"); ++ // TODO: raise a dialog box here rather than bomb out. ++ throw new RuntimeException("The scores matrix does not match the alignment dimensions"); + } - - changeColour( new TCoffeeColourScheme(result) ); - tcoffeeScoreFile = result; - tcoffeeColour.setEnabled(true); - tcoffeeColour.setSelected(true); - + if (result.annotateAlignment(alignPanel.getAlignment(), true)) + { + tcoffeeColour.setEnabled(true); + tcoffeeColour.setSelected(true); + // switch to this color + changeColour(new TCoffeeColourScheme(alignPanel.getAlignment())); + } else { + tcoffeeColour.setEnabled(false); + tcoffeeColour.setSelected(false); + } } catch (Exception ex) { JOptionPane.showMessageDialog(