From: amwaterhouse Date: Wed, 24 Jan 2007 17:30:12 +0000 (+0000) Subject: AdjustAnnotations needs position, number and insert X-Git-Tag: Release_2_3~448 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d8412f9b4ca9533eb56dc48e1d2273ee0e45bf3f;p=jalview.git AdjustAnnotations needs position, number and insert --- diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 552a5f8..f255ab5 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -470,15 +470,53 @@ public class Alignment implements AlignmentI } - public void adjustSequenceAnnotations() + public void adjustSequenceAnnotations(int position, + int number, + boolean insert) { if(annotations!=null) { + int aSize, tSize; + Annotation [] temp; for (int a = 0; a < annotations.length; a++) { - if (annotations[a].sequenceRef != null) + if(annotations[a].autoCalculated) { - annotations[a].adjustForAlignment(); + System.out.println("ignore "+annotations[a].label); + continue; + } + aSize = annotations[a].annotations.length; + if(insert) + tSize = aSize + number; + else + tSize = aSize - number; + + temp = new Annotation[tSize]; + + if(insert) + { + System.arraycopy(annotations[a].annotations, + 0, temp, 0, position); + + System.arraycopy(annotations[a].annotations, + position, temp, position+number, aSize - position); + } + else + { + System.arraycopy(annotations[a].annotations, + 0, temp, 0, position); + + System.arraycopy(annotations[a].annotations, + position + number, temp, position, + aSize - position - number); + } + + annotations[a].annotations = temp; + + + // if (annotations[a].sequenceRef != null) + { + // annotations[a].adjustForAlignment(); } } } diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index a97ca7f..4a3cad6 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -27,6 +27,10 @@ package jalview.datamodel; */ public class AlignmentAnnotation { + /** If true, this annotations is calculated every edit, + * eg consensus, quality or conservation graphs */ + public boolean autoCalculated = false; + public SequenceI sequenceRef; /** DOCUMENT ME!! */ diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index 12baabf..bf1614b 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -228,7 +228,10 @@ public interface AlignmentI */ public boolean padGaps(); - public void adjustSequenceAnnotations(); + public void adjustSequenceAnnotations(int position, + int number, + boolean insert); + public HiddenSequences getHiddenSequences(); /**