2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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.HashMap;
31 import java.util.Iterator;
33 import java.util.Map.Entry;
41 public class AlignmentAnnotation
44 * If true, this annotations is calculated every edit, eg consensus, quality
45 * or conservation graphs
47 public boolean autoCalculated = false;
50 * unique ID for this annotation, used to match up the same annotation row
51 * shown in multiple views and alignments
53 public String annotationId;
56 * the sequence this annotation is associated with (or null)
58 public SequenceI sequenceRef;
60 /** label shown in dropdown menus and in the annotation label area */
63 /** longer description text shown as a tooltip */
64 public String description;
66 /** Array of annotations placed in the current coordinate system */
67 public Annotation[] annotations;
69 public ArrayList<SimpleBP> bps = null;
72 * RNA secondary structure contact positions
74 public SequenceFeature[] _rnasecstr = null;
77 * position of annotation resulting in invalid WUSS parsing or -1. -2 means
78 * there was no RNA structure in this annotation
80 private long invalidrnastruc = -2;
83 * Updates the _rnasecstr field Determines the positions that base pair and
84 * the positions of helices based on secondary structure from a Stockholm file
88 private void _updateRnaSecStr(CharSequence RNAannot)
92 _rnasecstr = Rna.GetBasePairs(RNAannot);
93 bps = Rna.GetModeleBP(RNAannot);
95 } catch (WUSSParseException px)
97 // DEBUG System.out.println(px);
98 invalidrnastruc = px.getProblemPos();
100 if (invalidrnastruc > -1)
104 Rna.HelixMap(_rnasecstr);
105 // setRNAStruc(RNAannot);
107 if (_rnasecstr != null && _rnasecstr.length > 0)
109 // show all the RNA secondary structure annotation symbols.
111 showAllColLabels = true;
112 scaleColLabel = true;
115 // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup());
119 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());
141 } catch (NumberFormatException q)
146 annotations[_rnasecstr[x].getBegin()].value = val;
147 annotations[_rnasecstr[x].getEnd()].value = val;
149 // annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val;
150 // annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val;
155 * map of positions in the associated annotation
157 private Map<Integer, Annotation> sequenceMapping;
160 public float graphMin;
163 public float graphMax;
166 * Score associated with label and description.
168 public double score = Double.NaN;
171 * flag indicating if annotation has a score.
173 public boolean hasScore = false;
175 public GraphLine threshold;
177 // Graphical hints and tips
179 /** Can this row be edited by the user ? */
180 public boolean editable = false;
182 /** Indicates if annotation has a graphical symbol track */
183 public boolean hasIcons; //
185 /** Indicates if annotation has a text character label */
186 public boolean hasText;
188 /** is the row visible */
189 public boolean visible = true;
191 public int graphGroup = -1;
193 /** Displayed height of row in pixels */
194 public int height = 0;
196 public int graph = 0;
198 public int graphHeight = 40;
200 public boolean padGaps = false;
202 public static final int NO_GRAPH = 0;
204 public static final int BAR_GRAPH = 1;
206 public static final int LINE_GRAPH = 2;
208 public boolean belowAlignment = true;
210 public SequenceGroup groupRef = null;
213 * display every column label, even if there is a row of identical labels
215 public boolean showAllColLabels = false;
218 * scale the column label to fit within the alignment column.
220 public boolean scaleColLabel = false;
223 * centre the column labels relative to the alignment column
225 public boolean centreColLabels = false;
227 private boolean isrna;
232 * @see java.lang.Object#finalize()
234 protected void finalize() throws Throwable
241 public static int getGraphValueFromString(String string)
243 if (string.equalsIgnoreCase("BAR_GRAPH"))
247 else if (string.equalsIgnoreCase("LINE_GRAPH"))
257 // JBPNote: what does this do ?
258 public void ConcenStru(CharSequence RNAannot) throws WUSSParseException
260 bps = Rna.GetModeleBP(RNAannot);
264 * Creates a new AlignmentAnnotation object.
267 * short label shown under sequence labels
269 * text displayed on mouseover
271 * set of positional annotation elements
273 public AlignmentAnnotation(String label, String description,
274 Annotation[] annotations)
279 this.description = description;
280 this.annotations = annotations;
282 validateRangeAndDisplay();
286 * Checks if annotation labels represent secondary structures
289 void areLabelsSecondaryStructure()
291 boolean nonSSLabel = false;
293 StringBuffer rnastring = new StringBuffer();
296 for (int i = 0; i < annotations.length; i++)
298 if (annotations[i] == null)
302 if (annotations[i].secondaryStructure == 'H'
303 || annotations[i].secondaryStructure == 'E')
308 // Check for RNA secondary structure
310 // System.out.println(annotations[i].secondaryStructure);
311 // TODO: 2.8.2 should this ss symbol validation check be a function in
312 // RNA/ResidueProperties ?
313 if (annotations[i].secondaryStructure == '('
314 || annotations[i].secondaryStructure == '['
315 || annotations[i].secondaryStructure == '<'
316 || annotations[i].secondaryStructure == '{'
317 || annotations[i].secondaryStructure == 'A'
318 || annotations[i].secondaryStructure == 'B'
319 || annotations[i].secondaryStructure == 'C'
320 || annotations[i].secondaryStructure == 'D'
321 || annotations[i].secondaryStructure == 'E'
322 || annotations[i].secondaryStructure == 'F'
323 || annotations[i].secondaryStructure == 'G'
324 || annotations[i].secondaryStructure == 'H'
325 || annotations[i].secondaryStructure == 'I'
326 || annotations[i].secondaryStructure == 'J'
327 || annotations[i].secondaryStructure == 'K'
328 || annotations[i].secondaryStructure == 'L'
329 || annotations[i].secondaryStructure == 'M'
330 || annotations[i].secondaryStructure == 'N'
331 || annotations[i].secondaryStructure == 'O'
332 || annotations[i].secondaryStructure == 'P'
333 || annotations[i].secondaryStructure == 'Q'
334 || annotations[i].secondaryStructure == 'R'
335 || annotations[i].secondaryStructure == 'S'
336 || annotations[i].secondaryStructure == 'T'
337 || annotations[i].secondaryStructure == 'U'
338 || annotations[i].secondaryStructure == 'V'
339 || annotations[i].secondaryStructure == 'W'
340 || annotations[i].secondaryStructure == 'X'
341 || annotations[i].secondaryStructure == 'Y'
342 || annotations[i].secondaryStructure == 'Z')
349 // System.out.println("displaychar " + annotations[i].displayCharacter);
351 if (annotations[i].displayCharacter == null
352 || annotations[i].displayCharacter.length() == 0)
354 rnastring.append('.');
357 if (annotations[i].displayCharacter.length() == 1)
359 firstChar = annotations[i].displayCharacter.charAt(0);
360 // check to see if it looks like a sequence or is secondary structure
362 if (annotations[i].secondaryStructure != ' '
365 // Uncomment to only catch case where
366 // displayCharacter==secondary
368 // to correctly redisplay SS annotation imported from Stockholm,
369 // exported to JalviewXML and read back in again.
371 // annotations[i].displayCharacter.charAt(0)==annotations[i].secondaryStructure
406 && firstChar < jalview.schemes.ResidueProperties.aaIndex.length)
408 if (jalview.schemes.ResidueProperties.aaIndex[firstChar] < 23) // TODO:
421 rnastring.append(annotations[i].displayCharacter.charAt(1));
424 if (annotations[i].displayCharacter.length() > 0)
433 for (int j = 0; j < annotations.length; j++)
435 if (annotations[j] != null
436 && annotations[j].secondaryStructure != ' ')
438 annotations[j].displayCharacter = String
439 .valueOf(annotations[j].secondaryStructure);
440 annotations[j].secondaryStructure = ' ';
449 _updateRnaSecStr(new AnnotCharSequence());
453 annotationId = this.hashCode() + "";
457 * flyweight access to positions in the alignment annotation row for RNA
463 private class AnnotCharSequence implements CharSequence
469 public AnnotCharSequence()
471 this(0, annotations.length);
474 public AnnotCharSequence(int start, int end)
481 public CharSequence subSequence(int start, int end)
483 return new AnnotCharSequence(offset + start, offset + end);
493 public char charAt(int index)
495 return ((index + offset < 0) || (index + offset) >= max
496 || annotations[index + offset] == null || (annotations[index
497 + offset].secondaryStructure < ' ') ? ' '
498 : annotations[index + offset].secondaryStructure);
502 public String toString()
504 char[] string = new char[max - offset];
505 int mx = annotations.length;
507 for (int i = offset; i < mx; i++)
509 string[i] = (annotations[i] == null || (annotations[i].secondaryStructure < 32)) ? ' '
510 : annotations[i].secondaryStructure;
512 return new String(string);
516 private long _lastrnaannot = -1;
518 public String getRNAStruc()
522 String rnastruc = new AnnotCharSequence().toString();
523 if (_lastrnaannot != rnastruc.hashCode())
525 // ensure rna structure contacts are up to date
526 _lastrnaannot = rnastruc.hashCode();
527 _updateRnaSecStr(rnastruc);
535 * Creates a new AlignmentAnnotation object.
550 public AlignmentAnnotation(String label, String description,
551 Annotation[] annotations, float min, float max, int graphType)
553 // graphs are not editable
554 editable = graphType == 0;
557 this.description = description;
558 this.annotations = annotations;
562 validateRangeAndDisplay();
566 * checks graphMin and graphMax, secondary structure symbols, sets graphType
567 * appropriately, sets null labels to the empty string if appropriate.
569 public void validateRangeAndDisplay()
572 if (annotations == null)
574 visible = false; // try to prevent renderer from displaying.
575 return; // this is a non-annotation row annotation - ie a sequence score.
578 int graphType = graph;
579 float min = graphMin;
580 float max = graphMax;
581 boolean drawValues = true;
586 for (int i = 0; i < annotations.length; i++)
588 if (annotations[i] == null)
593 if (drawValues && annotations[i].displayCharacter != null
594 && annotations[i].displayCharacter.length() > 1)
599 if (annotations[i].value > max)
601 max = annotations[i].value;
604 if (annotations[i].value < min)
606 min = annotations[i].value;
608 if (_linecolour == null && annotations[i].colour != null)
610 _linecolour = annotations[i].colour;
613 // ensure zero is origin for min/max ranges on only one side of zero
630 areLabelsSecondaryStructure();
632 if (!drawValues && graphType != NO_GRAPH)
634 for (int i = 0; i < annotations.length; i++)
636 if (annotations[i] != null)
638 annotations[i].displayCharacter = "X";
645 * Copy constructor creates a new independent annotation row with the same
646 * associated sequenceRef
650 public AlignmentAnnotation(AlignmentAnnotation annotation)
652 this.label = new String(annotation.label);
653 if (annotation.description != null)
655 this.description = new String(annotation.description);
657 this.graphMin = annotation.graphMin;
658 this.graphMax = annotation.graphMax;
659 this.graph = annotation.graph;
660 this.graphHeight = annotation.graphHeight;
661 this.graphGroup = annotation.graphGroup;
662 this.groupRef = annotation.groupRef;
663 this.editable = annotation.editable;
664 this.autoCalculated = annotation.autoCalculated;
665 this.hasIcons = annotation.hasIcons;
666 this.hasText = annotation.hasText;
667 this.height = annotation.height;
668 this.label = annotation.label;
669 this.padGaps = annotation.padGaps;
670 this.visible = annotation.visible;
671 this.centreColLabels = annotation.centreColLabels;
672 this.scaleColLabel = annotation.scaleColLabel;
673 this.showAllColLabels = annotation.showAllColLabels;
674 this.calcId = annotation.calcId;
675 if (annotation.properties!=null)
677 properties = new HashMap<String,String>();
678 for (Map.Entry<String, String> val:annotation.properties.entrySet())
680 properties.put(val.getKey(), val.getValue());
683 if (this.hasScore = annotation.hasScore)
685 this.score = annotation.score;
687 if (annotation.threshold != null)
689 threshold = new GraphLine(annotation.threshold);
691 Annotation[] ann = annotation.annotations;
692 if (annotation.annotations != null)
694 this.annotations = new Annotation[ann.length];
695 for (int i = 0; i < ann.length; i++)
699 annotations[i] = new Annotation(ann[i]);
700 if (_linecolour != null)
702 _linecolour = annotations[i].colour;
707 if (annotation.sequenceRef != null)
709 this.sequenceRef = annotation.sequenceRef;
710 if (annotation.sequenceMapping != null)
713 sequenceMapping = new HashMap<Integer, Annotation>();
714 Iterator<Integer> pos = annotation.sequenceMapping.keySet()
716 while (pos.hasNext())
718 // could optimise this!
720 Annotation a = annotation.sequenceMapping.get(p);
727 for (int i = 0; i < ann.length; i++)
731 sequenceMapping.put(p, annotations[i]);
739 this.sequenceMapping = null;
742 // TODO: check if we need to do this: JAL-952
743 // if (this.isrna=annotation.isrna)
745 // _rnasecstr=new SequenceFeature[annotation._rnasecstr];
747 validateRangeAndDisplay(); // construct hashcodes, etc.
751 * clip the annotation to the columns given by startRes and endRes (inclusive)
752 * and prune any existing sequenceMapping to just those columns.
757 public void restrict(int startRes, int endRes)
759 if (annotations == null)
768 if (startRes >= annotations.length)
770 startRes = annotations.length - 1;
772 if (endRes >= annotations.length)
774 endRes = annotations.length - 1;
776 if (annotations == null)
780 Annotation[] temp = new Annotation[endRes - startRes + 1];
781 if (startRes < annotations.length)
783 System.arraycopy(annotations, startRes, temp, 0, endRes - startRes
786 if (sequenceRef != null)
788 // Clip the mapping, if it exists.
789 int spos = sequenceRef.findPosition(startRes);
790 int epos = sequenceRef.findPosition(endRes);
791 if (sequenceMapping != null)
793 Map<Integer, Annotation> newmapping = new HashMap<Integer, Annotation>();
794 Iterator<Integer> e = sequenceMapping.keySet().iterator();
797 Integer pos = e.next();
798 if (pos.intValue() >= spos && pos.intValue() <= epos)
800 newmapping.put(pos, sequenceMapping.get(pos));
803 sequenceMapping.clear();
804 sequenceMapping = newmapping;
811 * set the annotation row to be at least length Annotations
814 * minimum number of columns required in the annotation row
815 * @return false if the annotation row is greater than length
817 public boolean padAnnotation(int length)
819 if (annotations == null)
821 return true; // annotation row is correct - null == not visible and
824 if (annotations.length < length)
826 Annotation[] na = new Annotation[length];
827 System.arraycopy(annotations, 0, na, 0, annotations.length);
831 return annotations.length > length;
838 * @return DOCUMENT ME!
841 public String toString()
843 StringBuilder buffer = new StringBuilder(256);
845 for (int i = 0; i < annotations.length; i++)
847 if (annotations[i] != null)
851 buffer.append(annotations[i].value);
855 buffer.append(annotations[i].secondaryStructure);
859 buffer.append(annotations[i].displayCharacter);
865 // TODO: remove disgusting hack for 'special' treatment of consensus line.
866 if (label.indexOf("Consensus") == 0)
870 for (int i = 0; i < annotations.length; i++)
872 if (annotations[i] != null)
874 buffer.append(annotations[i].description);
881 return buffer.toString();
884 public void setThreshold(GraphLine line)
889 public GraphLine getThreshold()
895 * Attach the annotation to seqRef, starting from startRes position. If
896 * alreadyMapped is true then the indices of the annotation[] array are
897 * sequence positions rather than alignment column positions.
901 * @param alreadyMapped
903 public void createSequenceMapping(SequenceI seqRef, int startRes,
904 boolean alreadyMapped)
911 sequenceRef = seqRef;
912 if (annotations == null)
916 sequenceMapping = new HashMap<Integer, Annotation>();
920 for (int i = 0; i < annotations.length; i++)
922 if (annotations[i] != null)
926 seqPos = seqRef.findPosition(i);
930 seqPos = i + startRes;
933 sequenceMapping.put(new Integer(seqPos), annotations[i]);
939 public void adjustForAlignment()
941 if (sequenceRef == null)
946 if (annotations == null)
951 int a = 0, aSize = sequenceRef.getLength();
960 Annotation[] temp = new Annotation[aSize];
963 for (a = sequenceRef.getStart(); a <= sequenceRef.getEnd(); a++)
965 index = new Integer(a);
966 if (sequenceMapping.containsKey(index))
968 position = sequenceRef.findIndex(a) - 1;
970 temp[position] = sequenceMapping.get(index);
978 * remove any null entries in annotation row and return the number of non-null
979 * annotation elements.
983 public int compactAnnotationArray()
985 int i = 0, iSize = annotations.length;
988 if (annotations[i] == null)
992 System.arraycopy(annotations, i + 1, annotations, i, iSize - i
1002 Annotation[] ann = annotations;
1003 annotations = new Annotation[i];
1004 System.arraycopy(ann, 0, annotations, 0, i);
1010 * Associate this annotion with the aligned residues of a particular sequence.
1011 * sequenceMapping will be updated in the following way: null sequenceI -
1012 * existing mapping will be discarded but annotations left in mapped
1013 * positions. valid sequenceI not equal to current sequenceRef: mapping is
1014 * discarded and rebuilt assuming 1:1 correspondence TODO: overload with
1015 * parameter to specify correspondence between current and new sequenceRef
1019 public void setSequenceRef(SequenceI sequenceI)
1021 if (sequenceI != null)
1023 if (sequenceRef != null)
1025 boolean rIsDs=sequenceRef.getDatasetSequence()==null,tIsDs=sequenceI.getDatasetSequence()==null;
1026 if (sequenceRef != sequenceI
1027 && (rIsDs && !tIsDs && sequenceRef != sequenceI
1028 .getDatasetSequence())
1029 && (!rIsDs && tIsDs && sequenceRef.getDatasetSequence() != sequenceI)
1030 && (!rIsDs && !tIsDs && sequenceRef.getDatasetSequence() != sequenceI
1031 .getDatasetSequence())
1032 && !sequenceRef.equals(sequenceI))
1034 // if sequenceRef isn't intersecting with sequenceI
1035 // throw away old mapping and reconstruct.
1037 if (sequenceMapping != null)
1039 sequenceMapping = null;
1040 // compactAnnotationArray();
1042 createSequenceMapping(sequenceI, 1, true);
1043 adjustForAlignment();
1047 // Mapping carried over
1048 sequenceRef = sequenceI;
1053 // No mapping exists
1054 createSequenceMapping(sequenceI, 1, true);
1055 adjustForAlignment();
1060 // throw away the mapping without compacting.
1061 sequenceMapping = null;
1069 public double getScore()
1078 public void setScore(double score)
1086 * @return true if annotation has an associated score
1088 public boolean hasScore()
1090 return hasScore || !Double.isNaN(score);
1094 * Score only annotation
1097 * @param description
1100 public AlignmentAnnotation(String label, String description, double score)
1102 this(label, description, null);
1107 * copy constructor with edit based on the hidden columns marked in colSel
1109 * @param alignmentAnnotation
1112 public AlignmentAnnotation(AlignmentAnnotation alignmentAnnotation,
1113 ColumnSelection colSel)
1115 this(alignmentAnnotation);
1116 if (annotations == null)
1120 colSel.makeVisibleAnnotation(this);
1123 public void setPadGaps(boolean padgaps, char gapchar)
1125 this.padGaps = padgaps;
1129 for (int i = 0; i < annotations.length; i++)
1131 if (annotations[i] == null)
1133 annotations[i] = new Annotation(String.valueOf(gapchar), null,
1136 else if (annotations[i].displayCharacter == null
1137 || annotations[i].displayCharacter.equals(" "))
1139 annotations[i].displayCharacter = String.valueOf(gapchar);
1146 * format description string for display
1149 * @return Get the annotation description string optionally prefixed by
1150 * associated sequence name (if any)
1152 public String getDescription(boolean seqname)
1154 if (seqname && this.sequenceRef != null)
1156 int i = description.toLowerCase().indexOf("<html>");
1159 // move the html tag to before the sequence reference.
1160 return "<html>" + sequenceRef.getName() + " : "
1161 + description.substring(i + 6);
1163 return sequenceRef.getName() + " : " + description;
1168 public boolean isValidStruc()
1170 return invalidrnastruc == -1;
1173 public long getInvalidStrucPos()
1175 return invalidrnastruc;
1179 * machine readable ID string indicating what generated this annotation
1181 protected String calcId = "";
1184 * properties associated with the calcId
1186 protected Map<String, String> properties = new HashMap<String, String>();
1189 * base colour for line graphs. If null, will be set automatically by
1190 * searching the alignment annotation
1192 public java.awt.Color _linecolour;
1194 public String getCalcId()
1199 public void setCalcId(String calcId)
1201 this.calcId = calcId;
1204 public boolean isRNA()
1210 * transfer annotation to the given sequence using the given mapping from the
1211 * current positions or an existing sequence mapping
1215 * map involving sq as To or From
1217 public void liftOver(SequenceI sq, Mapping sp2sq)
1219 if (sp2sq.getMappedWidth() != sp2sq.getWidth())
1221 // TODO: employ getWord/MappedWord to transfer annotation between cDNA and Protein reference frames
1222 throw new Error("liftOver currently not implemented for transfer of annotation between different types of seqeunce");
1224 boolean mapIsTo = (sp2sq != null) ? (sp2sq.getTo() == sq || sp2sq
1225 .getTo() == sq.getDatasetSequence()) : false;
1227 // TODO build a better annotation element map and get rid of annotations[]
1228 Map<Integer, Annotation> mapForsq = new HashMap<Integer, Annotation>();
1229 if (sequenceMapping != null)
1233 for (Entry<Integer, Annotation> ie : sequenceMapping.entrySet())
1235 Integer mpos = Integer.valueOf(mapIsTo ? sp2sq
1236 .getMappedPosition(ie.getKey()) : sp2sq.getPosition(ie
1238 if (mpos >= sq.getStart() && mpos <= sq.getEnd())
1240 mapForsq.put(mpos, ie.getValue());
1243 sequenceMapping = mapForsq;
1245 adjustForAlignment();
1255 * like liftOver but more general.
1257 * Takes an array of int pairs that will be used to update the internal
1258 * sequenceMapping and so shuffle the annotated positions
1261 * - new sequence reference for the annotation row - if null,
1262 * sequenceRef is left unchanged
1264 * array of ints containing corresponding positions
1266 * - column for current coordinate system (-1 for index+1)
1268 * - column for destination coordinate system (-1 for index+1)
1270 * - offset added to index when referencing either coordinate system
1271 * @note no checks are made as to whether from and/or to are sensible
1272 * @note caller should add the remapped annotation to newref if they have not
1275 public void remap(SequenceI newref, int[][] mapping, int from, int to,
1278 if (mapping != null)
1280 Map<Integer, Annotation> old = sequenceMapping;
1281 Map<Integer, Annotation> remap = new HashMap<Integer, Annotation>();
1283 for (int mp[] : mapping)
1289 Annotation ann = null;
1292 ann = sequenceMapping.get(Integer.valueOf(idxoffset + index));
1296 if (mp != null && mp.length > from)
1298 ann = sequenceMapping.get(Integer.valueOf(mp[from]));
1305 remap.put(Integer.valueOf(idxoffset + index), ann);
1309 if (to > -1 && to < mp.length)
1311 remap.put(Integer.valueOf(mp[to]), ann);
1316 sequenceMapping = remap;
1320 sequenceRef = newref;
1322 adjustForAlignment();
1326 public String getProperty(String property)
1328 if (properties == null)
1332 return properties.get(property);
1335 public void setProperty(String property, String value)
1337 if (properties==null)
1339 properties = new HashMap<String,String>();
1341 properties.put(property, value);
1344 public boolean hasProperties()
1346 return properties != null && properties.size() > 0;
1349 public Collection<String> getProperties()
1351 if (properties == null)
1353 return Collections.EMPTY_LIST;
1355 return properties.keySet();