From: James Procter Date: Wed, 12 Jul 2023 07:33:54 +0000 (+0100) Subject: JAL-4223 - test and patch to ensure numbering matches sequence data from RNAML file X-Git-Tag: Release_2_11_4_0~239 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=320583fd2ac3ea714e6afdac050961978bd34c81;p=jalview.git JAL-4223 - test and patch to ensure numbering matches sequence data from RNAML file --- diff --git a/src/jalview/io/RnamlFile.java b/src/jalview/io/RnamlFile.java index 4d3ddc1..3041a23 100644 --- a/src/jalview/io/RnamlFile.java +++ b/src/jalview/io/RnamlFile.java @@ -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()]; diff --git a/test/jalview/io/RNAMLfileTest.java b/test/jalview/io/RNAMLfileTest.java index 65cea6f..d2b6f65 100644 --- a/test/jalview/io/RNAMLfileTest.java +++ b/test/jalview/io/RNAMLfileTest.java @@ -20,14 +20,22 @@ */ 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); + } + }