From: jprocter Date: Thu, 19 Apr 2007 14:54:43 +0000 (+0000) Subject: copying sequenceMapping, restrict(alstart/end) and pad(alwidth) method. X-Git-Tag: Release_2_3~212 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=42b2dad36e360f2c9b12f209ff4eea09028d0318;p=jalview.git copying sequenceMapping, restrict(alstart/end) and pad(alwidth) method. --- diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 2577e71..0f2a423 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -20,7 +20,6 @@ package jalview.datamodel; import java.util.Enumeration; import java.util.Hashtable; -import java.util.Vector; /** * DOCUMENT ME! @@ -286,25 +285,34 @@ public class AlignmentAnnotation threshold = new GraphLine(annotation.threshold); } if (annotation.annotations!=null) { - Vector anvec = new Vector(); Annotation[] ann = annotation.annotations; this.annotations = new Annotation[ann.length]; for (int i=0; i=spos && pos.intValue()<=epos) + { + newmapping.put(pos, sequenceMapping.get(pos)); + } + } + sequenceMapping.clear(); + sequenceMapping = newmapping; + } + } + annotations=temp; + } + /** + * set the annotation row to be at least length Annotations + * @param length minimum number of columns required in the annotation row + * @return false if the annotation row is greater than length + */ + public boolean padAnnotation(int length) { + if (annotations==null) + { + annotations = new Annotation[length]; + return true; + } + if (annotations.lengthlength; + + } + + /** * DOCUMENT ME! * * @return DOCUMENT ME! @@ -470,30 +532,40 @@ public class AlignmentAnnotation */ public void setSequenceRef(SequenceI sequenceI) { - if (sequenceI!=null) { - if (sequenceRef!=null) { - if (sequenceRef!=sequenceI && !sequenceRef.equals(sequenceI)) { + if (sequenceI != null) + { + if (sequenceRef != null) + { + if (sequenceRef != sequenceI && !sequenceRef.equals(sequenceI) && sequenceRef.getDatasetSequence()!=sequenceI.getDatasetSequence()) + { + // if sequenceRef isn't intersecting with sequenceI // throw away old mapping and reconstruct. - sequenceRef=null; - if (sequenceMapping!=null) + sequenceRef = null; + if (sequenceMapping != null) { - sequenceMapping=null; + sequenceMapping = null; // compactAnnotationArray(); } - createSequenceMapping(sequenceI, 1,true); + createSequenceMapping(sequenceI, 1, true); adjustForAlignment(); - } else { + } + else + { // Mapping carried over sequenceRef = sequenceI; } - } else { + } + else + { // No mapping exists createSequenceMapping(sequenceI, 1, true); adjustForAlignment(); } - } else { + } + else + { // throw away the mapping without compacting. - sequenceMapping=null; + sequenceMapping = null; sequenceRef = null; } }