JAL-4184 failing test for description export and re-import from stockholm
authorJames Procter <j.procter@dundee.ac.uk>
Wed, 17 May 2023 09:26:36 +0000 (10:26 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Wed, 17 May 2023 09:42:06 +0000 (10:42 +0100)
test/jalview/io/StockholmFileTest.java

index b1995ab..6b2982d 100644 (file)
@@ -136,6 +136,28 @@ public class StockholmFileTest
             "Couldn't find Uniprot DBRef on re-imported sequence.");
 
   }
+  @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