JAL-161 JAL-4173 patch to stockholm parser and tests covering import of a single...
[jalview.git] / test / jalview / io / StockholmFileTest.java
index b1995ab..532542b 100644 (file)
@@ -62,7 +62,7 @@ public class StockholmFileTest
 
   static String PfamFile = "examples/PF00111_seed.stk",
           RfamFile = "examples/RF00031_folded.stk",
-          RnaSSTestFile = "examples/rna_ss_test.stk";
+          RnaSSTestFile = "examples/rna_ss_test.stk",StockholmAndTree="examples/ferredoxins.sto";
 
   @Test(groups = { "Functional" })
   public void pfamFileIO() throws Exception
@@ -91,6 +91,21 @@ public class StockholmFileTest
   }
 
   @Test(groups = { "Functional" })
+  public void stockholmFileWithEmbeddedNhx() throws Exception
+  {
+    AppletFormatAdapter af = new AppletFormatAdapter();
+    AlignmentI al = af.readFile(StockholmAndTree, DataSourceType.FILE,
+            new IdentifyFile().identify(StockholmAndTree, DataSourceType.FILE));
+    assertTrue("Expected trees",af.getAlignFile().hasTrees());
+    assertTrue("Expected 1 tree",af.getAlignFile().getTreeCount()==1);
+    List<String[]> trees = af.getAlignFile().getNewickTrees();
+    assertNotNull(trees);
+    assertEquals(1,trees.size());
+    assertEquals("Tree 1",trees.get(0)[0]);
+    assertEquals("(((FER_BRANA:128.0,FER3_RAPSA:128.0):50.75,FER_CAPAA:178.75):121.94443,(Q93Z60_ARATH:271.45456,((O80429_MAIZE:183.0,FER1_MAIZE:183.0):30.5,((Q7XA98_TRIPR:90.0,FER1_PEA:90.0):83.32143,(((FER1_ARATH:64.0,FER2_ARATH:64.0):94.375,(FER1_SPIOL:124.5,FER1_MESCR:124.5):33.875):6.4166718,((Q93XJ9_SOLTU:33.5,FER1_SOLLC:33.5):49.0,FER_CAPAN:82.5):82.29167):8.529755):40.178574):57.95456):29.239868);",trees.get(0)[1]);
+  }
+
+  @Test(groups = { "Functional" })
   public void rfamFileIO() throws Exception
   {
     testFileIOwithFormat(new File(RfamFile), FileFormat.Stockholm, 2, 1,