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 col is selected
264 public boolean contains(int col)
266 return (col > -1) ? selected.isSelected(col) : false;
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 * @param hiddenRegion
628 * index of hidden region (counts from 0)
629 * @return column number in visible view
631 public int findHiddenRegionPosition(int hiddenRegion)
634 if (hiddenColumns != null)
640 int[] region = hiddenColumns.elementAt(index);
641 if (hiddenRegion == 0)
646 gaps += region[1] + 1 - region[0];
647 result = region[1] + 1;
649 } while (index <= hiddenRegion);
658 * THis method returns the rightmost limit of a region of an alignment with
659 * hidden columns. In otherwords, the next hidden column.
664 public int getHiddenBoundaryRight(int alPos)
666 if (hiddenColumns != null)
671 int[] region = hiddenColumns.elementAt(index);
672 if (alPos < region[0])
678 } while (index < hiddenColumns.size());
686 * This method returns the leftmost limit of a region of an alignment with
687 * hidden columns. In otherwords, the previous hidden column.
692 public int getHiddenBoundaryLeft(int alPos)
694 if (hiddenColumns != null)
696 int index = hiddenColumns.size() - 1;
699 int[] region = hiddenColumns.elementAt(index);
700 if (alPos > region[1])
706 } while (index > -1);
713 public void hideSelectedColumns()
715 while (!selected.isEmpty())
717 int column = selected.elementAt(0);
724 * Adds the specified column range to the hidden columns
729 public void hideColumns(int start, int end)
731 if (hiddenColumns == null)
733 hiddenColumns = new Vector<int[]>();
737 * traverse existing hidden ranges and insert / amend / append as
740 for (int i = 0; i < hiddenColumns.size(); i++)
742 int[] region = hiddenColumns.elementAt(i);
744 if (end < region[0] - 1)
747 * insert discontiguous preceding range
749 hiddenColumns.insertElementAt(new int[] { start, end }, i);
753 if (end <= region[1])
756 * new range overlaps existing, or is contiguous preceding it - adjust
759 region[0] = Math.min(region[0], start);
763 if (start <= region[1] + 1)
766 * new range overlaps existing, or is contiguous following it - adjust
767 * start and end columns
769 region[0] = Math.min(region[0], start);
770 region[1] = Math.max(region[1], end);
776 * remaining case is that the new range follows everything else
778 hiddenColumns.addElement(new int[] { start, end });
782 * Hides the specified column and any adjacent selected columns
787 public void hideColumns(int col)
790 * deselect column (whether selected or not!)
795 * find adjacent selected columns
797 int min = col - 1, max = col + 1;
798 while (contains(min))
804 while (contains(max))
811 * min, max are now the closest unselected columns
820 hideColumns(min, max);
824 * Unhides, and adds to the selection list, all hidden columns
826 public void revealAllHiddenColumns()
828 if (hiddenColumns != null)
830 for (int i = 0; i < hiddenColumns.size(); i++)
832 int[] region = hiddenColumns.elementAt(i);
833 for (int j = region[0]; j < region[1] + 1; j++)
840 hiddenColumns = null;
844 * Reveals, and marks as selected, the hidden column range with the given
849 public void revealHiddenColumns(int start)
851 for (int i = 0; i < hiddenColumns.size(); i++)
853 int[] region = hiddenColumns.elementAt(i);
854 if (start == region[0])
856 for (int j = region[0]; j < region[1] + 1; j++)
861 hiddenColumns.removeElement(region);
865 if (hiddenColumns.size() == 0)
867 hiddenColumns = null;
871 public boolean isVisible(int column)
873 if (hiddenColumns != null)
875 for (int[] region : hiddenColumns)
877 if (column >= region[0] && column <= region[1])
892 public ColumnSelection(ColumnSelection copy)
896 if (copy.selected != null)
898 selected = new IntList();
899 for (int i = 0, j = copy.selected.size(); i < j; i++)
901 selected.add(copy.selected.elementAt(i));
904 if (copy.hiddenColumns != null)
906 hiddenColumns = new Vector<int[]>(copy.hiddenColumns.size());
907 for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++)
910 rh = copy.hiddenColumns.elementAt(i);
913 cp = new int[rh.length];
914 System.arraycopy(rh, 0, cp, 0, rh.length);
915 hiddenColumns.addElement(cp);
925 public ColumnSelection()
929 public String[] getVisibleSequenceStrings(int start, int end,
932 int i, iSize = seqs.length;
933 String selection[] = new String[iSize];
934 if (hiddenColumns != null && hiddenColumns.size() > 0)
936 for (i = 0; i < iSize; i++)
938 StringBuffer visibleSeq = new StringBuffer();
939 List<int[]> regions = getHiddenColumns();
941 int blockStart = start, blockEnd = end;
943 int hideStart, hideEnd;
945 for (int j = 0; j < regions.size(); j++)
947 region = regions.get(j);
948 hideStart = region[0];
951 if (hideStart < start)
956 blockStart = Math.min(blockStart, hideEnd + 1);
957 blockEnd = Math.min(blockEnd, hideStart);
959 if (blockStart > blockEnd)
964 visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
966 blockStart = hideEnd + 1;
970 if (end > blockStart)
972 visibleSeq.append(seqs[i].getSequence(blockStart, end));
975 selection[i] = visibleSeq.toString();
980 for (i = 0; i < iSize; i++)
982 selection[i] = seqs[i].getSequenceAsString(start, end);
990 * return all visible segments between the given start and end boundaries
993 * (first column inclusive from 0)
995 * (last column - not inclusive)
996 * @return int[] {i_start, i_end, ..} where intervals lie in
997 * start<=i_start<=i_end<end
999 public int[] getVisibleContigs(int start, int end)
1001 if (hiddenColumns != null && hiddenColumns.size() > 0)
1003 List<int[]> visiblecontigs = new ArrayList<int[]>();
1004 List<int[]> regions = getHiddenColumns();
1008 int hideStart, hideEnd;
1010 for (int j = 0; vstart < end && j < regions.size(); j++)
1012 region = regions.get(j);
1013 hideStart = region[0];
1014 hideEnd = region[1];
1016 if (hideEnd < vstart)
1020 if (hideStart > vstart)
1022 visiblecontigs.add(new int[] { vstart, hideStart - 1 });
1024 vstart = hideEnd + 1;
1029 visiblecontigs.add(new int[] { vstart, end - 1 });
1031 int[] vcontigs = new int[visiblecontigs.size() * 2];
1032 for (int i = 0, j = visiblecontigs.size(); i < j; i++)
1034 int[] vc = visiblecontigs.get(i);
1035 visiblecontigs.set(i, null);
1036 vcontigs[i * 2] = vc[0];
1037 vcontigs[i * 2 + 1] = vc[1];
1039 visiblecontigs.clear();
1044 return new int[] { start, end - 1 };
1049 * delete any columns in alignmentAnnotation that are hidden (including
1050 * sequence associated annotation).
1052 * @param alignmentAnnotation
1054 public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation)
1056 makeVisibleAnnotation(-1, -1, alignmentAnnotation);
1060 * delete any columns in alignmentAnnotation that are hidden (including
1061 * sequence associated annotation).
1064 * remove any annotation to the right of this column
1066 * remove any annotation to the left of this column
1067 * @param alignmentAnnotation
1068 * the annotation to operate on
1070 public void makeVisibleAnnotation(int start, int end,
1071 AlignmentAnnotation alignmentAnnotation)
1073 if (alignmentAnnotation.annotations == null)
1077 if (start == end && end == -1)
1080 end = alignmentAnnotation.annotations.length;
1082 if (hiddenColumns != null && hiddenColumns.size() > 0)
1084 // then mangle the alignmentAnnotation annotation array
1085 Vector<Annotation[]> annels = new Vector<Annotation[]>();
1086 Annotation[] els = null;
1087 List<int[]> regions = getHiddenColumns();
1088 int blockStart = start, blockEnd = end;
1090 int hideStart, hideEnd, w = 0;
1092 for (int j = 0; j < regions.size(); j++)
1094 region = regions.get(j);
1095 hideStart = region[0];
1096 hideEnd = region[1];
1098 if (hideStart < start)
1103 blockStart = Math.min(blockStart, hideEnd + 1);
1104 blockEnd = Math.min(blockEnd, hideStart);
1106 if (blockStart > blockEnd)
1111 annels.addElement(els = new Annotation[blockEnd - blockStart]);
1112 System.arraycopy(alignmentAnnotation.annotations, blockStart, els,
1115 blockStart = hideEnd + 1;
1119 if (end > blockStart)
1121 annels.addElement(els = new Annotation[end - blockStart + 1]);
1122 if ((els.length + blockStart) <= alignmentAnnotation.annotations.length)
1124 // copy just the visible segment of the annotation row
1125 System.arraycopy(alignmentAnnotation.annotations, blockStart,
1126 els, 0, els.length);
1130 // copy to the end of the annotation row
1131 System.arraycopy(alignmentAnnotation.annotations, blockStart,
1133 (alignmentAnnotation.annotations.length - blockStart));
1142 alignmentAnnotation.annotations = new Annotation[w];
1145 for (Annotation[] chnk : annels)
1147 System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w,
1154 alignmentAnnotation.restrict(start, end);
1159 * Invert the column selection from first to end-1. leaves hiddenColumns
1160 * untouched (and unselected)
1165 public void invertColumnSelection(int first, int width)
1167 boolean hasHidden = hiddenColumns != null && hiddenColumns.size() > 0;
1168 for (int i = first; i < width; i++)
1176 if (!hasHidden || isVisible(i))
1185 * add in any unselected columns from the given column selection, excluding
1186 * any that are hidden.
1190 public void addElementsFrom(ColumnSelection colsel)
1192 if (colsel != null && !colsel.isEmpty())
1194 for (Integer col : colsel.getSelected())
1196 if (hiddenColumns != null && isVisible(col.intValue()))
1205 * set the selected columns the given column selection, excluding any columns
1210 public void setElementsFrom(ColumnSelection colsel)
1212 selected = new IntList();
1213 if (colsel.selected != null && colsel.selected.size() > 0)
1215 if (hiddenColumns != null && hiddenColumns.size() > 0)
1217 // only select visible columns in this columns selection
1218 addElementsFrom(colsel);
1222 // add everything regardless
1223 for (Integer col : colsel.getSelected())
1232 * Add gaps into the sequences aligned to profileseq under the given
1237 * - alignment to have gaps inserted into it
1239 * - alignment view where sequence corresponding to profileseq is
1241 * @return new Column selection for new alignment view, with insertions into
1242 * profileseq marked as hidden.
1244 public static ColumnSelection propagateInsertions(SequenceI profileseq,
1245 AlignmentI al, AlignmentView input)
1249 // return propagateInsertions(profileseq, al, )
1250 char gc = al.getGapCharacter();
1251 Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc);
1252 ColumnSelection nview = (ColumnSelection) alandcolsel[1];
1253 SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos];
1254 nview.propagateInsertions(profileseq, al, origseq);
1261 * - sequence in al which corresponds to origseq
1263 * - alignment which is to have gaps inserted into it
1265 * - sequence corresponding to profileseq which defines gap map for
1268 public void propagateInsertions(SequenceI profileseq, AlignmentI al,
1271 char gc = al.getGapCharacter();
1272 // recover mapping between sequence's non-gap positions and positions
1274 pruneDeletions(ShiftList.parseMap(origseq.gapMap()));
1275 int[] viscontigs = getVisibleContigs(0, profileseq.getLength());
1278 // input.pruneDeletions(ShiftList.parseMap(((SequenceI[])
1279 // alandcolsel[0])[0].gapMap()))
1280 // add profile to visible contigs
1281 for (int v = 0; v < viscontigs.length; v += 2)
1283 if (viscontigs[v] > spos)
1285 StringBuffer sb = new StringBuffer();
1286 for (int s = 0, ns = viscontigs[v] - spos; s < ns; s++)
1290 for (int s = 0, ns = al.getHeight(); s < ns; s++)
1292 SequenceI sqobj = al.getSequenceAt(s);
1293 if (sqobj != profileseq)
1295 String sq = al.getSequenceAt(s).getSequenceAsString();
1296 if (sq.length() <= spos + offset)
1299 int diff = spos + offset - sq.length() - 1;
1304 while ((diff = spos + offset - sq.length() - 1) > 0)
1307 // + ((diff >= sb.length()) ? sb.toString() : sb
1308 // .substring(0, diff));
1309 if (diff >= sb.length())
1311 sq += sb.toString();
1315 char[] buf = new char[diff];
1316 sb.getChars(0, diff, buf, 0);
1317 sq += buf.toString();
1321 sq += sb.toString();
1325 al.getSequenceAt(s).setSequence(
1326 sq.substring(0, spos + offset) + sb.toString()
1327 + sq.substring(spos + offset));
1331 // offset+=sb.length();
1333 spos = viscontigs[v + 1] + 1;
1335 if ((offset + spos) < profileseq.getLength())
1337 // pad the final region with gaps.
1338 StringBuffer sb = new StringBuffer();
1339 for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++)
1343 for (int s = 0, ns = al.getHeight(); s < ns; s++)
1345 SequenceI sqobj = al.getSequenceAt(s);
1346 if (sqobj == profileseq)
1350 String sq = sqobj.getSequenceAsString();
1352 int diff = origseq.getLength() - sq.length();
1356 // + ((diff >= sb.length()) ? sb.toString() : sb
1357 // .substring(0, diff));
1358 if (diff >= sb.length())
1360 sq += sb.toString();
1364 char[] buf = new char[diff];
1365 sb.getChars(0, diff, buf, 0);
1366 sq += buf.toString();
1368 diff = origseq.getLength() - sq.length();
1376 * @return true if there are columns marked
1378 public boolean hasSelectedColumns()
1380 return (selected != null && selected.size() > 0);
1385 * @return true if there are columns hidden
1387 public boolean hasHiddenColumns()
1389 return hiddenColumns != null && hiddenColumns.size() > 0;
1394 * @return true if there are more than one set of columns hidden
1396 public boolean hasManyHiddenColumns()
1398 return hiddenColumns != null && hiddenColumns.size() > 1;
1402 * mark the columns corresponding to gap characters as hidden in the column
1407 public void hideInsertionsFor(SequenceI sr)
1409 List<int[]> inserts = sr.getInsertions();
1410 for (int[] r : inserts)
1412 hideColumns(r[0], r[1]);
1416 public boolean filterAnnotations(Annotation[] annotations,
1417 AnnotationFilterParameter filterParams)
1419 this.revealAllHiddenColumns();
1424 if (annotations[count] != null)
1427 boolean itemMatched = false;
1429 if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD
1430 && annotations[count].value >= filterParams
1431 .getThresholdValue())
1435 if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD
1436 && annotations[count].value <= filterParams
1437 .getThresholdValue())
1442 if (filterParams.isFilterAlphaHelix()
1443 && annotations[count].secondaryStructure == 'H')
1448 if (filterParams.isFilterBetaSheet()
1449 && annotations[count].secondaryStructure == 'E')
1454 if (filterParams.isFilterTurn()
1455 && annotations[count].secondaryStructure == 'S')
1460 String regexSearchString = filterParams.getRegexString();
1461 if (regexSearchString != null
1462 && !filterParams.getRegexSearchFields().isEmpty())
1464 List<SearchableAnnotationField> fields = filterParams
1465 .getRegexSearchFields();
1468 if (fields.contains(SearchableAnnotationField.DISPLAY_STRING)
1469 && annotations[count].displayCharacter
1470 .matches(regexSearchString))
1474 } catch (java.util.regex.PatternSyntaxException pse)
1476 if (annotations[count].displayCharacter
1477 .equals(regexSearchString))
1482 if (fields.contains(SearchableAnnotationField.DESCRIPTION)
1483 && annotations[count].description != null
1484 && annotations[count].description
1485 .matches(regexSearchString))
1493 this.addElement(count);
1497 } while (count < annotations.length);