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:
35df942
)
implement new insert annotation row method and ensure group annotation rows are remov...
author
jprocter
<Jim Procter>
Fri, 24 Jul 2009 15:10:05 +0000
(15:10 +0000)
committer
jprocter
<Jim Procter>
Fri, 24 Jul 2009 15:10:05 +0000
(15:10 +0000)
src/jalview/datamodel/Alignment.java
patch
|
blob
|
history
diff --git
a/src/jalview/datamodel/Alignment.java
b/src/jalview/datamodel/Alignment.java
index
7fcbda2
..
afe7032
100755
(executable)
--- a/
src/jalview/datamodel/Alignment.java
+++ b/
src/jalview/datamodel/Alignment.java
@@
-25,6
+25,10
@@
import jalview.analysis.*;
/**
* Data structure to hold and manipulate a multiple sequence alignment
*/
/**
* Data structure to hold and manipulate a multiple sequence alignment
*/
+/**
+ * @author JimP
+ *
+ */
public class Alignment implements AlignmentI
{
protected Alignment dataset;
public class Alignment implements AlignmentI
{
protected Alignment dataset;
@@
-352,6
+356,14
@@
public class Alignment implements AlignmentI
{
if (groups.contains(g))
{
{
if (groups.contains(g))
{
+ if (annotations!=null && annotations.length>0)
+ {
+ if (g.hasAnnotationRows())
+ { // remove any annotation references.
+ deleteAnnotation(g.getConsensus());// todo - create=false flag so we don't create another object unnecessarily
+ deleteAnnotation(g.getConservationRow());
+ }
+ }
groups.removeElement(g);
}
}
groups.removeElement(g);
}
}
@@
-606,14
+618,19
@@
public class Alignment implements AlignmentI
return swap;
}
return swap;
}
- /**
- * DOCUMENT ME!
- *
- * @param aa
- * DOCUMENT ME!
+ /* (non-Javadoc)
+ * @see jalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.AlignmentAnnotation)
*/
public void addAnnotation(AlignmentAnnotation aa)
{
*/
public void addAnnotation(AlignmentAnnotation aa)
{
+ addAnnotation(aa, -1);
+ }
+
+ /* (non-Javadoc)
+ * @see jalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.AlignmentAnnotation, int)
+ */
+ public void addAnnotation(AlignmentAnnotation aa, int pos)
+ {
int aSize = 1;
if (annotations != null)
{
int aSize = 1;
if (annotations != null)
{
@@
-621,16
+638,24
@@
public class Alignment implements AlignmentI
}
AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
}
AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];
-
- temp[aSize - 1] = aa;
-
int i = 0;
int i = 0;
-
+ if (pos==-1 || pos>=aSize) {
+ temp[aSize - 1] = aa;
+ } else {
+ temp[pos] = aa;
+ }
if (aSize > 1)
{
if (aSize > 1)
{
- for (i = 0; i < (aSize - 1); i++)
+ int p=0;
+ for (i = 0; i < (aSize-1); i++,p++)
{
{
- temp[i] = annotations[i];
+ if (p==pos)
+ {
+ p++;
+ }
+ if (p<temp.length) {
+ temp[p] = annotations[i];
+ }
}
}
}
}