try
{
- TCoffeeScoreFile result = TCoffeeScoreFile.load(new File(sFilePath));
- 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");
- }
+ TCoffeeScoreFile result = new TCoffeeScoreFile(sFilePath, FormatAdapter.FILE);
+ if (!result.isValid()) {
+ JOptionPane.showMessageDialog(Desktop.desktop, result.getWarningMessage(),
+ "Problem reading T-COFFEE score file", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
/*
* check that the score matrix matches the alignment dimensions
AlignmentI aln;
if( (aln=viewport.getAlignment()) != null && (aln.getHeight() != result.getHeight() || aln.getWidth() != result.getWidth()) ) {
// TODO: raise a dialog box here rather than bomb out.
- throw new RuntimeException("The scores matrix does not match the alignment dimensions");
+ JOptionPane.showMessageDialog(Desktop.desktop, "The scores matrix does not match the alignment dimensions",
+ "Problem reading T-COFFEE score file", JOptionPane.WARNING_MESSAGE);
}
if (result.annotateAlignment(alignPanel.getAlignment(), true))
{
tcoffeeColour.setEnabled(false);
tcoffeeColour.setSelected(false);
}
+ if (result.getWarningMessage()!=null)
+ {
+ JOptionPane.showMessageDialog(Desktop.desktop, result.getWarningMessage(),"Problem reading T-COFEEE score file", JOptionPane.WARNING_MESSAGE);
+ }
}
catch (Exception ex) {
JOptionPane.showMessageDialog(
Desktop.desktop,
ex.getMessage(),
- "Problem reading tree file",
+ "unexpected problem reading T-COFFEE score file",
JOptionPane.WARNING_MESSAGE);
ex.printStackTrace();