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
174 IntList selected = new IntList();
176 * list of hidden column [start, end] ranges; the list is maintained in
177 * ascending start column order
179 Vector<int[]> hiddenColumns;
182 * Add a column to the selection
187 public void addElement(int col)
193 * clears column selection
201 * Removes value 'col' from the selection (not the col'th item)
204 * index of column to be removed
206 public void removeElement(int col)
208 selected.remove(col);
212 * removes a range of columns from the selection
215 * int - first column in range to be removed
219 public void removeElements(int start, int end)
222 for (int i = start; i < end; i++)
224 colInt = new Integer(i);
225 if (selected.contains(colInt))
227 selected.remove(colInt);
233 * Returns a list of selected columns. The list contains no duplicates but is
234 * not necessarily ordered.
236 public List<Integer> getSelected()
238 return selected.getList();
244 * index to search for in column selection
246 * @return true if Integer(col) is in selection.
248 public boolean contains(int col)
250 return selected.contains(new Integer(col));
254 * Answers true if no columns are selected, else false
256 public boolean isEmpty()
258 return selected == null || selected.isEmpty();
262 * rightmost selected column
264 * @return rightmost column in alignment that is selected
270 for (int sel : getSelected())
282 * Leftmost column in selection
284 * @return column index of leftmost column in selection
288 int min = 1000000000;
290 for (int sel : getSelected())
302 * propagate shift in alignment columns to column selection
307 * shift in edit (+ve for removal, or -ve for inserts)
309 public List<int[]> compensateForEdit(int start, int change)
311 List<int[]> deletedHiddenColumns = null;
312 selected.compensateForEdits(start, change);
314 if (hiddenColumns != null)
316 deletedHiddenColumns = new ArrayList<int[]>();
317 int hSize = hiddenColumns.size();
318 for (int i = 0; i < hSize; i++)
320 int[] region = hiddenColumns.elementAt(i);
321 if (region[0] > start && start + change > region[1])
323 deletedHiddenColumns.add(region);
325 hiddenColumns.removeElementAt(i);
331 if (region[0] > start)
344 this.revealHiddenColumns(0);
347 return deletedHiddenColumns;
351 * propagate shift in alignment columns to column selection special version of
352 * compensateForEdit - allowing for edits within hidden regions
357 * shift in edit (+ve for removal, or -ve for inserts)
359 private void compensateForDelEdits(int start, int change)
362 selected.compensateForEdits(start, change);
364 if (hiddenColumns != null)
366 for (int i = 0; i < hiddenColumns.size(); i++)
368 int[] region = hiddenColumns.elementAt(i);
369 if (region[0] >= start)
373 if (region[1] >= start)
377 if (region[1] < region[0])
379 hiddenColumns.removeElementAt(i--);
395 * Adjust hidden column boundaries based on a series of column additions or
396 * deletions in visible regions.
401 public ShiftList compensateForEdits(ShiftList shiftrecord)
403 if (shiftrecord != null)
405 final List<int[]> shifts = shiftrecord.getShifts();
406 if (shifts != null && shifts.size() > 0)
409 for (int i = 0, j = shifts.size(); i < j; i++)
411 int[] sh = shifts.get(i);
412 // compensateForEdit(shifted+sh[0], sh[1]);
413 compensateForDelEdits(shifted + sh[0], sh[1]);
417 return shiftrecord.getInverse();
423 * removes intersection of position,length ranges in deletions from the
424 * start,end regions marked in intervals.
430 private boolean pruneIntervalVector(final List<int[]> shifts,
431 Vector<int[]> intervals)
433 boolean pruned = false;
434 int i = 0, j = intervals.size() - 1, s = 0, t = shifts.size() - 1;
435 int hr[] = intervals.elementAt(i);
436 int sr[] = shifts.get(s);
437 while (i <= j && s <= t)
439 boolean trailinghn = hr[1] >= sr[0];
444 hr = intervals.elementAt(++i);
452 int endshift = sr[0] + sr[1]; // deletion ranges - -ve means an insert
453 if (endshift < hr[0] || endshift < sr[0])
454 { // leadinghc disjoint or not a deletion
457 sr = shifts.get(++s);
465 boolean leadinghn = hr[0] >= sr[0];
466 boolean leadinghc = hr[0] < endshift;
467 boolean trailinghc = hr[1] < endshift;
471 { // deleted hidden region.
472 intervals.removeElementAt(i);
477 hr = intervals.elementAt(i);
483 hr[0] = endshift; // clip c terminal region
484 leadinghn = !leadinghn;
500 // sr contained in hr
503 sr = shifts.get(++s);
513 return pruned; // true if any interval was removed or modified by
518 * remove any hiddenColumns or selected columns and shift remaining based on a
519 * series of position, range deletions.
523 public void pruneDeletions(ShiftList deletions)
525 if (deletions != null)
527 final List<int[]> shifts = deletions.getShifts();
528 if (shifts != null && shifts.size() > 0)
530 // delete any intervals intersecting.
531 if (hiddenColumns != null)
533 pruneIntervalVector(shifts, hiddenColumns);
534 if (hiddenColumns != null && hiddenColumns.size() == 0)
536 hiddenColumns = null;
539 if (selected != null && selected.size() > 0)
541 selected.pruneColumnList(shifts);
542 if (selected != null && selected.size() == 0)
547 // and shift the rest.
548 this.compensateForEdits(deletions);
554 * This Method is used to return all the HiddenColumn regions
556 * @return empty list or List of hidden column intervals
558 public List<int[]> getHiddenColumns()
560 return hiddenColumns == null ? Collections.<int[]> emptyList()
565 * Return absolute column index for a visible column index
568 * int column index in alignment view
569 * @return alignment column index for column
571 public int adjustForHiddenColumns(int column)
574 if (hiddenColumns != null)
576 for (int i = 0; i < hiddenColumns.size(); i++)
578 int[] region = hiddenColumns.elementAt(i);
579 if (result >= region[0])
581 result += region[1] - region[0] + 1;
589 * Use this method to find out where a column will appear in the visible
590 * alignment when hidden columns exist. If the column is not visible, then the
591 * left-most visible column will always be returned.
593 * @param hiddenColumn
597 public int findColumnPosition(int hiddenColumn)
599 int result = hiddenColumn;
600 if (hiddenColumns != null)
606 region = hiddenColumns.elementAt(index++);
607 if (hiddenColumn > region[1])
609 result -= region[1] + 1 - region[0];
611 } while ((hiddenColumn > region[1]) && (index < hiddenColumns.size()));
612 if (hiddenColumn > region[0] && hiddenColumn < region[1])
614 return region[0] + hiddenColumn - result;
617 return result; // return the shifted position after removing hidden columns.
621 * Use this method to determine where the next hiddenRegion starts
623 public int findHiddenRegionPosition(int hiddenRegion)
626 if (hiddenColumns != null)
632 int[] region = hiddenColumns.elementAt(index);
633 if (hiddenRegion == 0)
638 gaps += region[1] + 1 - region[0];
639 result = region[1] + 1;
641 } while (index < hiddenRegion + 1);
650 * THis method returns the rightmost limit of a region of an alignment with
651 * hidden columns. In otherwords, the next hidden column.
656 public int getHiddenBoundaryRight(int alPos)
658 if (hiddenColumns != null)
663 int[] region = hiddenColumns.elementAt(index);
664 if (alPos < region[0])
670 } while (index < hiddenColumns.size());
678 * This method returns the leftmost limit of a region of an alignment with
679 * hidden columns. In otherwords, the previous hidden column.
684 public int getHiddenBoundaryLeft(int alPos)
686 if (hiddenColumns != null)
688 int index = hiddenColumns.size() - 1;
691 int[] region = hiddenColumns.elementAt(index);
692 if (alPos > region[1])
698 } while (index > -1);
705 public void hideSelectedColumns()
707 while (!selected.isEmpty())
709 int column = selected.elementAt(0);
716 * Adds the specified column range to the hidden columns
721 public void hideColumns(int start, int end)
723 if (hiddenColumns == null)
725 hiddenColumns = new Vector<int[]>();
729 * traverse existing hidden ranges and insert / amend / append as
732 for (int i = 0; i < hiddenColumns.size(); i++)
734 int[] region = hiddenColumns.elementAt(i);
736 if (end < region[0] - 1)
739 * insert discontiguous preceding range
741 hiddenColumns.insertElementAt(new int[] { start, end }, i);
745 if (end <= region[1])
748 * new range overlaps existing, or is contiguous preceding it - adjust
751 region[0] = Math.min(region[0], start);
755 if (start <= region[1] + 1)
758 * new range overlaps existing, or is contiguous following it - adjust
759 * start and end columns
761 region[0] = Math.min(region[0], start);
762 region[1] = Math.max(region[1], end);
768 * remaining case is that the new range follows everything else
770 hiddenColumns.addElement(new int[] { start, end });
774 * Hides the specified column and any adjacent selected columns
779 public void hideColumns(int col)
782 * deselect column (whether selected or not!)
787 * find adjacent selected columns
789 int min = col - 1, max = col + 1;
790 while (contains(min))
796 while (contains(max))
803 * min, max are now the closest unselected columns
812 hideColumns(min, max);
816 * Unhides, and adds to the selection list, all hidden columns
818 public void revealAllHiddenColumns()
820 if (hiddenColumns != null)
822 for (int i = 0; i < hiddenColumns.size(); i++)
824 int[] region = hiddenColumns.elementAt(i);
825 for (int j = region[0]; j < region[1] + 1; j++)
832 hiddenColumns = null;
836 * Reveals, and marks as selected, the hidden column range with the given
841 public void revealHiddenColumns(int start)
843 for (int i = 0; i < hiddenColumns.size(); i++)
845 int[] region = hiddenColumns.elementAt(i);
846 if (start == region[0])
848 for (int j = region[0]; j < region[1] + 1; j++)
853 hiddenColumns.removeElement(region);
857 if (hiddenColumns.size() == 0)
859 hiddenColumns = null;
863 public boolean isVisible(int column)
865 if (hiddenColumns != null)
867 for (int[] region : hiddenColumns)
869 if (column >= region[0] && column <= region[1])
884 public ColumnSelection(ColumnSelection copy)
888 if (copy.selected != null)
890 selected = new IntList();
891 for (int i = 0, j = copy.selected.size(); i < j; i++)
893 selected.add(copy.selected.elementAt(i));
896 if (copy.hiddenColumns != null)
898 hiddenColumns = new Vector<int[]>(copy.hiddenColumns.size());
899 for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++)
902 rh = copy.hiddenColumns.elementAt(i);
905 cp = new int[rh.length];
906 System.arraycopy(rh, 0, cp, 0, rh.length);
907 hiddenColumns.addElement(cp);
917 public ColumnSelection()
921 public String[] getVisibleSequenceStrings(int start, int end,
924 int i, iSize = seqs.length;
925 String selection[] = new String[iSize];
926 if (hiddenColumns != null && hiddenColumns.size() > 0)
928 for (i = 0; i < iSize; i++)
930 StringBuffer visibleSeq = new StringBuffer();
931 List<int[]> regions = getHiddenColumns();
933 int blockStart = start, blockEnd = end;
935 int hideStart, hideEnd;
937 for (int j = 0; j < regions.size(); j++)
939 region = regions.get(j);
940 hideStart = region[0];
943 if (hideStart < start)
948 blockStart = Math.min(blockStart, hideEnd + 1);
949 blockEnd = Math.min(blockEnd, hideStart);
951 if (blockStart > blockEnd)
956 visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
958 blockStart = hideEnd + 1;
962 if (end > blockStart)
964 visibleSeq.append(seqs[i].getSequence(blockStart, end));
967 selection[i] = visibleSeq.toString();
972 for (i = 0; i < iSize; i++)
974 selection[i] = seqs[i].getSequenceAsString(start, end);
982 * return all visible segments between the given start and end boundaries
985 * (first column inclusive from 0)
987 * (last column - not inclusive)
988 * @return int[] {i_start, i_end, ..} where intervals lie in
989 * start<=i_start<=i_end<end
991 public int[] getVisibleContigs(int start, int end)
993 if (hiddenColumns != null && hiddenColumns.size() > 0)
995 List<int[]> visiblecontigs = new ArrayList<int[]>();
996 List<int[]> regions = getHiddenColumns();
1000 int hideStart, hideEnd;
1002 for (int j = 0; vstart < end && j < regions.size(); j++)
1004 region = regions.get(j);
1005 hideStart = region[0];
1006 hideEnd = region[1];
1008 if (hideEnd < vstart)
1012 if (hideStart > vstart)
1014 visiblecontigs.add(new int[] { vstart, hideStart - 1 });
1016 vstart = hideEnd + 1;
1021 visiblecontigs.add(new int[] { vstart, end - 1 });
1023 int[] vcontigs = new int[visiblecontigs.size() * 2];
1024 for (int i = 0, j = visiblecontigs.size(); i < j; i++)
1026 int[] vc = visiblecontigs.get(i);
1027 visiblecontigs.set(i, null);
1028 vcontigs[i * 2] = vc[0];
1029 vcontigs[i * 2 + 1] = vc[1];
1031 visiblecontigs.clear();
1036 return new int[] { start, end - 1 };
1041 * delete any columns in alignmentAnnotation that are hidden (including
1042 * sequence associated annotation).
1044 * @param alignmentAnnotation
1046 public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation)
1048 makeVisibleAnnotation(-1, -1, alignmentAnnotation);
1052 * delete any columns in alignmentAnnotation that are hidden (including
1053 * sequence associated annotation).
1056 * remove any annotation to the right of this column
1058 * remove any annotation to the left of this column
1059 * @param alignmentAnnotation
1060 * the annotation to operate on
1062 public void makeVisibleAnnotation(int start, int end,
1063 AlignmentAnnotation alignmentAnnotation)
1065 if (alignmentAnnotation.annotations == null)
1069 if (start == end && end == -1)
1072 end = alignmentAnnotation.annotations.length;
1074 if (hiddenColumns != null && hiddenColumns.size() > 0)
1076 // then mangle the alignmentAnnotation annotation array
1077 Vector<Annotation[]> annels = new Vector<Annotation[]>();
1078 Annotation[] els = null;
1079 List<int[]> regions = getHiddenColumns();
1080 int blockStart = start, blockEnd = end;
1082 int hideStart, hideEnd, w = 0;
1084 for (int j = 0; j < regions.size(); j++)
1086 region = regions.get(j);
1087 hideStart = region[0];
1088 hideEnd = region[1];
1090 if (hideStart < start)
1095 blockStart = Math.min(blockStart, hideEnd + 1);
1096 blockEnd = Math.min(blockEnd, hideStart);
1098 if (blockStart > blockEnd)
1103 annels.addElement(els = new Annotation[blockEnd - blockStart]);
1104 System.arraycopy(alignmentAnnotation.annotations, blockStart, els,
1107 blockStart = hideEnd + 1;
1111 if (end > blockStart)
1113 annels.addElement(els = new Annotation[end - blockStart + 1]);
1114 if ((els.length + blockStart) <= alignmentAnnotation.annotations.length)
1116 // copy just the visible segment of the annotation row
1117 System.arraycopy(alignmentAnnotation.annotations, blockStart,
1118 els, 0, els.length);
1122 // copy to the end of the annotation row
1123 System.arraycopy(alignmentAnnotation.annotations, blockStart,
1125 (alignmentAnnotation.annotations.length - blockStart));
1134 alignmentAnnotation.annotations = new Annotation[w];
1137 for (Annotation[] chnk : annels)
1139 System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w,
1146 alignmentAnnotation.restrict(start, end);
1151 * Invert the column selection from first to end-1. leaves hiddenColumns
1152 * untouched (and unselected)
1157 public void invertColumnSelection(int first, int width)
1159 boolean hasHidden = hiddenColumns != null && hiddenColumns.size() > 0;
1160 for (int i = first; i < width; i++)
1168 if (!hasHidden || isVisible(i))
1177 * add in any unselected columns from the given column selection, excluding
1178 * any that are hidden.
1182 public void addElementsFrom(ColumnSelection colsel)
1184 if (colsel != null && !colsel.isEmpty())
1186 for (Integer col : colsel.getSelected())
1188 if (hiddenColumns != null && isVisible(col.intValue()))
1197 * set the selected columns the given column selection, excluding any columns
1202 public void setElementsFrom(ColumnSelection colsel)
1204 selected = new IntList();
1205 if (colsel.selected != null && colsel.selected.size() > 0)
1207 if (hiddenColumns != null && hiddenColumns.size() > 0)
1209 // only select visible columns in this columns selection
1210 addElementsFrom(colsel);
1214 // add everything regardless
1215 for (Integer col : colsel.getSelected())
1224 * Add gaps into the sequences aligned to profileseq under the given
1229 * - alignment to have gaps inserted into it
1231 * - alignment view where sequence corresponding to profileseq is
1233 * @return new Column selection for new alignment view, with insertions into
1234 * profileseq marked as hidden.
1236 public static ColumnSelection propagateInsertions(SequenceI profileseq,
1237 AlignmentI al, AlignmentView input)
1241 // return propagateInsertions(profileseq, al, )
1242 char gc = al.getGapCharacter();
1243 Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc);
1244 ColumnSelection nview = (ColumnSelection) alandcolsel[1];
1245 SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos];
1246 nview.propagateInsertions(profileseq, al, origseq);
1253 * - sequence in al which corresponds to origseq
1255 * - alignment which is to have gaps inserted into it
1257 * - sequence corresponding to profileseq which defines gap map for
1260 public void propagateInsertions(SequenceI profileseq, AlignmentI al,
1263 char gc = al.getGapCharacter();
1264 // recover mapping between sequence's non-gap positions and positions
1266 pruneDeletions(ShiftList.parseMap(origseq.gapMap()));
1267 int[] viscontigs = getVisibleContigs(0, profileseq.getLength());
1270 // input.pruneDeletions(ShiftList.parseMap(((SequenceI[])
1271 // alandcolsel[0])[0].gapMap()))
1272 // add profile to visible contigs
1273 for (int v = 0; v < viscontigs.length; v += 2)
1275 if (viscontigs[v] > spos)
1277 StringBuffer sb = new StringBuffer();
1278 for (int s = 0, ns = viscontigs[v] - spos; s < ns; s++)
1282 for (int s = 0, ns = al.getHeight(); s < ns; s++)
1284 SequenceI sqobj = al.getSequenceAt(s);
1285 if (sqobj != profileseq)
1287 String sq = al.getSequenceAt(s).getSequenceAsString();
1288 if (sq.length() <= spos + offset)
1291 int diff = spos + offset - sq.length() - 1;
1296 while ((diff = spos + offset - sq.length() - 1) > 0)
1299 // + ((diff >= sb.length()) ? sb.toString() : sb
1300 // .substring(0, diff));
1301 if (diff >= sb.length())
1303 sq += sb.toString();
1307 char[] buf = new char[diff];
1308 sb.getChars(0, diff, buf, 0);
1309 sq += buf.toString();
1313 sq += sb.toString();
1317 al.getSequenceAt(s).setSequence(
1318 sq.substring(0, spos + offset) + sb.toString()
1319 + sq.substring(spos + offset));
1323 // offset+=sb.length();
1325 spos = viscontigs[v + 1] + 1;
1327 if ((offset + spos) < profileseq.getLength())
1329 // pad the final region with gaps.
1330 StringBuffer sb = new StringBuffer();
1331 for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++)
1335 for (int s = 0, ns = al.getHeight(); s < ns; s++)
1337 SequenceI sqobj = al.getSequenceAt(s);
1338 if (sqobj == profileseq)
1342 String sq = sqobj.getSequenceAsString();
1344 int diff = origseq.getLength() - sq.length();
1348 // + ((diff >= sb.length()) ? sb.toString() : sb
1349 // .substring(0, diff));
1350 if (diff >= sb.length())
1352 sq += sb.toString();
1356 char[] buf = new char[diff];
1357 sb.getChars(0, diff, buf, 0);
1358 sq += buf.toString();
1360 diff = origseq.getLength() - sq.length();
1368 * @return true if there are columns marked
1370 public boolean hasSelectedColumns()
1372 return (selected != null && selected.size() > 0);
1377 * @return true if there are columns hidden
1379 public boolean hasHiddenColumns()
1381 return hiddenColumns != null && hiddenColumns.size() > 0;
1386 * @return true if there are more than one set of columns hidden
1388 public boolean hasManyHiddenColumns()
1390 return hiddenColumns != null && hiddenColumns.size() > 1;
1394 * mark the columns corresponding to gap characters as hidden in the column
1399 public void hideInsertionsFor(SequenceI sr)
1401 List<int[]> inserts = sr.getInsertions();
1402 for (int[] r : inserts)
1404 hideColumns(r[0], r[1]);
1408 public boolean filterAnnotations(Annotation[] annotations,
1409 AnnotationFilterParameter filterParams)
1411 this.revealAllHiddenColumns();
1416 if (annotations[count] != null)
1419 boolean itemMatched = false;
1421 if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD
1422 && annotations[count].value >= filterParams
1423 .getThresholdValue())
1427 if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD
1428 && annotations[count].value <= filterParams
1429 .getThresholdValue())
1434 if (filterParams.isFilterAlphaHelix()
1435 && annotations[count].secondaryStructure == 'H')
1440 if (filterParams.isFilterBetaSheet()
1441 && annotations[count].secondaryStructure == 'E')
1446 if (filterParams.isFilterTurn()
1447 && annotations[count].secondaryStructure == 'S')
1452 String regexSearchString = filterParams.getRegexString();
1453 if (regexSearchString != null
1454 && !filterParams.getRegexSearchFields().isEmpty())
1456 List<SearchableAnnotationField> fields = filterParams
1457 .getRegexSearchFields();
1460 if (fields.contains(SearchableAnnotationField.DISPLAY_STRING)
1461 && annotations[count].displayCharacter
1462 .matches(regexSearchString))
1466 } catch (java.util.regex.PatternSyntaxException pse)
1468 if (annotations[count].displayCharacter
1469 .equals(regexSearchString))
1474 if (fields.contains(SearchableAnnotationField.DESCRIPTION)
1475 && annotations[count].description != null
1476 && annotations[count].description
1477 .matches(regexSearchString))
1485 this.addElement(count);
1489 } while (count < annotations.length);