From: Jim Procter Date: Wed, 23 Sep 2020 16:11:39 +0000 (+0100) Subject: JAL-3748 maximal test for JAL-3748 using covid19 CDS/Protein X-Git-Tag: Release_2_11_1_3~5^2~19 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f9e0571f0dd29ed64726e4e62d4e7c093be688c5;p=jalview.git JAL-3748 maximal test for JAL-3748 using covid19 CDS/Protein --- diff --git a/test/jalview/gui/SplitFrameTest.java b/test/jalview/gui/SplitFrameTest.java index f9ef572..7420e71 100644 --- a/test/jalview/gui/SplitFrameTest.java +++ b/test/jalview/gui/SplitFrameTest.java @@ -186,5 +186,39 @@ public class SplitFrameTest !copyComplement.getSequenceAt(0).getSequenceAsString().equals( copyComplement.getSequenceAt(1).getSequenceAsString()), "Didn't reconstruct CDS correctly"); + // now get the result again, do some edits and reconstruct again + alAndHidden = inputView.getAlignmentAndHiddenColumns( + proteinAf.getViewport().getGapCharacter()); + AlignmentI newresult = new Alignment((SequenceI[]) alAndHidden[0]); + newresult.setHiddenColumns((HiddenColumns) alAndHidden[1]); + newresult.setDataset(complementDs); + newresult.getSequenceAt(0).insertCharAt(3, 3, '-'); + newresult.getSequenceAt(1).insertCharAt(0, 3, '-'); + newresult.padGaps(); + AlignmentI newcomplement = inputView.getComplementView() + .getVisibleAlignment('-'); + newcomplement.alignAs(newresult); + assertEquals(newcomplement.getWidth(), newresult.getWidth() * 3); + assertEquals(newcomplement.getHeight(), newresult.getHeight()); + // if reconstruction worked, the first sequence should not equal the first + // sequence in the original CDS 'alignAs' + for (int sq = 0; sq < 3; sq++) + { + // check same CDS in same position + assertTrue(newcomplement.getSequenceAt(sq) + .getDatasetSequence() == newcomplement.getSequenceAt(sq) + .getDatasetSequence()); + // verify that sequence strings are different + assertTrue(!newcomplement.getSequenceAt(sq).getSequenceAsString() + .equals(copyComplement.getSequenceAt(sq) + .getSequenceAsString())); + } + // JAL-3748 bug manifests as duplicated CDS sequence content, so need to + // also check each CDS is distinct. + assertTrue( + !newcomplement.getSequenceAt(0).getSequenceAsString().equals( + newcomplement.getSequenceAt(1).getSequenceAsString()), + "Didn't reconstruct CDS correctly"); + } }