Fixed T-Coffee file scores parser to support extended format including residue numbers
[jalview.git] / test / jalview / io / TCoffeeScoreFileTest.java
index 7308446..3147054 100644 (file)
@@ -21,12 +21,9 @@ import static org.junit.Assert.*;
 import jalview.io.TCoffeeScoreFile.Block;
 import jalview.io.TCoffeeScoreFile.Header;
 
-import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
-import java.io.StringReader;
 import java.util.List;
 
 import org.junit.Test;
@@ -34,14 +31,15 @@ import org.junit.Test;
 public class TCoffeeScoreFileTest {
 
        final static File SCORE_FILE = new File("test/jalview/io/tcoffee.score_ascii");
-        final static File ALIGN_FILE = new File("test/jalview/io/tcoffee.fasta_aln");
+    final static File ALIGN_FILE = new File("test/jalview/io/tcoffee.fasta_aln");
        
        @Test
        public void testReadHeader() throws IOException, FileNotFoundException {
 
-               TCoffeeScoreFile scoreFile = new TCoffeeScoreFile(SCORE_FILE.getPath(),AppletFormatAdapter.FILE);
-               assertTrue(scoreFile.getWarningMessage(),scoreFile.isValid());
-               Header header = scoreFile.header;
+           TCoffeeScoreFile scoreFile = new TCoffeeScoreFile(SCORE_FILE.getPath(),AppletFormatAdapter.FILE);
+           assertTrue(scoreFile.getWarningMessage(),scoreFile.isValid());
+               
+           Header header = scoreFile.header;
                assertNotNull(header);
                assertEquals( "T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)", header.head );
                assertEquals( 90, header.score );
@@ -60,9 +58,10 @@ public class TCoffeeScoreFileTest {
        @Test
        public void testWrongFile() {
            try {
-               TCoffeeScoreFile result = new TCoffeeScoreFile(ALIGN_FILE.getPath(), FormatAdapter.FILE);
-               assertFalse(result.isValid());
-           } catch (IOException x)
+                       TCoffeeScoreFile result = new TCoffeeScoreFile(ALIGN_FILE.getPath(), FormatAdapter.FILE);
+                       assertFalse(result.isValid());
+           } 
+           catch (IOException x)
            {
              assertTrue("File not found exception thrown",x instanceof FileNotFoundException);
            }
@@ -173,6 +172,15 @@ public class TCoffeeScoreFileTest {
                
        } 
        
+       @Test
+       public void testHeightAndWidthWithResidueNumbers() throws IOException {
+               String file = "test/jalview/io/tcoffee.score_ascii_with_residue_numbers";
+               TCoffeeScoreFile result = new TCoffeeScoreFile(file, FormatAdapter.FILE);
+               assertTrue(result.isValid());
+               assertEquals( 5, result.getHeight() );
+               assertEquals( 84, result.getWidth() );
+       }       
+       
        
        
 }