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.util.ShiftList;
24 import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
25 import jalview.viewmodel.annotationfilter.AnnotationFilterParameter.SearchableAnnotationField;
27 import java.util.ArrayList;
28 import java.util.BitSet;
29 import java.util.Collections;
30 import java.util.List;
31 import java.util.Vector;
34 * NOTE: Columns are zero based.
36 public class ColumnSelection
41 * list of selected columns (ordered by selection order, not column order)
43 private List<Integer> order = new ArrayList<Integer>();
46 * bitfield for column selection - allows quick lookup
48 private BitSet selected = new BitSet();
51 * adds a new column i to the selection - only if i is not already selected
55 public void add(int i)
59 order.add(Integer.valueOf(i));
70 public void remove(int col)
73 Integer colInt = new Integer(col);
75 if (selected.get(col))
77 // if this ever changes to List.remove(), ensure Integer not int
79 // as List.remove(int i) removes the i'th item which is wrong
85 public boolean contains(Integer colInt)
87 return selected.get(colInt);
90 public boolean isEmpty()
92 return order.isEmpty();
95 public List<Integer> getList()
106 * gets the column that was selected first, second or i'th
111 public int elementAt(int i)
116 protected boolean pruneColumnList(final List<int[]> shifts)
118 int s = 0, t = shifts.size();
119 int[] sr = shifts.get(s++);
120 boolean pruned = false;
121 int i = 0, j = order.size();
122 while (i < j && s <= t)
124 int c = order.get(i++).intValue();
127 if (sr[1] + sr[0] >= c)
128 { // sr[1] -ve means inseriton.
147 * shift every selected column at or above start by change
150 * - leftmost column to be shifted
154 public void compensateForEdits(int start, int change)
156 BitSet mask = new BitSet();
157 for (int i = 0; i < order.size(); i++)
159 int temp = order.get(i);
163 // clear shifted bits and update List of selected columns
164 selected.clear(temp);
165 mask.set(temp - change);
166 order.set(i, new Integer(temp - change));
169 // lastly update the bitfield all at once
173 public boolean isSelected(int column)
175 return selected.get(column);
178 public int getMaxColumn()
180 return selected.length() - 1;
183 public int getMinColumn()
185 return selected.get(0) ? 0 : selected.nextSetBit(0);
189 IntList selected = new IntList();
191 * list of hidden column [start, end] ranges; the list is maintained in
192 * ascending start column order
194 Vector<int[]> hiddenColumns;
197 * Add a column to the selection
202 public void addElement(int col)
208 * clears column selection
216 * Removes value 'col' from the selection (not the col'th item)
219 * index of column to be removed
221 public void removeElement(int col)
223 selected.remove(col);
227 * removes a range of columns from the selection
230 * int - first column in range to be removed
234 public void removeElements(int start, int end)
237 for (int i = start; i < end; i++)
239 colInt = new Integer(i);
240 if (selected.contains(colInt))
242 selected.remove(colInt);
248 * Returns a list of selected columns. The list contains no duplicates but is
249 * not necessarily ordered. It also may include columns hidden from the
252 public List<Integer> getSelected()
254 return selected.getList();
260 * index to search for in column selection
262 * @return true if Integer(col) is in selection.
264 public boolean contains(int col)
266 return selected.isSelected(col);
270 * Answers true if no columns are selected, else false
272 public boolean isEmpty()
274 return selected == null || selected.isEmpty();
278 * rightmost selected column
280 * @return rightmost column in alignment that is selected
284 if (selected.isEmpty())
288 return selected.getMaxColumn();
292 * Leftmost column in selection
294 * @return column index of leftmost column in selection
298 if (selected.isEmpty())
302 return selected.getMinColumn();
306 * propagate shift in alignment columns to column selection
311 * shift in edit (+ve for removal, or -ve for inserts)
313 public List<int[]> compensateForEdit(int start, int change)
315 List<int[]> deletedHiddenColumns = null;
316 selected.compensateForEdits(start, change);
318 if (hiddenColumns != null)
320 deletedHiddenColumns = new ArrayList<int[]>();
321 int hSize = hiddenColumns.size();
322 for (int i = 0; i < hSize; i++)
324 int[] region = hiddenColumns.elementAt(i);
325 if (region[0] > start && start + change > region[1])
327 deletedHiddenColumns.add(region);
329 hiddenColumns.removeElementAt(i);
335 if (region[0] > start)
348 this.revealHiddenColumns(0);
351 return deletedHiddenColumns;
355 * propagate shift in alignment columns to column selection special version of
356 * compensateForEdit - allowing for edits within hidden regions
361 * shift in edit (+ve for removal, or -ve for inserts)
363 private void compensateForDelEdits(int start, int change)
366 selected.compensateForEdits(start, change);
368 if (hiddenColumns != null)
370 for (int i = 0; i < hiddenColumns.size(); i++)
372 int[] region = hiddenColumns.elementAt(i);
373 if (region[0] >= start)
377 if (region[1] >= start)
381 if (region[1] < region[0])
383 hiddenColumns.removeElementAt(i--);
399 * Adjust hidden column boundaries based on a series of column additions or
400 * deletions in visible regions.
405 public ShiftList compensateForEdits(ShiftList shiftrecord)
407 if (shiftrecord != null)
409 final List<int[]> shifts = shiftrecord.getShifts();
410 if (shifts != null && shifts.size() > 0)
413 for (int i = 0, j = shifts.size(); i < j; i++)
415 int[] sh = shifts.get(i);
416 // compensateForEdit(shifted+sh[0], sh[1]);
417 compensateForDelEdits(shifted + sh[0], sh[1]);
421 return shiftrecord.getInverse();
427 * removes intersection of position,length ranges in deletions from the
428 * start,end regions marked in intervals.
434 private boolean pruneIntervalVector(final List<int[]> shifts,
435 Vector<int[]> intervals)
437 boolean pruned = false;
438 int i = 0, j = intervals.size() - 1, s = 0, t = shifts.size() - 1;
439 int hr[] = intervals.elementAt(i);
440 int sr[] = shifts.get(s);
441 while (i <= j && s <= t)
443 boolean trailinghn = hr[1] >= sr[0];
448 hr = intervals.elementAt(++i);
456 int endshift = sr[0] + sr[1]; // deletion ranges - -ve means an insert
457 if (endshift < hr[0] || endshift < sr[0])
458 { // leadinghc disjoint or not a deletion
461 sr = shifts.get(++s);
469 boolean leadinghn = hr[0] >= sr[0];
470 boolean leadinghc = hr[0] < endshift;
471 boolean trailinghc = hr[1] < endshift;
475 { // deleted hidden region.
476 intervals.removeElementAt(i);
481 hr = intervals.elementAt(i);
487 hr[0] = endshift; // clip c terminal region
488 leadinghn = !leadinghn;
504 // sr contained in hr
507 sr = shifts.get(++s);
517 return pruned; // true if any interval was removed or modified by
522 * remove any hiddenColumns or selected columns and shift remaining based on a
523 * series of position, range deletions.
527 public void pruneDeletions(ShiftList deletions)
529 if (deletions != null)
531 final List<int[]> shifts = deletions.getShifts();
532 if (shifts != null && shifts.size() > 0)
534 // delete any intervals intersecting.
535 if (hiddenColumns != null)
537 pruneIntervalVector(shifts, hiddenColumns);
538 if (hiddenColumns != null && hiddenColumns.size() == 0)
540 hiddenColumns = null;
543 if (selected != null && selected.size() > 0)
545 selected.pruneColumnList(shifts);
546 if (selected != null && selected.size() == 0)
551 // and shift the rest.
552 this.compensateForEdits(deletions);
558 * This Method is used to return all the HiddenColumn regions
560 * @return empty list or List of hidden column intervals
562 public List<int[]> getHiddenColumns()
564 return hiddenColumns == null ? Collections.<int[]> emptyList()
569 * Return absolute column index for a visible column index
572 * int column index in alignment view
573 * @return alignment column index for column
575 public int adjustForHiddenColumns(int column)
578 if (hiddenColumns != null)
580 for (int i = 0; i < hiddenColumns.size(); i++)
582 int[] region = hiddenColumns.elementAt(i);
583 if (result >= region[0])
585 result += region[1] - region[0] + 1;
593 * Use this method to find out where a column will appear in the visible
594 * alignment when hidden columns exist. If the column is not visible, then the
595 * left-most visible column will always be returned.
597 * @param hiddenColumn
601 public int findColumnPosition(int hiddenColumn)
603 int result = hiddenColumn;
604 if (hiddenColumns != null)
610 region = hiddenColumns.elementAt(index++);
611 if (hiddenColumn > region[1])
613 result -= region[1] + 1 - region[0];
615 } while ((hiddenColumn > region[1]) && (index < hiddenColumns.size()));
616 if (hiddenColumn > region[0] && hiddenColumn < region[1])
618 return region[0] + hiddenColumn - result;
621 return result; // return the shifted position after removing hidden columns.
625 * Use this method to determine where the next hiddenRegion starts
627 public int findHiddenRegionPosition(int hiddenRegion)
630 if (hiddenColumns != null)
636 int[] region = hiddenColumns.elementAt(index);
637 if (hiddenRegion == 0)
642 gaps += region[1] + 1 - region[0];
643 result = region[1] + 1;
645 } while (index < hiddenRegion + 1);
654 * THis method returns the rightmost limit of a region of an alignment with
655 * hidden columns. In otherwords, the next hidden column.
660 public int getHiddenBoundaryRight(int alPos)
662 if (hiddenColumns != null)
667 int[] region = hiddenColumns.elementAt(index);
668 if (alPos < region[0])
674 } while (index < hiddenColumns.size());
682 * This method returns the leftmost limit of a region of an alignment with
683 * hidden columns. In otherwords, the previous hidden column.
688 public int getHiddenBoundaryLeft(int alPos)
690 if (hiddenColumns != null)
692 int index = hiddenColumns.size() - 1;
695 int[] region = hiddenColumns.elementAt(index);
696 if (alPos > region[1])
702 } while (index > -1);
709 public void hideSelectedColumns()
711 while (!selected.isEmpty())
713 int column = selected.elementAt(0);
720 * Adds the specified column range to the hidden columns
725 public void hideColumns(int start, int end)
727 if (hiddenColumns == null)
729 hiddenColumns = new Vector<int[]>();
733 * traverse existing hidden ranges and insert / amend / append as
736 for (int i = 0; i < hiddenColumns.size(); i++)
738 int[] region = hiddenColumns.elementAt(i);
740 if (end < region[0] - 1)
743 * insert discontiguous preceding range
745 hiddenColumns.insertElementAt(new int[] { start, end }, i);
749 if (end <= region[1])
752 * new range overlaps existing, or is contiguous preceding it - adjust
755 region[0] = Math.min(region[0], start);
759 if (start <= region[1] + 1)
762 * new range overlaps existing, or is contiguous following it - adjust
763 * start and end columns
765 region[0] = Math.min(region[0], start);
766 region[1] = Math.max(region[1], end);
772 * remaining case is that the new range follows everything else
774 hiddenColumns.addElement(new int[] { start, end });
778 * Hides the specified column and any adjacent selected columns
783 public void hideColumns(int col)
786 * deselect column (whether selected or not!)
791 * find adjacent selected columns
793 int min = col - 1, max = col + 1;
794 while (contains(min))
800 while (contains(max))
807 * min, max are now the closest unselected columns
816 hideColumns(min, max);
820 * Unhides, and adds to the selection list, all hidden columns
822 public void revealAllHiddenColumns()
824 if (hiddenColumns != null)
826 for (int i = 0; i < hiddenColumns.size(); i++)
828 int[] region = hiddenColumns.elementAt(i);
829 for (int j = region[0]; j < region[1] + 1; j++)
836 hiddenColumns = null;
840 * Reveals, and marks as selected, the hidden column range with the given
845 public void revealHiddenColumns(int start)
847 for (int i = 0; i < hiddenColumns.size(); i++)
849 int[] region = hiddenColumns.elementAt(i);
850 if (start == region[0])
852 for (int j = region[0]; j < region[1] + 1; j++)
857 hiddenColumns.removeElement(region);
861 if (hiddenColumns.size() == 0)
863 hiddenColumns = null;
867 public boolean isVisible(int column)
869 if (hiddenColumns != null)
871 for (int[] region : hiddenColumns)
873 if (column >= region[0] && column <= region[1])
888 public ColumnSelection(ColumnSelection copy)
892 if (copy.selected != null)
894 selected = new IntList();
895 for (int i = 0, j = copy.selected.size(); i < j; i++)
897 selected.add(copy.selected.elementAt(i));
900 if (copy.hiddenColumns != null)
902 hiddenColumns = new Vector<int[]>(copy.hiddenColumns.size());
903 for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++)
906 rh = copy.hiddenColumns.elementAt(i);
909 cp = new int[rh.length];
910 System.arraycopy(rh, 0, cp, 0, rh.length);
911 hiddenColumns.addElement(cp);
921 public ColumnSelection()
925 public String[] getVisibleSequenceStrings(int start, int end,
928 int i, iSize = seqs.length;
929 String selection[] = new String[iSize];
930 if (hiddenColumns != null && hiddenColumns.size() > 0)
932 for (i = 0; i < iSize; i++)
934 StringBuffer visibleSeq = new StringBuffer();
935 List<int[]> regions = getHiddenColumns();
937 int blockStart = start, blockEnd = end;
939 int hideStart, hideEnd;
941 for (int j = 0; j < regions.size(); j++)
943 region = regions.get(j);
944 hideStart = region[0];
947 if (hideStart < start)
952 blockStart = Math.min(blockStart, hideEnd + 1);
953 blockEnd = Math.min(blockEnd, hideStart);
955 if (blockStart > blockEnd)
960 visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
962 blockStart = hideEnd + 1;
966 if (end > blockStart)
968 visibleSeq.append(seqs[i].getSequence(blockStart, end));
971 selection[i] = visibleSeq.toString();
976 for (i = 0; i < iSize; i++)
978 selection[i] = seqs[i].getSequenceAsString(start, end);
986 * return all visible segments between the given start and end boundaries
989 * (first column inclusive from 0)
991 * (last column - not inclusive)
992 * @return int[] {i_start, i_end, ..} where intervals lie in
993 * start<=i_start<=i_end<end
995 public int[] getVisibleContigs(int start, int end)
997 if (hiddenColumns != null && hiddenColumns.size() > 0)
999 List<int[]> visiblecontigs = new ArrayList<int[]>();
1000 List<int[]> regions = getHiddenColumns();
1004 int hideStart, hideEnd;
1006 for (int j = 0; vstart < end && j < regions.size(); j++)
1008 region = regions.get(j);
1009 hideStart = region[0];
1010 hideEnd = region[1];
1012 if (hideEnd < vstart)
1016 if (hideStart > vstart)
1018 visiblecontigs.add(new int[] { vstart, hideStart - 1 });
1020 vstart = hideEnd + 1;
1025 visiblecontigs.add(new int[] { vstart, end - 1 });
1027 int[] vcontigs = new int[visiblecontigs.size() * 2];
1028 for (int i = 0, j = visiblecontigs.size(); i < j; i++)
1030 int[] vc = visiblecontigs.get(i);
1031 visiblecontigs.set(i, null);
1032 vcontigs[i * 2] = vc[0];
1033 vcontigs[i * 2 + 1] = vc[1];
1035 visiblecontigs.clear();
1040 return new int[] { start, end - 1 };
1045 * delete any columns in alignmentAnnotation that are hidden (including
1046 * sequence associated annotation).
1048 * @param alignmentAnnotation
1050 public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation)
1052 makeVisibleAnnotation(-1, -1, alignmentAnnotation);
1056 * delete any columns in alignmentAnnotation that are hidden (including
1057 * sequence associated annotation).
1060 * remove any annotation to the right of this column
1062 * remove any annotation to the left of this column
1063 * @param alignmentAnnotation
1064 * the annotation to operate on
1066 public void makeVisibleAnnotation(int start, int end,
1067 AlignmentAnnotation alignmentAnnotation)
1069 if (alignmentAnnotation.annotations == null)
1073 if (start == end && end == -1)
1076 end = alignmentAnnotation.annotations.length;
1078 if (hiddenColumns != null && hiddenColumns.size() > 0)
1080 // then mangle the alignmentAnnotation annotation array
1081 Vector<Annotation[]> annels = new Vector<Annotation[]>();
1082 Annotation[] els = null;
1083 List<int[]> regions = getHiddenColumns();
1084 int blockStart = start, blockEnd = end;
1086 int hideStart, hideEnd, w = 0;
1088 for (int j = 0; j < regions.size(); j++)
1090 region = regions.get(j);
1091 hideStart = region[0];
1092 hideEnd = region[1];
1094 if (hideStart < start)
1099 blockStart = Math.min(blockStart, hideEnd + 1);
1100 blockEnd = Math.min(blockEnd, hideStart);
1102 if (blockStart > blockEnd)
1107 annels.addElement(els = new Annotation[blockEnd - blockStart]);
1108 System.arraycopy(alignmentAnnotation.annotations, blockStart, els,
1111 blockStart = hideEnd + 1;
1115 if (end > blockStart)
1117 annels.addElement(els = new Annotation[end - blockStart + 1]);
1118 if ((els.length + blockStart) <= alignmentAnnotation.annotations.length)
1120 // copy just the visible segment of the annotation row
1121 System.arraycopy(alignmentAnnotation.annotations, blockStart,
1122 els, 0, els.length);
1126 // copy to the end of the annotation row
1127 System.arraycopy(alignmentAnnotation.annotations, blockStart,
1129 (alignmentAnnotation.annotations.length - blockStart));
1138 alignmentAnnotation.annotations = new Annotation[w];
1141 for (Annotation[] chnk : annels)
1143 System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w,
1150 alignmentAnnotation.restrict(start, end);
1155 * Invert the column selection from first to end-1. leaves hiddenColumns
1156 * untouched (and unselected)
1161 public void invertColumnSelection(int first, int width)
1163 boolean hasHidden = hiddenColumns != null && hiddenColumns.size() > 0;
1164 for (int i = first; i < width; i++)
1172 if (!hasHidden || isVisible(i))
1181 * add in any unselected columns from the given column selection, excluding
1182 * any that are hidden.
1186 public void addElementsFrom(ColumnSelection colsel)
1188 if (colsel != null && !colsel.isEmpty())
1190 for (Integer col : colsel.getSelected())
1192 if (hiddenColumns != null && isVisible(col.intValue()))
1201 * set the selected columns the given column selection, excluding any columns
1206 public void setElementsFrom(ColumnSelection colsel)
1208 selected = new IntList();
1209 if (colsel.selected != null && colsel.selected.size() > 0)
1211 if (hiddenColumns != null && hiddenColumns.size() > 0)
1213 // only select visible columns in this columns selection
1214 addElementsFrom(colsel);
1218 // add everything regardless
1219 for (Integer col : colsel.getSelected())
1228 * Add gaps into the sequences aligned to profileseq under the given
1233 * - alignment to have gaps inserted into it
1235 * - alignment view where sequence corresponding to profileseq is
1237 * @return new Column selection for new alignment view, with insertions into
1238 * profileseq marked as hidden.
1240 public static ColumnSelection propagateInsertions(SequenceI profileseq,
1241 AlignmentI al, AlignmentView input)
1245 // return propagateInsertions(profileseq, al, )
1246 char gc = al.getGapCharacter();
1247 Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc);
1248 ColumnSelection nview = (ColumnSelection) alandcolsel[1];
1249 SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos];
1250 nview.propagateInsertions(profileseq, al, origseq);
1257 * - sequence in al which corresponds to origseq
1259 * - alignment which is to have gaps inserted into it
1261 * - sequence corresponding to profileseq which defines gap map for
1264 public void propagateInsertions(SequenceI profileseq, AlignmentI al,
1267 char gc = al.getGapCharacter();
1268 // recover mapping between sequence's non-gap positions and positions
1270 pruneDeletions(ShiftList.parseMap(origseq.gapMap()));
1271 int[] viscontigs = getVisibleContigs(0, profileseq.getLength());
1274 // input.pruneDeletions(ShiftList.parseMap(((SequenceI[])
1275 // alandcolsel[0])[0].gapMap()))
1276 // add profile to visible contigs
1277 for (int v = 0; v < viscontigs.length; v += 2)
1279 if (viscontigs[v] > spos)
1281 StringBuffer sb = new StringBuffer();
1282 for (int s = 0, ns = viscontigs[v] - spos; s < ns; s++)
1286 for (int s = 0, ns = al.getHeight(); s < ns; s++)
1288 SequenceI sqobj = al.getSequenceAt(s);
1289 if (sqobj != profileseq)
1291 String sq = al.getSequenceAt(s).getSequenceAsString();
1292 if (sq.length() <= spos + offset)
1295 int diff = spos + offset - sq.length() - 1;
1300 while ((diff = spos + offset - sq.length() - 1) > 0)
1303 // + ((diff >= sb.length()) ? sb.toString() : sb
1304 // .substring(0, diff));
1305 if (diff >= sb.length())
1307 sq += sb.toString();
1311 char[] buf = new char[diff];
1312 sb.getChars(0, diff, buf, 0);
1313 sq += buf.toString();
1317 sq += sb.toString();
1321 al.getSequenceAt(s).setSequence(
1322 sq.substring(0, spos + offset) + sb.toString()
1323 + sq.substring(spos + offset));
1327 // offset+=sb.length();
1329 spos = viscontigs[v + 1] + 1;
1331 if ((offset + spos) < profileseq.getLength())
1333 // pad the final region with gaps.
1334 StringBuffer sb = new StringBuffer();
1335 for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++)
1339 for (int s = 0, ns = al.getHeight(); s < ns; s++)
1341 SequenceI sqobj = al.getSequenceAt(s);
1342 if (sqobj == profileseq)
1346 String sq = sqobj.getSequenceAsString();
1348 int diff = origseq.getLength() - sq.length();
1352 // + ((diff >= sb.length()) ? sb.toString() : sb
1353 // .substring(0, diff));
1354 if (diff >= sb.length())
1356 sq += sb.toString();
1360 char[] buf = new char[diff];
1361 sb.getChars(0, diff, buf, 0);
1362 sq += buf.toString();
1364 diff = origseq.getLength() - sq.length();
1372 * @return true if there are columns marked
1374 public boolean hasSelectedColumns()
1376 return (selected != null && selected.size() > 0);
1381 * @return true if there are columns hidden
1383 public boolean hasHiddenColumns()
1385 return hiddenColumns != null && hiddenColumns.size() > 0;
1390 * @return true if there are more than one set of columns hidden
1392 public boolean hasManyHiddenColumns()
1394 return hiddenColumns != null && hiddenColumns.size() > 1;
1398 * mark the columns corresponding to gap characters as hidden in the column
1403 public void hideInsertionsFor(SequenceI sr)
1405 List<int[]> inserts = sr.getInsertions();
1406 for (int[] r : inserts)
1408 hideColumns(r[0], r[1]);
1412 public boolean filterAnnotations(Annotation[] annotations,
1413 AnnotationFilterParameter filterParams)
1415 this.revealAllHiddenColumns();
1420 if (annotations[count] != null)
1423 boolean itemMatched = false;
1425 if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD
1426 && annotations[count].value >= filterParams
1427 .getThresholdValue())
1431 if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD
1432 && annotations[count].value <= filterParams
1433 .getThresholdValue())
1438 if (filterParams.isFilterAlphaHelix()
1439 && annotations[count].secondaryStructure == 'H')
1444 if (filterParams.isFilterBetaSheet()
1445 && annotations[count].secondaryStructure == 'E')
1450 if (filterParams.isFilterTurn()
1451 && annotations[count].secondaryStructure == 'S')
1456 String regexSearchString = filterParams.getRegexString();
1457 if (regexSearchString != null
1458 && !filterParams.getRegexSearchFields().isEmpty())
1460 List<SearchableAnnotationField> fields = filterParams
1461 .getRegexSearchFields();
1464 if (fields.contains(SearchableAnnotationField.DISPLAY_STRING)
1465 && annotations[count].displayCharacter
1466 .matches(regexSearchString))
1470 } catch (java.util.regex.PatternSyntaxException pse)
1472 if (annotations[count].displayCharacter
1473 .equals(regexSearchString))
1478 if (fields.contains(SearchableAnnotationField.DESCRIPTION)
1479 && annotations[count].description != null
1480 && annotations[count].description
1481 .matches(regexSearchString))
1489 this.addElement(count);
1493 } while (count < annotations.length);
1497 public boolean isSelected(int column)
1499 return selected.isSelected(column);