{
tmp.append(oldstring.substring(end));
}
+ // stash end prior to updating the sequence object so we can save it if
+ // need be.
+ Range oldstartend = new Range(command.seqs[i].getStart(),
+ command.seqs[i].getEnd());
command.seqs[i].setSequence(tmp.toString());
command.string[i] = oldstring
.substring(start, Math.min(end, oldstring.length()))
if (!nogaprep.toLowerCase().equals(nogapold.toLowerCase()))
{
- // probably need a new dataset sequence
- if (newDSWasNeeded)
+ // we may already have dataset and limits stashed...
+ if (newDSWasNeeded || newStartEndWasNeeded)
{
+ if (newDSWasNeeded)
+ {
// then just switch the dataset sequence
SequenceI oldds = command.seqs[i].getDatasetSequence();
command.seqs[i].setDatasetSequence(command.oldds[i]);
command.oldds[i] = oldds;
- }
- else
- if (newStartEndWasNeeded)
- {
- Range newStart = command.oldStartEnd[i];
- command.oldStartEnd[i] = new Range(command.seqs[i].getStart(),
- command.seqs[i].getEnd());
- command.seqs[i].setStart(newStart.getBegin());
- command.seqs[i].setEnd(newStart.getEnd());
+ }
+ if (newStartEndWasNeeded)
+ {
+ Range newStart = command.oldStartEnd[i];
+ command.oldStartEnd[i] = oldstartend;
+ command.seqs[i].setStart(newStart.getBegin());
+ command.seqs[i].setEnd(newStart.getEnd());
+ }
}
else
{
+ // decide if we need a new dataset sequence or modify start/end
// first edit the original dataset sequence string
SequenceI oldds = command.seqs[i].getDatasetSequence();
String osp = oldds.getSequenceAsString();
{
// modification at end
command.seqs[i].setEnd(
- beforeEditedPositions.getEnd() + nogaprep.length());
+ beforeEditedPositions.getEnd() + nogaprep.length()
+ - nogapold.length());
}
else if (afterEditedPositions != null
&& beforeEditedPositions == null)