\r
TCoffeeScoreFile file = TCoffeeScoreFile.load( new InputStreamReader( url.openStream() ) );\r
if( file == null ) {\r
++ // TODO: raise a dialog box here rather than bomb out.\r
++ \r
throw new RuntimeException("The file provided does not match the T-Coffee scores file format");\r
}\r
- // TODO add parameter to indicate if matching should be done\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
++ // TODO: raise a dialog box here rather than bomb out.\r
++ throw new RuntimeException("The scores matrix does not match the alignment dimensions");\r
++ \r
+ }\r
+ \r
- tcoffeeColour.setEnabled(true);\r
- tcoffeeScoreFile = file;\r
- \r
- // switch to this color\r
- changeColour(new TCoffeeColourScheme(tcoffeeScoreFile));\r
++ // TODO add parameter to indicate if matching should be done\r
+ if (file.annotateAlignment(alignPanel.getAlignment(), false))\r
+ {\r
+ tcoffeeColour.setEnabled(true);\r
+ // switch to this color\r
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
+ }\r
-\r
}\r
\r
\r
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(