X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=b4e2b3f45be44f4ef1db3623dbf085a6b4aee2cc;hb=4944c2f33bb34b4f262fd2f3ae40dcdc2a825557;hp=e9af7f457ee0d674b3bb3646b0ceaf730860852c;hpb=20403dbf83a2caa650a4ccd37f5a6dae7d0bd0f3;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index e9af7f4..b4e2b3f 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; + } + } + + public void adjustSequenceAnnotations() + { + if(annotations!=null) + { + for (int a = 0; a < annotations.length; a++) + { + if (annotations[a].sequenceRef != null) + { + annotations[a].adjustForAlignment(); + } + } + } + } + + /** * DOCUMENT ME! * * @param aa DOCUMENT ME! @@ -650,25 +699,48 @@ 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[aSize-1] = aa; + int i = 0; if (aSize > 1) { - for (i = 0; i < (aSize - 1); i++) + for (i = 0; i < (aSize-1); i++) { temp[i] = annotations[i]; } } - temp[i] = aa; + annotations = temp; + } + + public void setAnnotationIndex(AlignmentAnnotation aa, int index) + { + if(aa==null || annotations==null || annotations.length-1