Merge branch 'develop' into feature/JAL-4227_Rfam2020_sslines
[jalview.git] / test / jalview / io / StockholmFileTest.java
index b1995ab..4a047c7 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",RnaSS_fromRfamTestFile="examples/RF00162.stk";
 
   @Test(groups = { "Functional" })
   public void pfamFileIO() throws Exception
@@ -137,6 +137,31 @@ public class StockholmFileTest
 
   }
 
+  @Test(groups = { "Functional" })
+  public void descriptionLineOutput() throws Exception
+  {
+    // quick test that sequence description is exported & reimported
+
+    SequenceI sq = new Sequence("FER2_SPIOL", "AASSDDDFFF");
+    String expected_descr = "This is a description !@&^%@£@";
+    sq.setDescription(expected_descr);
+    AppletFormatAdapter af = new AppletFormatAdapter();
+    String toStockholm = af.formatSequences(FileFormat.Stockholm,
+            new Alignment(new SequenceI[]
+            { sq }), false);
+    System.out.println(toStockholm);
+
+    // bleh - java.util.Regex sucks
+    assertTrue(toStockholm.contains(expected_descr),
+            "Couldn't locate expected description srting in generated Stockholm file.");
+
+    AlignmentI fromStockholm = af.readFile(toStockholm,
+            DataSourceType.PASTE, FileFormat.Stockholm);
+    SequenceI importedSeq = fromStockholm.getSequenceAt(0);
+    assertEquals("Description did not get reimported.", expected_descr,
+            importedSeq.getDescription());
+  }
+
   /**
    * test alignment data in given file can be imported, exported and reimported
    * with no dataloss
@@ -698,6 +723,13 @@ public class StockholmFileTest
   {
     roundTripSSForRNA(aliFile, annFileFullWuss);
   }
+  
+  @Test(groups= { "Functional" })
+  public void rfamSS() throws Exception {
+    testFileIOwithFormat(new File(RnaSS_fromRfamTestFile), FileFormat.Stockholm, 2, 1,
+            false, false, false);
+  }
+
 
   @Test(groups = { "Functional" })
   public void detectWussBrackets()