JAL-4223 - test and patch to ensure numbering matches sequence data from RNAML file
authorJames Procter <j.procter@dundee.ac.uk>
Wed, 12 Jul 2023 07:33:54 +0000 (08:33 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Wed, 12 Jul 2023 07:33:54 +0000 (08:33 +0100)
src/jalview/io/RnamlFile.java
test/jalview/io/RNAMLfileTest.java

index 4d3ddc1..3041a23 100644 (file)
@@ -160,8 +160,10 @@ public class RnamlFile extends AlignFile
         }
       }
       sqs[i] = new Sequence(id, seq, begin, end);
-
-      sqs[i].setEnd(sqs[i].findPosition(sqs[i].getLength()));
+      if (seq.length()!=(end-begin+1))
+      {
+        sqs[i].setEnd(sqs[i].findPosition(sqs[i].getLength()));
+      }
       String[] annot = new String[rna.length()];
       Annotation[] ann = new Annotation[rna.length()];
 
index 65cea6f..d2b6f65 100644 (file)
  */
 package jalview.io;
 
+import jalview.datamodel.SequenceI;
 import jalview.gui.JvOptionPane;
 
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
 import java.io.File;
+import java.io.IOException;
 
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import fr.orsay.lri.varna.utils.RNAMLParser;
+import groovy.lang.Sequence;
+
 public class RNAMLfileTest
 {
 
@@ -57,4 +65,14 @@ public class RNAMLfileTest
 
   }
 
+  @Test(groups= {"Functional"})
+  public void testRnamlSeqImport() throws IOException
+  {
+    RnamlFile parser = new RnamlFile("examples/testdata/7WKP-rna1.xml", DataSourceType.FILE);
+    SequenceI[] seqs  = parser.getSeqsAsArray();
+    assertNotNull(seqs);
+    assertEquals(seqs.length,1);
+    assertEquals(seqs[0].getEnd()-seqs[0].getStart()+1,seqs[0].getSequence().length);
+  }
+
 }