From f9e0571f0dd29ed64726e4e62d4e7c093be688c5 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 23 Sep 2020 17:11:39 +0100 Subject: [PATCH] JAL-3748 maximal test for JAL-3748 using covid19 CDS/Protein --- test/jalview/gui/SplitFrameTest.java | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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"); + } } -- 1.7.10.2