assertTrue(Comparison.isGap(al.getSequenceAt(1).getSequence()[6]));
assertFalse(Comparison.isGap(al.getSequenceAt(1).getSequence()[7]));
}
+
+ @Test(groups = { "Functional" })
+ public void testPadGaps()
+ {
+ SequenceI seq1 = new Sequence("seq1", "ABCDEF--");
+ SequenceI seq2 = new Sequence("seq2", "-JKLMNO--");
+ SequenceI seq3 = new Sequence("seq2", "-PQR");
+ AlignmentI a = new Alignment(new SequenceI[] { seq1, seq2, seq3 });
+ a.setGapCharacter('.'); // this replaces existing gaps
+ assertEquals("ABCDEF..", seq1.getSequenceAsString());
+ a.padGaps();
+ // trailing gaps are pruned, short sequences padded with gap character
+ assertEquals("ABCDEF.", seq1.getSequenceAsString());
+ assertEquals(".JKLMNO", seq2.getSequenceAsString());
+ assertEquals(".PQR...", seq3.getSequenceAsString());
+ }
}