+ * clip the annotation to the columns given by startRes and endRes (inclusive)
+ * and prune any existing sequenceMapping to just those columns.
+ * @param startRes
+ * @param endRes
+ */
+ public void restrict(int startRes, int endRes)
+ {
+ Annotation[] temp = new Annotation[endRes-startRes+1];
+ System.arraycopy(annotations, startRes, temp, 0, endRes-startRes+1);
+ if (sequenceRef!=null) {
+ // Clip the mapping, if it exists.
+ int spos = sequenceRef.findPosition(startRes);
+ int epos = sequenceRef.findPosition(endRes);
+ if (sequenceMapping!=null)
+ {
+ Hashtable newmapping = new Hashtable();
+ Enumeration e = sequenceMapping.keys();
+ while (e.hasMoreElements())
+ {
+ Integer pos = (Integer) e.nextElement();
+ if (pos.intValue()>=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.length<length)
+ {
+ Annotation[] na = new Annotation[length];
+ System.arraycopy(annotations, 0, na, 0, annotations.length);
+ annotations = na;
+ return true;
+ }
+ return annotations.length>length;
+
+ }
+
+ /**