From: James Procter Date: Wed, 13 Sep 2023 11:47:13 +0000 (+0100) Subject: JAL-4225 failed attempts to force MFE structure to appear as 2D RNA helices X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6c89ed59f96a34f51b1cb06592c75583986295ea;p=jalview.git JAL-4225 failed attempts to force MFE structure to appear as 2D RNA helices --- diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 7e6b904..81cee32 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -478,7 +478,7 @@ public class AlignmentAnnotation && firstChar != 'R' && firstChar != 'S' && firstChar != 'T' && firstChar != 'U' && firstChar != 'V' && firstChar != 'W' && firstChar != 'X' && firstChar != 'Y' && firstChar != 'Z' - && firstChar != '-' + && firstChar != '-' && firstChar != '.' && firstChar < jalview.schemes.ResidueProperties.aaIndex.length) { if (jalview.schemes.ResidueProperties.aaIndex[firstChar] < 23) // TODO: diff --git a/src/jalview/ws/jws2/RNAalifoldClient.java b/src/jalview/ws/jws2/RNAalifoldClient.java index f9e597f..3c5e3b8 100644 --- a/src/jalview/ws/jws2/RNAalifoldClient.java +++ b/src/jalview/ws/jws2/RNAalifoldClient.java @@ -295,6 +295,10 @@ public class RNAalifoldClient extends JabawsCalcWorker break; } } + if (struct.charAt(i+0)=='.') + { + continue; + } anns[ri] = new Annotation(struct.substring(i, i + 1), "", isSS(struct.charAt(i)), Float.NaN); } @@ -303,7 +307,7 @@ public class RNAalifoldClient extends JabawsCalcWorker } annotation.annotations = anns; - + annotation.validateRangeAndDisplay(); // fixes up RNA secondary structure return annotation; } diff --git a/test/jalview/datamodel/AlignmentAnnotationTests.java b/test/jalview/datamodel/AlignmentAnnotationTests.java index 4615204..19b14ff 100644 --- a/test/jalview/datamodel/AlignmentAnnotationTests.java +++ b/test/jalview/datamodel/AlignmentAnnotationTests.java @@ -311,6 +311,40 @@ public class AlignmentAnnotationTests } @Test(groups = { "Functional" }) + public void testRNAalifoldOutputisRNA() + { + Annotation[] anns=new Annotation[16]; + /* + * .(.[.{.<.}.>.).]. + */ + anns[1] = new Annotation("(", "S", '(', 0f); + anns[2] = new Annotation(".", "", '.', 0f); + anns[3] = new Annotation("[", "S", '[', 0f); + anns[4] = new Annotation(".", "", '.', 0f); + anns[5] = new Annotation("{", "S", '{', 0f); + anns[6] = new Annotation(".", "", '.', 0f); + anns[7] = new Annotation("<", "S", '<', 0f); + anns[8] = new Annotation(".", "", '.', 0f); + anns[9] = new Annotation("}", "S", '}', 0f); + anns[10] = new Annotation(".", "", '.', 0f); + anns[11] = new Annotation(">", "S", '>', 0f); + anns[12] = new Annotation(".", "", '.', 0f); + anns[13] = new Annotation(")", "S", ')', 0f); + anns[14] = new Annotation(".", "", '.', 0f); + anns[15] = new Annotation("]", "S", ']', 0f); + + AlignmentAnnotation ann = new AlignmentAnnotation("RNASecStru","Struc",anns); + + String expected = "(())]]}}>>>>]]]]("; + for (int i = 0; i < expected.length(); i++) + { + assertEquals("column " + i, String.valueOf(expected.charAt(i)), + ann.getDefaultRnaHelixSymbol(i)); + } + assertTrue(ann.isRNA()); + + } + @Test(groups = { "Functional" }) public void testIsQuantitative() { AlignmentAnnotation ann = null;