2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.datamodel;
23 import jalview.analysis.Rna;
24 import jalview.analysis.SecStrConsensus.SimpleBP;
25 import jalview.analysis.WUSSParseException;
27 import java.util.ArrayList;
28 import java.util.Collection;
29 import java.util.Collections;
30 import java.util.Enumeration;
31 import java.util.HashMap;
32 import java.util.Hashtable;
34 import java.util.Map.Entry;
42 public class AlignmentAnnotation
45 * If true, this annotations is calculated every edit, eg consensus, quality
46 * or conservation graphs
48 public boolean autoCalculated = false;
51 * unique ID for this annotation, used to match up the same annotation row
52 * shown in multiple views and alignments
54 public String annotationId;
57 * the sequence this annotation is associated with (or null)
59 public SequenceI sequenceRef;
61 /** label shown in dropdown menus and in the annotation label area */
64 /** longer description text shown as a tooltip */
65 public String description;
67 /** Array of annotations placed in the current coordinate system */
68 public Annotation[] annotations;
70 public ArrayList<SimpleBP> bps = null;
73 * RNA secondary structure contact positions
75 public SequenceFeature[] _rnasecstr = null;
78 * position of annotation resulting in invalid WUSS parsing or -1. -2 means
79 * there was no RNA structure in this annotation
81 private long invalidrnastruc = -2;
84 * Updates the _rnasecstr field Determines the positions that base pair and
85 * the positions of helices based on secondary structure from a Stockholm file
89 private void _updateRnaSecStr(CharSequence RNAannot)
93 _rnasecstr = Rna.GetBasePairs(RNAannot);
94 bps = Rna.GetModeleBP(RNAannot);
96 } catch (WUSSParseException px)
98 // DEBUG System.out.println(px);
99 invalidrnastruc = px.getProblemPos();
101 if (invalidrnastruc > -1)
105 Rna.HelixMap(_rnasecstr);
106 // setRNAStruc(RNAannot);
108 if (_rnasecstr != null && _rnasecstr.length > 0)
110 // show all the RNA secondary structure annotation symbols.
112 showAllColLabels = true;
113 scaleColLabel = true;
116 // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup());
120 private void _markRnaHelices()
122 // Figure out number of helices
123 // Length of rnasecstr is the number of pairs of positions that base pair
124 // with each other in the secondary structure
125 for (int x = 0; x < _rnasecstr.length; x++)
129 * System.out.println(this.annotation._rnasecstr[x] + " Begin" +
130 * this.annotation._rnasecstr[x].getBegin());
132 // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
136 val = Integer.valueOf(_rnasecstr[x].getFeatureGroup());
137 } catch (NumberFormatException q)
142 annotations[_rnasecstr[x].getBegin()].value = val;
143 annotations[_rnasecstr[x].getEnd()].value = val;
145 // annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val;
146 // annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val;
150 * map of positions in the associated annotation
152 public java.util.Hashtable<Integer, Annotation> sequenceMapping;
155 public float graphMin;
158 public float graphMax;
161 * Score associated with label and description.
163 public double score = Double.NaN;
166 * flag indicating if annotation has a score.
168 public boolean hasScore = false;
170 public GraphLine threshold;
172 // Graphical hints and tips
174 /** Can this row be edited by the user ? */
175 public boolean editable = false;
177 /** Indicates if annotation has a graphical symbol track */
178 public boolean hasIcons; //
180 /** Indicates if annotation has a text character label */
181 public boolean hasText;
183 /** is the row visible */
184 public boolean visible = true;
186 public int graphGroup = -1;
188 /** Displayed height of row in pixels */
189 public int height = 0;
191 public int graph = 0;
193 public int graphHeight = 40;
195 public boolean padGaps = false;
197 public static final int NO_GRAPH = 0;
199 public static final int BAR_GRAPH = 1;
201 public static final int LINE_GRAPH = 2;
203 public boolean belowAlignment = true;
205 public SequenceGroup groupRef = null;
208 * display every column label, even if there is a row of identical labels
210 public boolean showAllColLabels = false;
213 * scale the column label to fit within the alignment column.
215 public boolean scaleColLabel = false;
218 * centre the column labels relative to the alignment column
220 public boolean centreColLabels = false;
222 private boolean isrna;
227 * @see java.lang.Object#finalize()
229 protected void finalize() throws Throwable
236 public static int getGraphValueFromString(String string)
238 if (string.equalsIgnoreCase("BAR_GRAPH"))
242 else if (string.equalsIgnoreCase("LINE_GRAPH"))
252 // JBPNote: what does this do ?
253 public void ConcenStru(CharSequence RNAannot) throws WUSSParseException
255 bps = Rna.GetModeleBP(RNAannot);
259 * Creates a new AlignmentAnnotation object.
262 * short label shown under sequence labels
264 * text displayed on mouseover
266 * set of positional annotation elements
268 public AlignmentAnnotation(String label, String description,
269 Annotation[] annotations)
274 this.description = description;
275 this.annotations = annotations;
277 validateRangeAndDisplay();
281 * Checks if annotation labels represent secondary structures
284 void areLabelsSecondaryStructure()
286 boolean nonSSLabel = false;
288 StringBuffer rnastring = new StringBuffer();
291 for (int i = 0; i < annotations.length; i++)
293 if (annotations[i] == null)
297 if (annotations[i].secondaryStructure == 'H'
298 || annotations[i].secondaryStructure == 'E')
303 // Check for RNA secondary structure
305 // System.out.println(annotations[i].secondaryStructure);
306 // TODO: 2.8.2 should this ss symbol validation check be a function in
307 // RNA/ResidueProperties ?
308 if (annotations[i].secondaryStructure == '('
309 || annotations[i].secondaryStructure == '['
310 || annotations[i].secondaryStructure == '<'
311 || annotations[i].secondaryStructure == '{'
312 || annotations[i].secondaryStructure == 'A'
313 || annotations[i].secondaryStructure == 'B'
314 || annotations[i].secondaryStructure == 'C'
315 || annotations[i].secondaryStructure == 'D'
316 || annotations[i].secondaryStructure == 'E'
317 || annotations[i].secondaryStructure == 'F'
318 || annotations[i].secondaryStructure == 'G'
319 || annotations[i].secondaryStructure == 'H'
320 || annotations[i].secondaryStructure == 'I'
321 || annotations[i].secondaryStructure == 'J'
322 || annotations[i].secondaryStructure == 'K'
323 || annotations[i].secondaryStructure == 'L'
324 || annotations[i].secondaryStructure == 'M'
325 || annotations[i].secondaryStructure == 'N'
326 || annotations[i].secondaryStructure == 'O'
327 || annotations[i].secondaryStructure == 'P'
328 || annotations[i].secondaryStructure == 'Q'
329 || annotations[i].secondaryStructure == 'R'
330 || annotations[i].secondaryStructure == 'S'
331 || annotations[i].secondaryStructure == 'T'
332 || annotations[i].secondaryStructure == 'U'
333 || annotations[i].secondaryStructure == 'V'
334 || annotations[i].secondaryStructure == 'W'
335 || annotations[i].secondaryStructure == 'X'
336 || annotations[i].secondaryStructure == 'Y'
337 || annotations[i].secondaryStructure == 'Z')
344 // System.out.println("displaychar " + annotations[i].displayCharacter);
346 if (annotations[i].displayCharacter == null
347 || annotations[i].displayCharacter.length() == 0)
349 rnastring.append('.');
352 if (annotations[i].displayCharacter.length() == 1)
354 firstChar = annotations[i].displayCharacter.charAt(0);
355 // check to see if it looks like a sequence or is secondary structure
357 if (annotations[i].secondaryStructure != ' '
360 // Uncomment to only catch case where
361 // displayCharacter==secondary
363 // to correctly redisplay SS annotation imported from Stockholm,
364 // exported to JalviewXML and read back in again.
366 // annotations[i].displayCharacter.charAt(0)==annotations[i].secondaryStructure
401 && firstChar < jalview.schemes.ResidueProperties.aaIndex.length)
403 if (jalview.schemes.ResidueProperties.aaIndex[firstChar] < 23) // TODO:
416 rnastring.append(annotations[i].displayCharacter.charAt(1));
419 if (annotations[i].displayCharacter.length() > 0)
428 for (int j = 0; j < annotations.length; j++)
430 if (annotations[j] != null
431 && annotations[j].secondaryStructure != ' ')
433 annotations[j].displayCharacter = String
434 .valueOf(annotations[j].secondaryStructure);
435 annotations[j].secondaryStructure = ' ';
444 _updateRnaSecStr(new AnnotCharSequence());
448 annotationId = this.hashCode() + "";
452 * flyweight access to positions in the alignment annotation row for RNA
458 private class AnnotCharSequence implements CharSequence
464 public AnnotCharSequence()
466 this(0, annotations.length);
469 public AnnotCharSequence(int start, int end)
476 public CharSequence subSequence(int start, int end)
478 return new AnnotCharSequence(offset + start, offset + end);
488 public char charAt(int index)
490 return ((index + offset < 0) || (index + offset) >= max
491 || annotations[index + offset] == null || (annotations[index
492 + offset].secondaryStructure < ' ') ? ' '
493 : annotations[index + offset].secondaryStructure);
496 public String toString()
498 char[] string = new char[max - offset];
499 int mx = annotations.length;
501 for (int i = offset; i < mx; i++)
503 string[i] = (annotations[i] == null || (annotations[i].secondaryStructure < 32)) ? ' '
504 : annotations[i].secondaryStructure;
506 return new String(string);
510 private long _lastrnaannot = -1;
512 public String getRNAStruc()
516 String rnastruc = new AnnotCharSequence().toString();
517 if (_lastrnaannot != rnastruc.hashCode())
519 // ensure rna structure contacts are up to date
520 _lastrnaannot = rnastruc.hashCode();
521 _updateRnaSecStr(rnastruc);
529 * Creates a new AlignmentAnnotation object.
544 public AlignmentAnnotation(String label, String description,
545 Annotation[] annotations, float min, float max, int graphType)
547 // graphs are not editable
548 editable = graphType == 0;
551 this.description = description;
552 this.annotations = annotations;
556 validateRangeAndDisplay();
560 * checks graphMin and graphMax, secondary structure symbols, sets graphType
561 * appropriately, sets null labels to the empty string if appropriate.
563 public void validateRangeAndDisplay()
566 if (annotations == null)
568 visible = false; // try to prevent renderer from displaying.
569 return; // this is a non-annotation row annotation - ie a sequence score.
572 int graphType = graph;
573 float min = graphMin;
574 float max = graphMax;
575 boolean drawValues = true;
580 for (int i = 0; i < annotations.length; i++)
582 if (annotations[i] == null)
587 if (drawValues && annotations[i].displayCharacter != null
588 && annotations[i].displayCharacter.length() > 1)
593 if (annotations[i].value > max)
595 max = annotations[i].value;
598 if (annotations[i].value < min)
600 min = annotations[i].value;
602 if (_linecolour == null && annotations[i].colour != null)
604 _linecolour = annotations[i].colour;
607 // ensure zero is origin for min/max ranges on only one side of zero
624 areLabelsSecondaryStructure();
626 if (!drawValues && graphType != NO_GRAPH)
628 for (int i = 0; i < annotations.length; i++)
630 if (annotations[i] != null)
632 annotations[i].displayCharacter = "X";
639 * Copy constructor creates a new independent annotation row with the same
640 * associated sequenceRef
644 public AlignmentAnnotation(AlignmentAnnotation annotation)
646 this.label = new String(annotation.label);
647 if (annotation.description != null)
649 this.description = new String(annotation.description);
651 this.graphMin = annotation.graphMin;
652 this.graphMax = annotation.graphMax;
653 this.graph = annotation.graph;
654 this.graphHeight = annotation.graphHeight;
655 this.graphGroup = annotation.graphGroup;
656 this.groupRef = annotation.groupRef;
657 this.editable = annotation.editable;
658 this.autoCalculated = annotation.autoCalculated;
659 this.hasIcons = annotation.hasIcons;
660 this.hasText = annotation.hasText;
661 this.height = annotation.height;
662 this.label = annotation.label;
663 this.padGaps = annotation.padGaps;
664 this.visible = annotation.visible;
665 this.centreColLabels = annotation.centreColLabels;
666 this.scaleColLabel = annotation.scaleColLabel;
667 this.showAllColLabels = annotation.showAllColLabels;
668 this.calcId = annotation.calcId;
669 if (annotation.properties!=null)
671 properties = new HashMap<String,String>();
672 for (Map.Entry<String, String> val:annotation.properties.entrySet())
674 properties.put(val.getKey(), val.getValue());
677 if (this.hasScore = annotation.hasScore)
679 this.score = annotation.score;
681 if (annotation.threshold != null)
683 threshold = new GraphLine(annotation.threshold);
685 Annotation[] ann = annotation.annotations;
686 if (annotation.annotations != null)
688 this.annotations = new Annotation[ann.length];
689 for (int i = 0; i < ann.length; i++)
693 annotations[i] = new Annotation(ann[i]);
694 if (_linecolour != null)
696 _linecolour = annotations[i].colour;
701 if (annotation.sequenceRef != null)
703 this.sequenceRef = annotation.sequenceRef;
704 if (annotation.sequenceMapping != null)
707 sequenceMapping = new Hashtable();
708 Enumeration pos = annotation.sequenceMapping.keys();
709 while (pos.hasMoreElements())
711 // could optimise this!
712 p = (Integer) pos.nextElement();
713 Annotation a = annotation.sequenceMapping.get(p);
720 for (int i = 0; i < ann.length; i++)
724 sequenceMapping.put(p, annotations[i]);
732 this.sequenceMapping = null;
735 // TODO: check if we need to do this: JAL-952
736 // if (this.isrna=annotation.isrna)
738 // _rnasecstr=new SequenceFeature[annotation._rnasecstr];
740 validateRangeAndDisplay(); // construct hashcodes, etc.
744 * clip the annotation to the columns given by startRes and endRes (inclusive)
745 * and prune any existing sequenceMapping to just those columns.
750 public void restrict(int startRes, int endRes)
752 if (annotations == null)
761 if (startRes >= annotations.length)
763 startRes = annotations.length - 1;
765 if (endRes >= annotations.length)
767 endRes = annotations.length - 1;
769 if (annotations == null)
773 Annotation[] temp = new Annotation[endRes - startRes + 1];
774 if (startRes < annotations.length)
776 System.arraycopy(annotations, startRes, temp, 0, endRes - startRes
779 if (sequenceRef != null)
781 // Clip the mapping, if it exists.
782 int spos = sequenceRef.findPosition(startRes);
783 int epos = sequenceRef.findPosition(endRes);
784 if (sequenceMapping != null)
786 Hashtable newmapping = new Hashtable();
787 Enumeration e = sequenceMapping.keys();
788 while (e.hasMoreElements())
790 Integer pos = (Integer) e.nextElement();
791 if (pos.intValue() >= spos && pos.intValue() <= epos)
793 newmapping.put(pos, sequenceMapping.get(pos));
796 sequenceMapping.clear();
797 sequenceMapping = newmapping;
804 * set the annotation row to be at least length Annotations
807 * minimum number of columns required in the annotation row
808 * @return false if the annotation row is greater than length
810 public boolean padAnnotation(int length)
812 if (annotations == null)
814 return true; // annotation row is correct - null == not visible and
817 if (annotations.length < length)
819 Annotation[] na = new Annotation[length];
820 System.arraycopy(annotations, 0, na, 0, annotations.length);
824 return annotations.length > length;
831 * @return DOCUMENT ME!
833 public String toString()
835 StringBuffer buffer = new StringBuffer();
837 for (int i = 0; i < annotations.length; i++)
839 if (annotations[i] != null)
843 buffer.append(annotations[i].value);
847 buffer.append(annotations[i].secondaryStructure);
851 buffer.append(annotations[i].displayCharacter);
857 // TODO: remove disgusting hack for 'special' treatment of consensus line.
858 if (label.indexOf("Consensus") == 0)
862 for (int i = 0; i < annotations.length; i++)
864 if (annotations[i] != null)
866 buffer.append(annotations[i].description);
873 return buffer.toString();
876 public void setThreshold(GraphLine line)
881 public GraphLine getThreshold()
887 * Attach the annotation to seqRef, starting from startRes position. If
888 * alreadyMapped is true then the indices of the annotation[] array are
889 * sequence positions rather than alignment column positions.
893 * @param alreadyMapped
895 public void createSequenceMapping(SequenceI seqRef, int startRes,
896 boolean alreadyMapped)
903 sequenceRef = seqRef;
904 if (annotations == null)
908 sequenceMapping = new java.util.Hashtable();
912 for (int i = 0; i < annotations.length; i++)
914 if (annotations[i] != null)
918 seqPos = seqRef.findPosition(i);
922 seqPos = i + startRes;
925 sequenceMapping.put(new Integer(seqPos), annotations[i]);
931 public void adjustForAlignment()
933 if (sequenceRef == null)
938 if (annotations == null)
943 int a = 0, aSize = sequenceRef.getLength();
952 Annotation[] temp = new Annotation[aSize];
955 for (a = sequenceRef.getStart(); a <= sequenceRef.getEnd(); a++)
957 index = new Integer(a);
958 if (sequenceMapping.containsKey(index))
960 position = sequenceRef.findIndex(a) - 1;
962 temp[position] = sequenceMapping.get(index);
970 * remove any null entries in annotation row and return the number of non-null
971 * annotation elements.
975 public int compactAnnotationArray()
977 int i = 0, iSize = annotations.length;
980 if (annotations[i] == null)
984 System.arraycopy(annotations, i + 1, annotations, i, iSize - i
994 Annotation[] ann = annotations;
995 annotations = new Annotation[i];
996 System.arraycopy(ann, 0, annotations, 0, i);
1002 * Associate this annotion with the aligned residues of a particular sequence.
1003 * sequenceMapping will be updated in the following way: null sequenceI -
1004 * existing mapping will be discarded but annotations left in mapped
1005 * positions. valid sequenceI not equal to current sequenceRef: mapping is
1006 * discarded and rebuilt assuming 1:1 correspondence TODO: overload with
1007 * parameter to specify correspondence between current and new sequenceRef
1011 public void setSequenceRef(SequenceI sequenceI)
1013 if (sequenceI != null)
1015 if (sequenceRef != null)
1017 boolean rIsDs=sequenceRef.getDatasetSequence()==null,tIsDs=sequenceI.getDatasetSequence()==null;
1018 if (sequenceRef != sequenceI
1019 && (rIsDs && !tIsDs && sequenceRef != sequenceI
1020 .getDatasetSequence())
1021 && (!rIsDs && tIsDs && sequenceRef.getDatasetSequence() != sequenceI)
1022 && (!rIsDs && !tIsDs && sequenceRef.getDatasetSequence() != sequenceI
1023 .getDatasetSequence())
1024 && !sequenceRef.equals(sequenceI))
1026 // if sequenceRef isn't intersecting with sequenceI
1027 // throw away old mapping and reconstruct.
1029 if (sequenceMapping != null)
1031 sequenceMapping = null;
1032 // compactAnnotationArray();
1034 createSequenceMapping(sequenceI, 1, true);
1035 adjustForAlignment();
1039 // Mapping carried over
1040 sequenceRef = sequenceI;
1045 // No mapping exists
1046 createSequenceMapping(sequenceI, 1, true);
1047 adjustForAlignment();
1052 // throw away the mapping without compacting.
1053 sequenceMapping = null;
1061 public double getScore()
1070 public void setScore(double score)
1078 * @return true if annotation has an associated score
1080 public boolean hasScore()
1082 return hasScore || !Double.isNaN(score);
1086 * Score only annotation
1089 * @param description
1092 public AlignmentAnnotation(String label, String description, double score)
1094 this(label, description, null);
1099 * copy constructor with edit based on the hidden columns marked in colSel
1101 * @param alignmentAnnotation
1104 public AlignmentAnnotation(AlignmentAnnotation alignmentAnnotation,
1105 ColumnSelection colSel)
1107 this(alignmentAnnotation);
1108 if (annotations == null)
1112 colSel.makeVisibleAnnotation(this);
1115 public void setPadGaps(boolean padgaps, char gapchar)
1117 this.padGaps = padgaps;
1121 for (int i = 0; i < annotations.length; i++)
1123 if (annotations[i] == null)
1125 annotations[i] = new Annotation(String.valueOf(gapchar), null,
1128 else if (annotations[i].displayCharacter == null
1129 || annotations[i].displayCharacter.equals(" "))
1131 annotations[i].displayCharacter = String.valueOf(gapchar);
1138 * format description string for display
1141 * @return Get the annotation description string optionally prefixed by
1142 * associated sequence name (if any)
1144 public String getDescription(boolean seqname)
1146 if (seqname && this.sequenceRef != null)
1148 int i = description.toLowerCase().indexOf("<html>");
1151 // move the html tag to before the sequence reference.
1152 return "<html>" + sequenceRef.getName() + " : "
1153 + description.substring(i + 6);
1155 return sequenceRef.getName() + " : " + description;
1160 public boolean isValidStruc()
1162 return invalidrnastruc == -1;
1165 public long getInvalidStrucPos()
1167 return invalidrnastruc;
1171 * machine readable ID string indicating what generated this annotation
1173 protected String calcId = "";
1176 * properties associated with the calcId
1178 protected Map<String, String> properties = new HashMap<String, String>();
1181 * base colour for line graphs. If null, will be set automatically by
1182 * searching the alignment annotation
1184 public java.awt.Color _linecolour;
1186 public String getCalcId()
1191 public void setCalcId(String calcId)
1193 this.calcId = calcId;
1196 public boolean isRNA()
1202 * transfer annotation to the given sequence using the given mapping from the
1203 * current positions or an existing sequence mapping
1207 * map involving sq as To or From
1209 public void liftOver(SequenceI sq, Mapping sp2sq)
1211 if (sp2sq.getMappedWidth() != sp2sq.getWidth())
1213 // TODO: employ getWord/MappedWord to transfer annotation between cDNA and Protein reference frames
1214 throw new Error("liftOver currently not implemented for transfer of annotation between different types of seqeunce");
1216 boolean mapIsTo = (sp2sq != null) ? (sp2sq.getTo() == sq || sp2sq
1217 .getTo() == sq.getDatasetSequence()) : false;
1219 // TODO build a better annotation element map and get rid of annotations[]
1220 Hashtable<Integer, Annotation> mapForsq = new Hashtable();
1221 if (sequenceMapping != null)
1225 for (Entry<Integer, Annotation> ie : sequenceMapping.entrySet())
1227 Integer mpos = Integer.valueOf(mapIsTo ? sp2sq
1228 .getMappedPosition(ie.getKey()) : sp2sq.getPosition(ie
1230 if (mpos >= sq.getStart() && mpos <= sq.getEnd())
1232 mapForsq.put(mpos, ie.getValue());
1235 sequenceMapping = mapForsq;
1237 adjustForAlignment();
1247 * like liftOver but more general.
1249 * Takes an array of int pairs that will be used to update the internal
1250 * sequenceMapping and so shuffle the annotated positions
1253 * - new sequence reference for the annotation row - if null,
1254 * sequenceRef is left unchanged
1256 * array of ints containing corresponding positions
1258 * - column for current coordinate system (-1 for index+1)
1260 * - column for destination coordinate system (-1 for index+1)
1262 * - offset added to index when referencing either coordinate system
1263 * @note no checks are made as to whether from and/or to are sensible
1264 * @note caller should add the remapped annotation to newref if they have not
1267 public void remap(SequenceI newref, int[][] mapping, int from, int to,
1270 if (mapping != null)
1272 Hashtable<Integer, Annotation> old = sequenceMapping, remap = new Hashtable<Integer, Annotation>();
1274 for (int mp[] : mapping)
1280 Annotation ann = null;
1283 ann = sequenceMapping.get(Integer.valueOf(idxoffset + index));
1287 if (mp != null && mp.length > from)
1289 ann = sequenceMapping.get(Integer.valueOf(mp[from]));
1296 remap.put(Integer.valueOf(idxoffset + index), ann);
1300 if (to > -1 && to < mp.length)
1302 remap.put(Integer.valueOf(mp[to]), ann);
1307 sequenceMapping = remap;
1311 sequenceRef = newref;
1313 adjustForAlignment();
1317 public String getProperty(String property)
1319 if (properties == null)
1323 return properties.get(property);
1326 public void setProperty(String property, String value)
1328 if (properties==null)
1330 properties = new HashMap<String,String>();
1332 properties.put(property, value);
1335 public boolean hasProperties()
1337 return properties != null && properties.size() > 0;
1340 public Collection<String> getProperties()
1342 if (properties == null)
1344 return Collections.EMPTY_LIST;
1346 return properties.keySet();