JAL-2830 reinstate toUppercase for new dataset sequences synthesised during edits.
authorJim Procter <jprocter@issues.jalview.org>
Mon, 17 Dec 2018 16:30:06 +0000 (16:30 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 17 Dec 2018 16:30:06 +0000 (16:30 +0000)
src/jalview/commands/EditCommand.java
test/jalview/commands/EditCommandTest.java

index 1a227c5..3f2ace9 100644 (file)
@@ -837,7 +837,7 @@ public class EditCommand implements CommandI
             // old ds and edited ds are different, so
             // create the new dataset sequence
             SequenceI newds = new Sequence(oldds);
-            newds.setSequence(fullseq);
+            newds.setSequence(fullseq.toUpperCase());
 
             if (command.oldds == null)
             {
index 2160657..348d871 100644 (file)
@@ -90,11 +90,11 @@ public class EditCommandTest
     testee = new EditCommand();
     seqs = new SequenceI[4];
     seqs[0] = new Sequence("seq0", "abcdefghjk");
-    seqs[0].setDatasetSequence(new Sequence("seq0ds", "abcdefghjk"));
+    seqs[0].setDatasetSequence(new Sequence("seq0ds", "ABCDEFGHJK"));
     seqs[1] = new Sequence("seq1", "fghjklmnopq");
-    seqs[1].setDatasetSequence(new Sequence("seq1ds", "fghjklmnopq"));
+    seqs[1].setDatasetSequence(new Sequence("seq1ds", "FGHJKLMNOPQ"));
     seqs[2] = new Sequence("seq2", "qrstuvwxyz");
-    seqs[2].setDatasetSequence(new Sequence("seq2ds", "qrstuvwxyz"));
+    seqs[2].setDatasetSequence(new Sequence("seq2ds", "QRSTUVWXYZ"));
     seqs[3] = new Sequence("seq3", "1234567890");
     seqs[3].setDatasetSequence(new Sequence("seq3ds", "1234567890"));
     al = new Alignment(seqs);
@@ -285,7 +285,8 @@ public class EditCommandTest
             4, 8, al);
     assertEquals("abcdefghjk", seqs[0].getSequenceAsString());
     assertEquals("fghjZ-xYopq", seqs[1].getSequenceAsString());
-    assertEquals("fghjZxYopq",
+    // Dataset Sequence should always be uppercase
+    assertEquals("fghjZxYopq".toUpperCase(),
             seqs[1].getDatasetSequence().getSequenceAsString());
     assertEquals("qrstuvwxyz", seqs[2].getSequenceAsString());
     assertEquals("1234567890", seqs[3].getSequenceAsString());
@@ -315,7 +316,8 @@ public class EditCommandTest
     assertEquals("ABxyZ-DEF", seq.getSequenceAsString());
     assertEquals(1, seq.getStart());
     assertEquals(8, seq.getEnd());
-    assertEquals("ABxyZDEF",
+    // Dataset sequence always uppercase
+    assertEquals("ABxyZDEF".toUpperCase(),
             seq.getDatasetSequence().getSequenceAsString());
     assertEquals(8, seq.getDatasetSequence().getEnd());
 
@@ -340,7 +342,8 @@ public class EditCommandTest
     assertEquals("ABxyZ-DEF", seq.getSequenceAsString());
     assertEquals(1, seq.getStart());
     assertEquals(8, seq.getEnd());
-    assertEquals("ABxyZDEF",
+    // dataset sequence should be Uppercase
+    assertEquals("ABxyZDEF".toUpperCase(),
             seq.getDatasetSequence().getSequenceAsString());
     assertEquals(8, seq.getDatasetSequence().getEnd());
 
@@ -363,8 +366,8 @@ public class EditCommandTest
     assertEquals("----klmnopq", seqs[1].getSequenceAsString());
     // and ds is preserved
     assertTrue(dsseq == seqs[1].getDatasetSequence());
-    // and it is unchanged
-    assertEquals("fghjklmnopq", dsseq.getSequenceAsString());
+    // and it is unchanged and UPPERCASE !
+    assertEquals("fghjklmnopq".toUpperCase(), dsseq.getSequenceAsString());
     // and that alignment sequence start has been adjusted
     assertEquals(5, seqs[1].getStart());
     assertEquals(11, seqs[1].getEnd());
@@ -390,8 +393,8 @@ public class EditCommandTest
     assertEquals("----klmnopq", seqs[1].getSequenceAsString());
     // and ds is preserved
     assertTrue(dsseq == seqs[1].getDatasetSequence());
-    // and it is unchanged
-    assertEquals("fghjklmnopq", dsseq.getSequenceAsString());
+    // and it is unchanged AND UPPERCASE !
+    assertEquals("fghjklmnopq".toUpperCase(), dsseq.getSequenceAsString());
     // and that alignment sequence start has been adjusted
     assertEquals(5, seqs[1].getStart());
     assertEquals(11, seqs[1].getEnd());