From: amwaterhouse Date: Fri, 3 Feb 2006 17:40:26 +0000 (+0000) Subject: Add annotation with sequence ref updated X-Git-Tag: Root_VamJalview_2_07b+~182 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e0a4b92352ee3e31a8dea075a51ec080ae3945f2;p=jalview.git Add annotation with sequence ref updated --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 2545ec1..78aa015 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -59,6 +59,16 @@ public class Alignment implements AlignmentI for (i = 0; i < seqs.length; i++) { sequences.addElement(seqs[i]); + + if(seqs[i].getDatasetSequence()!=null + && seqs[i].getDatasetSequence().getAnnotation()!=null) + { + + for(int a=0; a 0) + copy = new AlignmentAnnotation( + aa.label, aa.description, aa.annotations, aa.graphMin, + aa.graphMax, aa.graph + ); + else + copy = new AlignmentAnnotation( + aa.label, aa.description, aa.annotations + ); + + copy.datasetAnnotation = aa; + + addAnnotation(copy); + + copy.sequenceRef = seqRef; + + return copy; + } + else + { + addAnnotation(aa); + return aa; } + } - addAnnotation(aa); + public void adjustSequenceAnnotations() + { + if(annotations!=null) + { + for (int a = 0; a < annotations.length; a++) + { + if (annotations[a].sequenceRef != null) + { + annotations[a].adjustForAlignment(); + } + } + } } /** @@ -671,30 +739,52 @@ public class Alignment implements AlignmentI public void addAnnotation(AlignmentAnnotation aa) { int aSize = 1; - if (annotations != null) { aSize = annotations.length + 1; } - AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize]; - temp[0] = aa; + temp[aSize-1] = aa; - int i = 1; + int i = 0; if (aSize > 1) { - for (i = 1; i < (aSize); i++) + for (i = 0; i < (aSize-1); i++) { - temp[i] = annotations[i-1]; + temp[i] = annotations[i]; } } annotations = temp; } + public void setAnnotationIndex(AlignmentAnnotation aa, int index) + { + if(aa==null || annotations==null || annotations.length-1index) + temp[a] = datasetAnnotation.annotations[index]; + } + } + + annotations = temp; + } } diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index 69a5ac6..ebd95d9 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -251,7 +251,9 @@ public interface AlignmentI * Adds a new AlignmentAnnotation to this alignment, * associated to Sequence starting at sequence index */ - public void addAnnotation(AlignmentAnnotation aa, SequenceI seqRef, int index); + public AlignmentAnnotation addAnnotation(AlignmentAnnotation aa, SequenceI seqRef); + + public void setAnnotationIndex(AlignmentAnnotation aa, int index); /** * Deletes a specific AlignmentAnnotation from the alignment. @@ -312,5 +314,7 @@ public interface AlignmentI */ public boolean padGaps(); + public void adjustSequenceAnnotations(); + }