Range beforeEditedPositions = command.seqs[i].findPositions(1, start);
Range afterEditedPositions = command.seqs[i]
- .findPositions(start + end + 1, command.seqs[i].getLength());
+ .findPositions(end + 1, command.seqs[i].getLength());
oldstring = command.seqs[i].getSequenceAsString();
tmp = new StringBuffer(oldstring.substring(0, start));
String nogaprep = jalview.analysis.AlignSeq.extractGaps(
jalview.util.Comparison.GapChars,
new String(command.string[i]));
- int ipos = command.seqs[i].findPosition(start)
- - command.seqs[i].getStart();
if (end < oldstring.length())
{
tmp.append(oldstring.substring(end));
// first edit the original dataset sequence string
SequenceI oldds = command.seqs[i].getDatasetSequence();
String osp = oldds.getSequenceAsString();
-
- String fullseq = osp.substring(0, ipos) + nogaprep
- + osp.substring(ipos + nogaprep.length());
+ int beforeStartOfEdit = -oldds.getStart() + 1
+ + (beforeEditedPositions == null
+ ? ((afterEditedPositions != null)
+ ? afterEditedPositions.getBegin() - 1
+ : oldstartend.getBegin()
+ + nogapold.length())
+ : beforeEditedPositions.getEnd()
+ );
+ int afterEndOfEdit = -oldds.getStart() + 1
+ + ((afterEditedPositions == null)
+ ? oldstartend.getEnd()
+ : afterEditedPositions.getBegin() - 1);
+ String fullseq = osp.substring(0,
+ beforeStartOfEdit)
+ + nogaprep
+ + osp.substring(afterEndOfEdit);
// and check if new sequence data is different..
if (!fullseq.equalsIgnoreCase(osp))
command.oldds = new SequenceI[command.seqs.length];
}
command.oldds[i] = command.seqs[i].getDatasetSequence();
+
+ // And preserve start/end for good-measure
+
+ if (command.oldStartEnd == null)
+ {
+ command.oldStartEnd = new Range[command.seqs.length];
+ }
+ command.oldStartEnd[i] = oldstartend;
// TODO: JAL-1131 ensure newly created dataset sequence is added to
// the set of
// dataset sequences associated with the alignment.