boolean cutIsInternal = cutPositions != null
&& sequence.getStart() != cutPositions
.getBegin() && sequence.getEnd() != cutPositions.getEnd();
+
+ /*
+ * perform the cut; if this results in a new dataset sequence, add
+ * that to the alignment dataset
+ */
+ SequenceI ds = sequence.getDatasetSequence();
sequence.deleteChars(command.position, command.position
+ command.number);
+ SequenceI newDs = sequence.getDatasetSequence();
+ if (newDs != ds && command.al != null
+ && command.al.getDataset() != null
+ && !command.al.getDataset().getSequences().contains(newDs))
+ {
+ command.al.getDataset().addSequence(newDs);
+ }
if (command.oldds != null && command.oldds[i] != null)
{
{
command.oldds = new SequenceI[command.seqs.length];
}
- command.oldds[i] = oldds;
+ command.oldds[i] = oldds;// todo not if !cutIsInternal?
// do we need to edit sequence features for new sequence ?
if (oldds != sequence.getDatasetSequence()
|| (cutIsInternal
&& sequence.getFeatures().hasFeatures()))
+ // todo or just test cutIsInternal && cutPositions != null ?
{
if (cutPositions != null)
{
* <li>features right of the cut are shifted left</li>
* <li>features internal to the cut region are deleted</li>
* <li>features that overlap or span the cut are shortened</li>
- * <li>the originals of any deleted or shorted features are saved, to re-add
+ * <li>the originals of any deleted or shortened features are saved, to re-add
* on Undo</li>
* <li>any added (shortened) features are saved, to delete on Undo</li>
* </ul>
protected static void cutFeatures(Edit command, SequenceI seq,
int fromPosition, int toPosition, boolean cutIsInternal)
{
- /* if the cut is at start or end of sequence
- * then we don't modify the seuqence feature store
+ /*
+ * if the cut is at start or end of sequence
+ * then we don't modify the sequence feature store
*/
if (!cutIsInternal)
{