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 int getMaxColumn()
175 return selected.length() - 1;
178 public int getMinColumn()
180 return selected.get(0) ? 0 : selected.nextSetBit(0);
184 IntList selected = new IntList();
186 * list of hidden column [start, end] ranges; the list is maintained in
187 * ascending start column order
189 Vector<int[]> hiddenColumns;
192 * Add a column to the selection
197 public void addElement(int col)
203 * clears column selection
211 * Removes value 'col' from the selection (not the col'th item)
214 * index of column to be removed
216 public void removeElement(int col)
218 selected.remove(col);
222 * removes a range of columns from the selection
225 * int - first column in range to be removed
229 public void removeElements(int start, int end)
232 for (int i = start; i < end; i++)
234 colInt = new Integer(i);
235 if (selected.contains(colInt))
237 selected.remove(colInt);
243 * Returns a list of selected columns. The list contains no duplicates but is
244 * not necessarily ordered.
246 public List<Integer> getSelected()
248 return selected.getList();
254 * index to search for in column selection
256 * @return true if Integer(col) is in selection.
258 public boolean contains(int col)
260 return selected.contains(new Integer(col));
264 * Answers true if no columns are selected, else false
266 public boolean isEmpty()
268 return selected == null || selected.isEmpty();
272 * rightmost selected column
274 * @return rightmost column in alignment that is selected
278 if (selected.isEmpty())
282 return selected.getMaxColumn();
286 * Leftmost column in selection
288 * @return column index of leftmost column in selection
292 if (selected.isEmpty())
296 return selected.getMinColumn();
300 * propagate shift in alignment columns to column selection
305 * shift in edit (+ve for removal, or -ve for inserts)
307 public List<int[]> compensateForEdit(int start, int change)
309 List<int[]> deletedHiddenColumns = null;
310 selected.compensateForEdits(start, change);
312 if (hiddenColumns != null)
314 deletedHiddenColumns = new ArrayList<int[]>();
315 int hSize = hiddenColumns.size();
316 for (int i = 0; i < hSize; i++)
318 int[] region = hiddenColumns.elementAt(i);
319 if (region[0] > start && start + change > region[1])
321 deletedHiddenColumns.add(region);
323 hiddenColumns.removeElementAt(i);
329 if (region[0] > start)
342 this.revealHiddenColumns(0);
345 return deletedHiddenColumns;
349 * propagate shift in alignment columns to column selection special version of
350 * compensateForEdit - allowing for edits within hidden regions
355 * shift in edit (+ve for removal, or -ve for inserts)
357 private void compensateForDelEdits(int start, int change)
360 selected.compensateForEdits(start, change);
362 if (hiddenColumns != null)
364 for (int i = 0; i < hiddenColumns.size(); i++)
366 int[] region = hiddenColumns.elementAt(i);
367 if (region[0] >= start)
371 if (region[1] >= start)
375 if (region[1] < region[0])
377 hiddenColumns.removeElementAt(i--);
393 * Adjust hidden column boundaries based on a series of column additions or
394 * deletions in visible regions.
399 public ShiftList compensateForEdits(ShiftList shiftrecord)
401 if (shiftrecord != null)
403 final List<int[]> shifts = shiftrecord.getShifts();
404 if (shifts != null && shifts.size() > 0)
407 for (int i = 0, j = shifts.size(); i < j; i++)
409 int[] sh = shifts.get(i);
410 // compensateForEdit(shifted+sh[0], sh[1]);
411 compensateForDelEdits(shifted + sh[0], sh[1]);
415 return shiftrecord.getInverse();
421 * removes intersection of position,length ranges in deletions from the
422 * start,end regions marked in intervals.
428 private boolean pruneIntervalVector(final List<int[]> shifts,
429 Vector<int[]> intervals)
431 boolean pruned = false;
432 int i = 0, j = intervals.size() - 1, s = 0, t = shifts.size() - 1;
433 int hr[] = intervals.elementAt(i);
434 int sr[] = shifts.get(s);
435 while (i <= j && s <= t)
437 boolean trailinghn = hr[1] >= sr[0];
442 hr = intervals.elementAt(++i);
450 int endshift = sr[0] + sr[1]; // deletion ranges - -ve means an insert
451 if (endshift < hr[0] || endshift < sr[0])
452 { // leadinghc disjoint or not a deletion
455 sr = shifts.get(++s);
463 boolean leadinghn = hr[0] >= sr[0];
464 boolean leadinghc = hr[0] < endshift;
465 boolean trailinghc = hr[1] < endshift;
469 { // deleted hidden region.
470 intervals.removeElementAt(i);
475 hr = intervals.elementAt(i);
481 hr[0] = endshift; // clip c terminal region
482 leadinghn = !leadinghn;
498 // sr contained in hr
501 sr = shifts.get(++s);
511 return pruned; // true if any interval was removed or modified by
516 * remove any hiddenColumns or selected columns and shift remaining based on a
517 * series of position, range deletions.
521 public void pruneDeletions(ShiftList deletions)
523 if (deletions != null)
525 final List<int[]> shifts = deletions.getShifts();
526 if (shifts != null && shifts.size() > 0)
528 // delete any intervals intersecting.
529 if (hiddenColumns != null)
531 pruneIntervalVector(shifts, hiddenColumns);
532 if (hiddenColumns != null && hiddenColumns.size() == 0)
534 hiddenColumns = null;
537 if (selected != null && selected.size() > 0)
539 selected.pruneColumnList(shifts);
540 if (selected != null && selected.size() == 0)
545 // and shift the rest.
546 this.compensateForEdits(deletions);
552 * This Method is used to return all the HiddenColumn regions
554 * @return empty list or List of hidden column intervals
556 public List<int[]> getHiddenColumns()
558 return hiddenColumns == null ? Collections.<int[]> emptyList()
563 * Return absolute column index for a visible column index
566 * int column index in alignment view
567 * @return alignment column index for column
569 public int adjustForHiddenColumns(int column)
572 if (hiddenColumns != null)
574 for (int i = 0; i < hiddenColumns.size(); i++)
576 int[] region = hiddenColumns.elementAt(i);
577 if (result >= region[0])
579 result += region[1] - region[0] + 1;
587 * Use this method to find out where a column will appear in the visible
588 * alignment when hidden columns exist. If the column is not visible, then the
589 * left-most visible column will always be returned.
591 * @param hiddenColumn
595 public int findColumnPosition(int hiddenColumn)
597 int result = hiddenColumn;
598 if (hiddenColumns != null)
604 region = hiddenColumns.elementAt(index++);
605 if (hiddenColumn > region[1])
607 result -= region[1] + 1 - region[0];
609 } while ((hiddenColumn > region[1]) && (index < hiddenColumns.size()));
610 if (hiddenColumn > region[0] && hiddenColumn < region[1])
612 return region[0] + hiddenColumn - result;
615 return result; // return the shifted position after removing hidden columns.
619 * Use this method to determine where the next hiddenRegion starts
621 public int findHiddenRegionPosition(int hiddenRegion)
624 if (hiddenColumns != null)
630 int[] region = hiddenColumns.elementAt(index);
631 if (hiddenRegion == 0)
636 gaps += region[1] + 1 - region[0];
637 result = region[1] + 1;
639 } while (index < hiddenRegion + 1);
648 * THis method returns the rightmost limit of a region of an alignment with
649 * hidden columns. In otherwords, the next hidden column.
654 public int getHiddenBoundaryRight(int alPos)
656 if (hiddenColumns != null)
661 int[] region = hiddenColumns.elementAt(index);
662 if (alPos < region[0])
668 } while (index < hiddenColumns.size());
676 * This method returns the leftmost limit of a region of an alignment with
677 * hidden columns. In otherwords, the previous hidden column.
682 public int getHiddenBoundaryLeft(int alPos)
684 if (hiddenColumns != null)
686 int index = hiddenColumns.size() - 1;
689 int[] region = hiddenColumns.elementAt(index);
690 if (alPos > region[1])
696 } while (index > -1);
703 public void hideSelectedColumns()
705 while (!selected.isEmpty())
707 int column = selected.elementAt(0);
714 * Adds the specified column range to the hidden columns
719 public void hideColumns(int start, int end)
721 if (hiddenColumns == null)
723 hiddenColumns = new Vector<int[]>();
727 * traverse existing hidden ranges and insert / amend / append as
730 for (int i = 0; i < hiddenColumns.size(); i++)
732 int[] region = hiddenColumns.elementAt(i);
734 if (end < region[0] - 1)
737 * insert discontiguous preceding range
739 hiddenColumns.insertElementAt(new int[] { start, end }, i);
743 if (end <= region[1])
746 * new range overlaps existing, or is contiguous preceding it - adjust
749 region[0] = Math.min(region[0], start);
753 if (start <= region[1] + 1)
756 * new range overlaps existing, or is contiguous following it - adjust
757 * start and end columns
759 region[0] = Math.min(region[0], start);
760 region[1] = Math.max(region[1], end);
766 * remaining case is that the new range follows everything else
768 hiddenColumns.addElement(new int[] { start, end });
772 * Hides the specified column and any adjacent selected columns
777 public void hideColumns(int col)
780 * deselect column (whether selected or not!)
785 * find adjacent selected columns
787 int min = col - 1, max = col + 1;
788 while (contains(min))
794 while (contains(max))
801 * min, max are now the closest unselected columns
810 hideColumns(min, max);
814 * Unhides, and adds to the selection list, all hidden columns
816 public void revealAllHiddenColumns()
818 if (hiddenColumns != null)
820 for (int i = 0; i < hiddenColumns.size(); i++)
822 int[] region = hiddenColumns.elementAt(i);
823 for (int j = region[0]; j < region[1] + 1; j++)
830 hiddenColumns = null;
834 * Reveals, and marks as selected, the hidden column range with the given
839 public void revealHiddenColumns(int start)
841 for (int i = 0; i < hiddenColumns.size(); i++)
843 int[] region = hiddenColumns.elementAt(i);
844 if (start == region[0])
846 for (int j = region[0]; j < region[1] + 1; j++)
851 hiddenColumns.removeElement(region);
855 if (hiddenColumns.size() == 0)
857 hiddenColumns = null;
861 public boolean isVisible(int column)
863 if (hiddenColumns != null)
865 for (int[] region : hiddenColumns)
867 if (column >= region[0] && column <= region[1])
882 public ColumnSelection(ColumnSelection copy)
886 if (copy.selected != null)
888 selected = new IntList();
889 for (int i = 0, j = copy.selected.size(); i < j; i++)
891 selected.add(copy.selected.elementAt(i));
894 if (copy.hiddenColumns != null)
896 hiddenColumns = new Vector<int[]>(copy.hiddenColumns.size());
897 for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++)
900 rh = copy.hiddenColumns.elementAt(i);
903 cp = new int[rh.length];
904 System.arraycopy(rh, 0, cp, 0, rh.length);
905 hiddenColumns.addElement(cp);
915 public ColumnSelection()
919 public String[] getVisibleSequenceStrings(int start, int end,
922 int i, iSize = seqs.length;
923 String selection[] = new String[iSize];
924 if (hiddenColumns != null && hiddenColumns.size() > 0)
926 for (i = 0; i < iSize; i++)
928 StringBuffer visibleSeq = new StringBuffer();
929 List<int[]> regions = getHiddenColumns();
931 int blockStart = start, blockEnd = end;
933 int hideStart, hideEnd;
935 for (int j = 0; j < regions.size(); j++)
937 region = regions.get(j);
938 hideStart = region[0];
941 if (hideStart < start)
946 blockStart = Math.min(blockStart, hideEnd + 1);
947 blockEnd = Math.min(blockEnd, hideStart);
949 if (blockStart > blockEnd)
954 visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
956 blockStart = hideEnd + 1;
960 if (end > blockStart)
962 visibleSeq.append(seqs[i].getSequence(blockStart, end));
965 selection[i] = visibleSeq.toString();
970 for (i = 0; i < iSize; i++)
972 selection[i] = seqs[i].getSequenceAsString(start, end);
980 * return all visible segments between the given start and end boundaries
983 * (first column inclusive from 0)
985 * (last column - not inclusive)
986 * @return int[] {i_start, i_end, ..} where intervals lie in
987 * start<=i_start<=i_end<end
989 public int[] getVisibleContigs(int start, int end)
991 if (hiddenColumns != null && hiddenColumns.size() > 0)
993 List<int[]> visiblecontigs = new ArrayList<int[]>();
994 List<int[]> regions = getHiddenColumns();
998 int hideStart, hideEnd;
1000 for (int j = 0; vstart < end && j < regions.size(); j++)
1002 region = regions.get(j);
1003 hideStart = region[0];
1004 hideEnd = region[1];
1006 if (hideEnd < vstart)
1010 if (hideStart > vstart)
1012 visiblecontigs.add(new int[] { vstart, hideStart - 1 });
1014 vstart = hideEnd + 1;
1019 visiblecontigs.add(new int[] { vstart, end - 1 });
1021 int[] vcontigs = new int[visiblecontigs.size() * 2];
1022 for (int i = 0, j = visiblecontigs.size(); i < j; i++)
1024 int[] vc = visiblecontigs.get(i);
1025 visiblecontigs.set(i, null);
1026 vcontigs[i * 2] = vc[0];
1027 vcontigs[i * 2 + 1] = vc[1];
1029 visiblecontigs.clear();
1034 return new int[] { start, end - 1 };
1039 * delete any columns in alignmentAnnotation that are hidden (including
1040 * sequence associated annotation).
1042 * @param alignmentAnnotation
1044 public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation)
1046 makeVisibleAnnotation(-1, -1, alignmentAnnotation);
1050 * delete any columns in alignmentAnnotation that are hidden (including
1051 * sequence associated annotation).
1054 * remove any annotation to the right of this column
1056 * remove any annotation to the left of this column
1057 * @param alignmentAnnotation
1058 * the annotation to operate on
1060 public void makeVisibleAnnotation(int start, int end,
1061 AlignmentAnnotation alignmentAnnotation)
1063 if (alignmentAnnotation.annotations == null)
1067 if (start == end && end == -1)
1070 end = alignmentAnnotation.annotations.length;
1072 if (hiddenColumns != null && hiddenColumns.size() > 0)
1074 // then mangle the alignmentAnnotation annotation array
1075 Vector<Annotation[]> annels = new Vector<Annotation[]>();
1076 Annotation[] els = null;
1077 List<int[]> regions = getHiddenColumns();
1078 int blockStart = start, blockEnd = end;
1080 int hideStart, hideEnd, w = 0;
1082 for (int j = 0; j < regions.size(); j++)
1084 region = regions.get(j);
1085 hideStart = region[0];
1086 hideEnd = region[1];
1088 if (hideStart < start)
1093 blockStart = Math.min(blockStart, hideEnd + 1);
1094 blockEnd = Math.min(blockEnd, hideStart);
1096 if (blockStart > blockEnd)
1101 annels.addElement(els = new Annotation[blockEnd - blockStart]);
1102 System.arraycopy(alignmentAnnotation.annotations, blockStart, els,
1105 blockStart = hideEnd + 1;
1109 if (end > blockStart)
1111 annels.addElement(els = new Annotation[end - blockStart + 1]);
1112 if ((els.length + blockStart) <= alignmentAnnotation.annotations.length)
1114 // copy just the visible segment of the annotation row
1115 System.arraycopy(alignmentAnnotation.annotations, blockStart,
1116 els, 0, els.length);
1120 // copy to the end of the annotation row
1121 System.arraycopy(alignmentAnnotation.annotations, blockStart,
1123 (alignmentAnnotation.annotations.length - blockStart));
1132 alignmentAnnotation.annotations = new Annotation[w];
1135 for (Annotation[] chnk : annels)
1137 System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w,
1144 alignmentAnnotation.restrict(start, end);
1149 * Invert the column selection from first to end-1. leaves hiddenColumns
1150 * untouched (and unselected)
1155 public void invertColumnSelection(int first, int width)
1157 boolean hasHidden = hiddenColumns != null && hiddenColumns.size() > 0;
1158 for (int i = first; i < width; i++)
1166 if (!hasHidden || isVisible(i))
1175 * add in any unselected columns from the given column selection, excluding
1176 * any that are hidden.
1180 public void addElementsFrom(ColumnSelection colsel)
1182 if (colsel != null && !colsel.isEmpty())
1184 for (Integer col : colsel.getSelected())
1186 if (hiddenColumns != null && isVisible(col.intValue()))
1195 * set the selected columns the given column selection, excluding any columns
1200 public void setElementsFrom(ColumnSelection colsel)
1202 selected = new IntList();
1203 if (colsel.selected != null && colsel.selected.size() > 0)
1205 if (hiddenColumns != null && hiddenColumns.size() > 0)
1207 // only select visible columns in this columns selection
1208 addElementsFrom(colsel);
1212 // add everything regardless
1213 for (Integer col : colsel.getSelected())
1222 * Add gaps into the sequences aligned to profileseq under the given
1227 * - alignment to have gaps inserted into it
1229 * - alignment view where sequence corresponding to profileseq is
1231 * @return new Column selection for new alignment view, with insertions into
1232 * profileseq marked as hidden.
1234 public static ColumnSelection propagateInsertions(SequenceI profileseq,
1235 AlignmentI al, AlignmentView input)
1239 // return propagateInsertions(profileseq, al, )
1240 char gc = al.getGapCharacter();
1241 Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc);
1242 ColumnSelection nview = (ColumnSelection) alandcolsel[1];
1243 SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos];
1244 nview.propagateInsertions(profileseq, al, origseq);
1251 * - sequence in al which corresponds to origseq
1253 * - alignment which is to have gaps inserted into it
1255 * - sequence corresponding to profileseq which defines gap map for
1258 public void propagateInsertions(SequenceI profileseq, AlignmentI al,
1261 char gc = al.getGapCharacter();
1262 // recover mapping between sequence's non-gap positions and positions
1264 pruneDeletions(ShiftList.parseMap(origseq.gapMap()));
1265 int[] viscontigs = getVisibleContigs(0, profileseq.getLength());
1268 // input.pruneDeletions(ShiftList.parseMap(((SequenceI[])
1269 // alandcolsel[0])[0].gapMap()))
1270 // add profile to visible contigs
1271 for (int v = 0; v < viscontigs.length; v += 2)
1273 if (viscontigs[v] > spos)
1275 StringBuffer sb = new StringBuffer();
1276 for (int s = 0, ns = viscontigs[v] - spos; s < ns; s++)
1280 for (int s = 0, ns = al.getHeight(); s < ns; s++)
1282 SequenceI sqobj = al.getSequenceAt(s);
1283 if (sqobj != profileseq)
1285 String sq = al.getSequenceAt(s).getSequenceAsString();
1286 if (sq.length() <= spos + offset)
1289 int diff = spos + offset - sq.length() - 1;
1294 while ((diff = spos + offset - sq.length() - 1) > 0)
1297 // + ((diff >= sb.length()) ? sb.toString() : sb
1298 // .substring(0, diff));
1299 if (diff >= sb.length())
1301 sq += sb.toString();
1305 char[] buf = new char[diff];
1306 sb.getChars(0, diff, buf, 0);
1307 sq += buf.toString();
1311 sq += sb.toString();
1315 al.getSequenceAt(s).setSequence(
1316 sq.substring(0, spos + offset) + sb.toString()
1317 + sq.substring(spos + offset));
1321 // offset+=sb.length();
1323 spos = viscontigs[v + 1] + 1;
1325 if ((offset + spos) < profileseq.getLength())
1327 // pad the final region with gaps.
1328 StringBuffer sb = new StringBuffer();
1329 for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++)
1333 for (int s = 0, ns = al.getHeight(); s < ns; s++)
1335 SequenceI sqobj = al.getSequenceAt(s);
1336 if (sqobj == profileseq)
1340 String sq = sqobj.getSequenceAsString();
1342 int diff = origseq.getLength() - sq.length();
1346 // + ((diff >= sb.length()) ? sb.toString() : sb
1347 // .substring(0, diff));
1348 if (diff >= sb.length())
1350 sq += sb.toString();
1354 char[] buf = new char[diff];
1355 sb.getChars(0, diff, buf, 0);
1356 sq += buf.toString();
1358 diff = origseq.getLength() - sq.length();
1366 * @return true if there are columns marked
1368 public boolean hasSelectedColumns()
1370 return (selected != null && selected.size() > 0);
1375 * @return true if there are columns hidden
1377 public boolean hasHiddenColumns()
1379 return hiddenColumns != null && hiddenColumns.size() > 0;
1384 * @return true if there are more than one set of columns hidden
1386 public boolean hasManyHiddenColumns()
1388 return hiddenColumns != null && hiddenColumns.size() > 1;
1392 * mark the columns corresponding to gap characters as hidden in the column
1397 public void hideInsertionsFor(SequenceI sr)
1399 List<int[]> inserts = sr.getInsertions();
1400 for (int[] r : inserts)
1402 hideColumns(r[0], r[1]);
1406 public boolean filterAnnotations(Annotation[] annotations,
1407 AnnotationFilterParameter filterParams)
1409 this.revealAllHiddenColumns();
1414 if (annotations[count] != null)
1417 boolean itemMatched = false;
1419 if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD
1420 && annotations[count].value >= filterParams
1421 .getThresholdValue())
1425 if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD
1426 && annotations[count].value <= filterParams
1427 .getThresholdValue())
1432 if (filterParams.isFilterAlphaHelix()
1433 && annotations[count].secondaryStructure == 'H')
1438 if (filterParams.isFilterBetaSheet()
1439 && annotations[count].secondaryStructure == 'E')
1444 if (filterParams.isFilterTurn()
1445 && annotations[count].secondaryStructure == 'S')
1450 String regexSearchString = filterParams.getRegexString();
1451 if (regexSearchString != null
1452 && !filterParams.getRegexSearchFields().isEmpty())
1454 List<SearchableAnnotationField> fields = filterParams
1455 .getRegexSearchFields();
1458 if (fields.contains(SearchableAnnotationField.DISPLAY_STRING)
1459 && annotations[count].displayCharacter
1460 .matches(regexSearchString))
1464 } catch (java.util.regex.PatternSyntaxException pse)
1466 if (annotations[count].displayCharacter
1467 .equals(regexSearchString))
1472 if (fields.contains(SearchableAnnotationField.DESCRIPTION)
1473 && annotations[count].description != null
1474 && annotations[count].description
1475 .matches(regexSearchString))
1483 this.addElement(count);
1487 } while (count < annotations.length);