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()
123 // Figure out number of helices
124 // Length of rnasecstr is the number of pairs of positions that base pair
125 // with each other in the secondary structure
126 for (int x = 0; x < _rnasecstr.length; x++)
130 * System.out.println(this.annotation._rnasecstr[x] + " Begin" +
131 * this.annotation._rnasecstr[x].getBegin());
133 // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
137 val = Integer.valueOf(_rnasecstr[x].getFeatureGroup());
142 } catch (NumberFormatException q)
147 annotations[_rnasecstr[x].getBegin()].value = val;
148 annotations[_rnasecstr[x].getEnd()].value = val;
150 // annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val;
151 // annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val;
156 * map of positions in the associated annotation
158 public java.util.Hashtable<Integer, Annotation> sequenceMapping;
161 public float graphMin;
164 public float graphMax;
167 * Score associated with label and description.
169 public double score = Double.NaN;
172 * flag indicating if annotation has a score.
174 public boolean hasScore = false;
176 public GraphLine threshold;
178 // Graphical hints and tips
180 /** Can this row be edited by the user ? */
181 public boolean editable = false;
183 /** Indicates if annotation has a graphical symbol track */
184 public boolean hasIcons; //
186 /** Indicates if annotation has a text character label */
187 public boolean hasText;
189 /** is the row visible */
190 public boolean visible = true;
192 public int graphGroup = -1;
194 /** Displayed height of row in pixels */
195 public int height = 0;
197 public int graph = 0;
199 public int graphHeight = 40;
201 public boolean padGaps = false;
203 public static final int NO_GRAPH = 0;
205 public static final int BAR_GRAPH = 1;
207 public static final int LINE_GRAPH = 2;
209 public boolean belowAlignment = true;
211 public SequenceGroup groupRef = null;
214 * display every column label, even if there is a row of identical labels
216 public boolean showAllColLabels = false;
219 * scale the column label to fit within the alignment column.
221 public boolean scaleColLabel = false;
224 * centre the column labels relative to the alignment column
226 public boolean centreColLabels = false;
228 private boolean isrna;
233 * @see java.lang.Object#finalize()
235 protected void finalize() throws Throwable
242 public static int getGraphValueFromString(String string)
244 if (string.equalsIgnoreCase("BAR_GRAPH"))
248 else if (string.equalsIgnoreCase("LINE_GRAPH"))
258 // JBPNote: what does this do ?
259 public void ConcenStru(CharSequence RNAannot) throws WUSSParseException
261 bps = Rna.GetModeleBP(RNAannot);
265 * Creates a new AlignmentAnnotation object.
268 * short label shown under sequence labels
270 * text displayed on mouseover
272 * set of positional annotation elements
274 public AlignmentAnnotation(String label, String description,
275 Annotation[] annotations)
280 this.description = description;
281 this.annotations = annotations;
283 validateRangeAndDisplay();
287 * Checks if annotation labels represent secondary structures
290 void areLabelsSecondaryStructure()
292 boolean nonSSLabel = false;
294 StringBuffer rnastring = new StringBuffer();
297 for (int i = 0; i < annotations.length; i++)
299 if (annotations[i] == null)
303 if (annotations[i].secondaryStructure == 'H'
304 || annotations[i].secondaryStructure == 'E')
309 // Check for RNA secondary structure
311 // System.out.println(annotations[i].secondaryStructure);
312 // TODO: 2.8.2 should this ss symbol validation check be a function in
313 // RNA/ResidueProperties ?
314 if (annotations[i].secondaryStructure == '('
315 || annotations[i].secondaryStructure == '['
316 || annotations[i].secondaryStructure == '<'
317 || annotations[i].secondaryStructure == '{'
318 || annotations[i].secondaryStructure == 'A'
319 || annotations[i].secondaryStructure == 'B'
320 || annotations[i].secondaryStructure == 'C'
321 || annotations[i].secondaryStructure == 'D'
322 || annotations[i].secondaryStructure == 'E'
323 || annotations[i].secondaryStructure == 'F'
324 || annotations[i].secondaryStructure == 'G'
325 || annotations[i].secondaryStructure == 'H'
326 || annotations[i].secondaryStructure == 'I'
327 || annotations[i].secondaryStructure == 'J'
328 || annotations[i].secondaryStructure == 'K'
329 || annotations[i].secondaryStructure == 'L'
330 || annotations[i].secondaryStructure == 'M'
331 || annotations[i].secondaryStructure == 'N'
332 || annotations[i].secondaryStructure == 'O'
333 || annotations[i].secondaryStructure == 'P'
334 || annotations[i].secondaryStructure == 'Q'
335 || annotations[i].secondaryStructure == 'R'
336 || annotations[i].secondaryStructure == 'S'
337 || annotations[i].secondaryStructure == 'T'
338 || annotations[i].secondaryStructure == 'U'
339 || annotations[i].secondaryStructure == 'V'
340 || annotations[i].secondaryStructure == 'W'
341 || annotations[i].secondaryStructure == 'X'
342 || annotations[i].secondaryStructure == 'Y'
343 || annotations[i].secondaryStructure == 'Z')
350 // System.out.println("displaychar " + annotations[i].displayCharacter);
352 if (annotations[i].displayCharacter == null
353 || annotations[i].displayCharacter.length() == 0)
355 rnastring.append('.');
358 if (annotations[i].displayCharacter.length() == 1)
360 firstChar = annotations[i].displayCharacter.charAt(0);
361 // check to see if it looks like a sequence or is secondary structure
363 if (annotations[i].secondaryStructure != ' '
366 // Uncomment to only catch case where
367 // displayCharacter==secondary
369 // to correctly redisplay SS annotation imported from Stockholm,
370 // exported to JalviewXML and read back in again.
372 // annotations[i].displayCharacter.charAt(0)==annotations[i].secondaryStructure
407 && firstChar < jalview.schemes.ResidueProperties.aaIndex.length)
409 if (jalview.schemes.ResidueProperties.aaIndex[firstChar] < 23) // TODO:
422 rnastring.append(annotations[i].displayCharacter.charAt(1));
425 if (annotations[i].displayCharacter.length() > 0)
434 for (int j = 0; j < annotations.length; j++)
436 if (annotations[j] != null
437 && annotations[j].secondaryStructure != ' ')
439 annotations[j].displayCharacter = String
440 .valueOf(annotations[j].secondaryStructure);
441 annotations[j].secondaryStructure = ' ';
450 _updateRnaSecStr(new AnnotCharSequence());
454 annotationId = this.hashCode() + "";
458 * flyweight access to positions in the alignment annotation row for RNA
464 private class AnnotCharSequence implements CharSequence
470 public AnnotCharSequence()
472 this(0, annotations.length);
475 public AnnotCharSequence(int start, int end)
482 public CharSequence subSequence(int start, int end)
484 return new AnnotCharSequence(offset + start, offset + end);
494 public char charAt(int index)
496 return ((index + offset < 0) || (index + offset) >= max
497 || annotations[index + offset] == null || (annotations[index
498 + offset].secondaryStructure < ' ') ? ' '
499 : 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 Hashtable();
714 Enumeration pos = annotation.sequenceMapping.keys();
715 while (pos.hasMoreElements())
717 // could optimise this!
718 p = (Integer) pos.nextElement();
719 Annotation a = annotation.sequenceMapping.get(p);
726 for (int i = 0; i < ann.length; i++)
730 sequenceMapping.put(p, annotations[i]);
738 this.sequenceMapping = null;
741 // TODO: check if we need to do this: JAL-952
742 // if (this.isrna=annotation.isrna)
744 // _rnasecstr=new SequenceFeature[annotation._rnasecstr];
746 validateRangeAndDisplay(); // construct hashcodes, etc.
750 * clip the annotation to the columns given by startRes and endRes (inclusive)
751 * and prune any existing sequenceMapping to just those columns.
756 public void restrict(int startRes, int endRes)
758 if (annotations == null)
767 if (startRes >= annotations.length)
769 startRes = annotations.length - 1;
771 if (endRes >= annotations.length)
773 endRes = annotations.length - 1;
775 if (annotations == null)
779 Annotation[] temp = new Annotation[endRes - startRes + 1];
780 if (startRes < annotations.length)
782 System.arraycopy(annotations, startRes, temp, 0, endRes - startRes
785 if (sequenceRef != null)
787 // Clip the mapping, if it exists.
788 int spos = sequenceRef.findPosition(startRes);
789 int epos = sequenceRef.findPosition(endRes);
790 if (sequenceMapping != null)
792 Hashtable newmapping = new Hashtable();
793 Enumeration e = sequenceMapping.keys();
794 while (e.hasMoreElements())
796 Integer pos = (Integer) e.nextElement();
797 if (pos.intValue() >= spos && pos.intValue() <= epos)
799 newmapping.put(pos, sequenceMapping.get(pos));
802 sequenceMapping.clear();
803 sequenceMapping = newmapping;
810 * set the annotation row to be at least length Annotations
813 * minimum number of columns required in the annotation row
814 * @return false if the annotation row is greater than length
816 public boolean padAnnotation(int length)
818 if (annotations == null)
820 return true; // annotation row is correct - null == not visible and
823 if (annotations.length < length)
825 Annotation[] na = new Annotation[length];
826 System.arraycopy(annotations, 0, na, 0, annotations.length);
830 return annotations.length > length;
837 * @return DOCUMENT ME!
839 public String toString()
841 StringBuffer buffer = new StringBuffer();
843 for (int i = 0; i < annotations.length; i++)
845 if (annotations[i] != null)
849 buffer.append(annotations[i].value);
853 buffer.append(annotations[i].secondaryStructure);
857 buffer.append(annotations[i].displayCharacter);
863 // TODO: remove disgusting hack for 'special' treatment of consensus line.
864 if (label.indexOf("Consensus") == 0)
868 for (int i = 0; i < annotations.length; i++)
870 if (annotations[i] != null)
872 buffer.append(annotations[i].description);
879 return buffer.toString();
882 public void setThreshold(GraphLine line)
887 public GraphLine getThreshold()
893 * Attach the annotation to seqRef, starting from startRes position. If
894 * alreadyMapped is true then the indices of the annotation[] array are
895 * sequence positions rather than alignment column positions.
899 * @param alreadyMapped
901 public void createSequenceMapping(SequenceI seqRef, int startRes,
902 boolean alreadyMapped)
909 sequenceRef = seqRef;
910 if (annotations == null)
914 sequenceMapping = new java.util.Hashtable();
918 for (int i = 0; i < annotations.length; i++)
920 if (annotations[i] != null)
924 seqPos = seqRef.findPosition(i);
928 seqPos = i + startRes;
931 sequenceMapping.put(new Integer(seqPos), annotations[i]);
937 public void adjustForAlignment()
939 if (sequenceRef == null)
944 if (annotations == null)
949 int a = 0, aSize = sequenceRef.getLength();
958 Annotation[] temp = new Annotation[aSize];
961 for (a = sequenceRef.getStart(); a <= sequenceRef.getEnd(); a++)
963 index = new Integer(a);
964 if (sequenceMapping.containsKey(index))
966 position = sequenceRef.findIndex(a) - 1;
968 temp[position] = sequenceMapping.get(index);
976 * remove any null entries in annotation row and return the number of non-null
977 * annotation elements.
981 public int compactAnnotationArray()
983 int i = 0, iSize = annotations.length;
986 if (annotations[i] == null)
990 System.arraycopy(annotations, i + 1, annotations, i, iSize - i
1000 Annotation[] ann = annotations;
1001 annotations = new Annotation[i];
1002 System.arraycopy(ann, 0, annotations, 0, i);
1008 * Associate this annotion with the aligned residues of a particular sequence.
1009 * sequenceMapping will be updated in the following way: null sequenceI -
1010 * existing mapping will be discarded but annotations left in mapped
1011 * positions. valid sequenceI not equal to current sequenceRef: mapping is
1012 * discarded and rebuilt assuming 1:1 correspondence TODO: overload with
1013 * parameter to specify correspondence between current and new sequenceRef
1017 public void setSequenceRef(SequenceI sequenceI)
1019 if (sequenceI != null)
1021 if (sequenceRef != null)
1023 boolean rIsDs=sequenceRef.getDatasetSequence()==null,tIsDs=sequenceI.getDatasetSequence()==null;
1024 if (sequenceRef != sequenceI
1025 && (rIsDs && !tIsDs && sequenceRef != sequenceI
1026 .getDatasetSequence())
1027 && (!rIsDs && tIsDs && sequenceRef.getDatasetSequence() != sequenceI)
1028 && (!rIsDs && !tIsDs && sequenceRef.getDatasetSequence() != sequenceI
1029 .getDatasetSequence())
1030 && !sequenceRef.equals(sequenceI))
1032 // if sequenceRef isn't intersecting with sequenceI
1033 // throw away old mapping and reconstruct.
1035 if (sequenceMapping != null)
1037 sequenceMapping = null;
1038 // compactAnnotationArray();
1040 createSequenceMapping(sequenceI, 1, true);
1041 adjustForAlignment();
1045 // Mapping carried over
1046 sequenceRef = sequenceI;
1051 // No mapping exists
1052 createSequenceMapping(sequenceI, 1, true);
1053 adjustForAlignment();
1058 // throw away the mapping without compacting.
1059 sequenceMapping = null;
1067 public double getScore()
1076 public void setScore(double score)
1084 * @return true if annotation has an associated score
1086 public boolean hasScore()
1088 return hasScore || !Double.isNaN(score);
1092 * Score only annotation
1095 * @param description
1098 public AlignmentAnnotation(String label, String description, double score)
1100 this(label, description, null);
1105 * copy constructor with edit based on the hidden columns marked in colSel
1107 * @param alignmentAnnotation
1110 public AlignmentAnnotation(AlignmentAnnotation alignmentAnnotation,
1111 ColumnSelection colSel)
1113 this(alignmentAnnotation);
1114 if (annotations == null)
1118 colSel.makeVisibleAnnotation(this);
1121 public void setPadGaps(boolean padgaps, char gapchar)
1123 this.padGaps = padgaps;
1127 for (int i = 0; i < annotations.length; i++)
1129 if (annotations[i] == null)
1131 annotations[i] = new Annotation(String.valueOf(gapchar), null,
1134 else if (annotations[i].displayCharacter == null
1135 || annotations[i].displayCharacter.equals(" "))
1137 annotations[i].displayCharacter = String.valueOf(gapchar);
1144 * format description string for display
1147 * @return Get the annotation description string optionally prefixed by
1148 * associated sequence name (if any)
1150 public String getDescription(boolean seqname)
1152 if (seqname && this.sequenceRef != null)
1154 int i = description.toLowerCase().indexOf("<html>");
1157 // move the html tag to before the sequence reference.
1158 return "<html>" + sequenceRef.getName() + " : "
1159 + description.substring(i + 6);
1161 return sequenceRef.getName() + " : " + description;
1166 public boolean isValidStruc()
1168 return invalidrnastruc == -1;
1171 public long getInvalidStrucPos()
1173 return invalidrnastruc;
1177 * machine readable ID string indicating what generated this annotation
1179 protected String calcId = "";
1182 * properties associated with the calcId
1184 protected Map<String, String> properties = new HashMap<String, String>();
1187 * base colour for line graphs. If null, will be set automatically by
1188 * searching the alignment annotation
1190 public java.awt.Color _linecolour;
1192 public String getCalcId()
1197 public void setCalcId(String calcId)
1199 this.calcId = calcId;
1202 public boolean isRNA()
1208 * transfer annotation to the given sequence using the given mapping from the
1209 * current positions or an existing sequence mapping
1213 * map involving sq as To or From
1215 public void liftOver(SequenceI sq, Mapping sp2sq)
1217 if (sp2sq.getMappedWidth() != sp2sq.getWidth())
1219 // TODO: employ getWord/MappedWord to transfer annotation between cDNA and Protein reference frames
1220 throw new Error("liftOver currently not implemented for transfer of annotation between different types of seqeunce");
1222 boolean mapIsTo = (sp2sq != null) ? (sp2sq.getTo() == sq || sp2sq
1223 .getTo() == sq.getDatasetSequence()) : false;
1225 // TODO build a better annotation element map and get rid of annotations[]
1226 Hashtable<Integer, Annotation> mapForsq = new Hashtable();
1227 if (sequenceMapping != null)
1231 for (Entry<Integer, Annotation> ie : sequenceMapping.entrySet())
1233 Integer mpos = Integer.valueOf(mapIsTo ? sp2sq
1234 .getMappedPosition(ie.getKey()) : sp2sq.getPosition(ie
1236 if (mpos >= sq.getStart() && mpos <= sq.getEnd())
1238 mapForsq.put(mpos, ie.getValue());
1241 sequenceMapping = mapForsq;
1243 adjustForAlignment();
1253 * like liftOver but more general.
1255 * Takes an array of int pairs that will be used to update the internal
1256 * sequenceMapping and so shuffle the annotated positions
1259 * - new sequence reference for the annotation row - if null,
1260 * sequenceRef is left unchanged
1262 * array of ints containing corresponding positions
1264 * - column for current coordinate system (-1 for index+1)
1266 * - column for destination coordinate system (-1 for index+1)
1268 * - offset added to index when referencing either coordinate system
1269 * @note no checks are made as to whether from and/or to are sensible
1270 * @note caller should add the remapped annotation to newref if they have not
1273 public void remap(SequenceI newref, int[][] mapping, int from, int to,
1276 if (mapping != null)
1278 Hashtable<Integer, Annotation> old = sequenceMapping, remap = new Hashtable<Integer, Annotation>();
1280 for (int mp[] : mapping)
1286 Annotation ann = null;
1289 ann = sequenceMapping.get(Integer.valueOf(idxoffset + index));
1293 if (mp != null && mp.length > from)
1295 ann = sequenceMapping.get(Integer.valueOf(mp[from]));
1302 remap.put(Integer.valueOf(idxoffset + index), ann);
1306 if (to > -1 && to < mp.length)
1308 remap.put(Integer.valueOf(mp[to]), ann);
1313 sequenceMapping = remap;
1317 sequenceRef = newref;
1319 adjustForAlignment();
1323 public String getProperty(String property)
1325 if (properties == null)
1329 return properties.get(property);
1332 public void setProperty(String property, String value)
1334 if (properties==null)
1336 properties = new HashMap<String,String>();
1338 properties.put(property, value);
1341 public boolean hasProperties()
1343 return properties != null && properties.size() > 0;
1346 public Collection<String> getProperties()
1348 if (properties == null)
1350 return Collections.EMPTY_LIST;
1352 return properties.keySet();