X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=10e2766580e9b93626d49e15f965b50b379d717d;hb=393371998dc63a471dbb64ad868bc09188a01c64;hp=62b9ea9cbebb195aef8d97a76d336b021ffb0199;hpb=2a64503d035e47cf9a40e5de979fd22980e50106;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 62b9ea9..10e2766 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -13,6 +13,10 @@ public class Alignment implements AlignmentI protected Vector groups = new Vector(); protected ArrayList superGroup = new ArrayList(); protected char gapCharacter = '-'; + public AlignmentAnnotation [] annotations; + public Conservation conservation; + + public boolean featuresAdded = false; /** Make an alignment from an array of Sequences. * @@ -40,14 +44,11 @@ public class Alignment implements AlignmentI } /** Adds a sequence to the alignment. Recalculates maxLength and size. - * Should put the new sequence in a sequence group!!! * * @param snew */ public void addSequence(SequenceI snew) { sequences.addElement(snew); - - ((SequenceGroup)groups.lastElement()).addSequence(snew); } public void addSequence(SequenceI[] seq) { @@ -57,8 +58,7 @@ public class Alignment implements AlignmentI } /** Adds a sequence to the alignment. Recalculates maxLength and size. - * Should put the new sequence in a sequence group!!! - * + * * @param snew */ public void setSequenceAt(int i,SequenceI snew) { @@ -66,8 +66,6 @@ public class Alignment implements AlignmentI deleteSequence(oldseq); sequences.setElementAt(snew,i); - - ((SequenceGroup)groups.lastElement()).addSequence(snew); } public Vector getGroups() { @@ -509,8 +507,52 @@ public class Alignment implements AlignmentI return false; return true; + } + + public void deleteAnnotation(AlignmentAnnotation aa) + { + int aSize = 1; + if(annotations!=null) + aSize = annotations.length; + + AlignmentAnnotation [] temp = new AlignmentAnnotation [aSize-1]; + + int tIndex = 0; + for (int i = 0; i < aSize; i++) + { + if(annotations[i]==aa) + continue; + + + temp[tIndex] = annotations[i]; + tIndex++; + } + annotations = temp; + + } + + public void addAnnotation(AlignmentAnnotation aa) + { + int aSize = 1; + if(annotations!=null) + aSize = annotations.length+1; + + AlignmentAnnotation [] temp = new AlignmentAnnotation [aSize]; + int i=0; + if (aSize > 1) + for (i = 0; i < aSize-1; i++) + temp[i] = annotations[i]; + + temp[i] = aa; + + annotations = temp; } + public AlignmentAnnotation[] getAlignmentAnnotation() + { + return annotations; + } + }