JAL-4229 beginnings of test to verify VARNA and Helices shading as correct bug/JAL-4229_varna_helix_mapping_offby1
authorJames Procter <j.procter@dundee.ac.uk>
Thu, 13 Jul 2023 15:05:45 +0000 (16:05 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Thu, 13 Jul 2023 15:15:15 +0000 (16:15 +0100)
src/jalview/gui/AppVarna.java
test/jalview/gui/AppVarnaTest.java

index 5273aaa..4231bf6 100644 (file)
@@ -65,7 +65,7 @@ public class AppVarna extends JInternalFrame
         InterfaceVARNASelectionListener, VamsasSource
 {
   private static final byte[] PAIRS = new byte[] { '(', ')', '[', ']', '{',
-      '}', '<', '>' };
+      '}', '<', '>', '_','-' };
 
   private AppVarnaBinding vab;
 
index 7936a4b..b648b4d 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.gui;
 
+import static org.testng.Assert.assertTrue;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertNull;
 import static org.testng.AssertJUnit.assertSame;
@@ -27,6 +28,16 @@ import static org.testng.AssertJUnit.assertSame;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Sequence;
+import jalview.ext.varna.RnaModel;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
+import jalview.io.FileLoader;
+import jalview.io.FormatAdapter;
+import jalview.io.StockholmFile;
+
+
 public class AppVarnaTest
 {
 
@@ -53,4 +64,16 @@ public class AppVarnaTest
     assertEquals("..{B([.<.].}b>)",
             AppVarna.replaceOddGaps("  {B([*<-]?}b>)"));
   }
+  @Test(groups = "Functional")
+  public void testRnaModel() throws Exception
+  {
+    AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded("examples/rna_ss_test.stk", DataSourceType.FILE);
+    AlignmentI a = af.getViewport().getAlignment();
+    assertTrue(a.getAlignmentAnnotation()[0].isRNA());
+    AppVarna varnaView = new AppVarna(a.getSequenceAt(0),a.getAlignmentAnnotation()[0], af.alignPanel);
+    assertEquals(varnaView.getModels().size(),2);
+    for (RnaModel mdl: varnaView.getModels()) {
+      assertEquals(mdl.seq.getSequenceAsString(),mdl.rna.getSeq());
+    }
+  }
 }