git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
60e252f
)
JAL-2505 delete and readd modified feature after Cut or Paste
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Wed, 24 May 2017 08:17:07 +0000
(09:17 +0100)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Wed, 24 May 2017 08:17:07 +0000
(09:17 +0100)
src/jalview/commands/EditCommand.java
patch
|
blob
|
history
diff --git
a/src/jalview/commands/EditCommand.java
b/src/jalview/commands/EditCommand.java
index
21ff841
..
98ac2d5
100644
(file)
--- a/
src/jalview/commands/EditCommand.java
+++ b/
src/jalview/commands/EditCommand.java
@@
-1122,51
+1122,69
@@
public class EditCommand implements CommandI
return;
}
return;
}
- SequenceFeature[] sf = sequence.getSequenceFeatures();
+ List<SequenceFeature> sf = sequence.getFeatures()
+ .getPositionalFeatures();
- if (sf == null)
+ if (sf.isEmpty())
{
return;
}
{
return;
}
- SequenceFeature[] oldsf = new SequenceFeature[sf.length];
+ SequenceFeature[] oldsf = new SequenceFeature[sf.size()];
int cSize = j - i;
int cSize = j - i;
- for (int s = 0; s < sf.length; s++)
+ int s = 0;
+ for (SequenceFeature feature : sf)
{
{
- SequenceFeature copy = new SequenceFeature(sf[s]);
+ SequenceFeature copy = new SequenceFeature(feature);
- oldsf[s] = copy;
+ oldsf[s++] = copy;
- if (sf[s].getEnd() < i)
+ if (feature.getEnd() < i)
{
continue;
}
{
continue;
}
- if (sf[s].getBegin() > j)
+ if (feature.getBegin() > j)
{
{
- sf[s].setBegin(copy.getBegin() - cSize);
- sf[s].setEnd(copy.getEnd() - cSize);
+ int newBegin = copy.getBegin() - cSize;
+ int newEnd = copy.getEnd() - cSize;
+ SequenceFeature newSf = new SequenceFeature(feature, newBegin,
+ newEnd, feature.getFeatureGroup());
+ sequence.deleteFeature(feature);
+ sequence.addSequenceFeature(newSf);
+ // feature.setBegin(newBegin);
+ // feature.setEnd(newEnd);
continue;
}
continue;
}
- if (sf[s].getBegin() >= i)
+ int newBegin = feature.getBegin();
+ int newEnd = feature.getEnd();
+ if (newBegin >= i)
{
{
- sf[s].setBegin(i);
+ newBegin = i;
+ // feature.setBegin(i);
}
}
- if (sf[s].getEnd() < j)
+ if (newEnd < j)
{
{
- sf[s].setEnd(j - 1);
+ newEnd = j - 1;
+ // feature.setEnd(j - 1);
}
}
+ newEnd = newEnd - cSize;
+ // feature.setEnd(feature.getEnd() - (cSize));
- sf[s].setEnd(sf[s].getEnd() - (cSize));
-
- if (sf[s].getBegin() > sf[s].getEnd())
+ sequence.deleteFeature(feature);
+ if (newEnd >= newBegin)
{
{
- sequence.deleteFeature(sf[s]);
+ sequence.addSequenceFeature(new SequenceFeature(feature, newBegin,
+ newEnd, feature.getFeatureGroup()));
}
}
+ // if (feature.getBegin() > feature.getEnd())
+ // {
+ // sequence.deleteFeature(feature);
+ // }
}
if (command.editedFeatures == null)
}
if (command.editedFeatures == null)