!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");
+
}
}