{
// first edit the original dataset sequence string
SequenceI oldds = command.seqs[i].getDatasetSequence();
- String fullseq, osp = oldds.getSequenceAsString();
+ String osp = oldds.getSequenceAsString();
- fullseq = osp.substring(0, ipos) + nogaprep
+ String fullseq = osp.substring(0, ipos) + nogaprep
+ osp.substring(ipos + nogaprep.length());
// and check if new sequence data is different..
}
/**
+ * Test the replace command (used to manually edit a sequence)
+ */
+ @Test(groups = { "Functional" })
+ public void testReplace_withGaps()
+ {
+ SequenceI seq = new Sequence("seq", "ABC--DEF");
+ seq.createDatasetSequence();
+ assertEquals("ABCDEF", seq.getDatasetSequence().getSequenceAsString());
+
+ /*
+ * replace C- with XYZ
+ * NB arg4 = start column of selection for edit (base 0)
+ * arg5 = column after end of selection for edit
+ */
+ new EditCommand("", Action.REPLACE, "XYZ", new SequenceI[] { seq }, 2,
+ 4, al);
+ assertEquals("ABXYZ-DEF", seq.getSequenceAsString());
+ assertEquals("ABXYZDEF", seq.getDatasetSequence().getSequenceAsString());
+ }
+
+ /**
* Test replace command when it doesn't cause a sequence edit (see comment in
*/
@Test(groups = { "Functional" })