JAL-2507 test for alignment+rna annotation -> Stockholm -> roundtrip.
authorJim Procter <jprocter@issues.jalview.org>
Tue, 9 May 2017 14:15:54 +0000 (15:15 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 9 May 2017 14:15:54 +0000 (15:15 +0100)
test/jalview/io/StockholmFileTest.java

index e7f1435..3c6c4e1 100644 (file)
@@ -30,6 +30,7 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
 import jalview.gui.JvOptionPane;
 
 import java.io.File;
@@ -436,4 +437,30 @@ public class StockholmFileTest
       }
     }
   }
+
+  String aliFile = ">Dm\nAAACCCUUUUACACACGGGAAAGGG";
+  String annFile = "JALVIEW_ANNOTATION\n# Created: Thu May 04 11:16:52 BST 2017\n\n"
+          + "SEQUENCE_REF\tDm\nNO_GRAPH\tsecondary structure\tsecondary structure\t"
+          + "(|(|(|(|, .|, .|, .|, .|)|)|)|)|\t0.0\nROWPROPERTIES\t"
+          + "secondary structure\tscaletofit=true\tshowalllabs=true\tcentrelabs=false";
+
+  @Test(groups = { "Functional" })
+  public void secondaryStructureForRNASequence() throws Exception
+  {
+    AlignFrame al = new FileLoader(false).LoadFileWaitTillLoaded(aliFile,
+            DataSourceType.PASTE);
+    al.loadJalviewDataFile(annFile, DataSourceType.PASTE, null, null);
+
+    // TODO: create a better 'save as <format>' pattern
+    String stockholmFile = new jalview.io.StockholmFile(al.getViewport()
+            .getAlignment()).print(al.getViewport().getAlignment()
+            .getSequencesArray(), true);
+
+    AlignFrame newAl = new FileLoader(false).LoadFileWaitTillLoaded(
+            stockholmFile, DataSourceType.PASTE);
+
+    testAlignmentEquivalence(al.getViewport().getAlignment(), newAl
+            .getViewport().getAlignment(), true, true);
+
+  }
 }