Clover icon

Coverage Report

  1. Project Clover database Mon Nov 11 2024 20:42:03 GMT
  2. Package jalview.datamodel

File SearchResultsI.java

 

Code metrics

0
0
0
1
141
16
0
-
-
0
-

Classes

Class Line # Actions
SearchResultsI 30 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
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.
11    *
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.
16    *
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.
20    */
21    package jalview.datamodel;
22   
23    import java.util.BitSet;
24    import java.util.List;
25   
26    /**
27    * An interface describing the result of a search or other operation which
28    * highlights matched regions of an alignment
29    */
 
30    public interface SearchResultsI
31    {
32   
33    /**
34    * Adds one region to the results (unless already added, to avoid duplicates)
35    *
36    * @param seq
37    * @param start
38    * @param end
39    * @return
40    */
41    SearchResultMatchI addResult(SequenceI seq, int start, int end);
42   
43    /**
44    * Adds one ore more [start, end] ranges to the results (unless already added
45    * to avoid duplicates). This method only increments the match count by 1.
46    * This is for the case where a match spans ignored hidden residues - it is
47    * formally two or more contiguous matches, but only counted as one match.
48    *
49    * @param seq
50    * @param positions
51    */
52    void addResult(SequenceI seq, int[] positions);
53   
54    /**
55    * Adds the given start/end region to this search result. If sequence already
56    * has a search result and the range is adjacent to already highlighted
57    * positions, they will be merged
58    *
59    * @param sequence
60    * @param start
61    * @param end
62    * @return true if an existing range was updated with this one
63    */
64    boolean appendResult(SequenceI sequence, int start, int end);
65   
66    /**
67    * adds all match results in the argument to this set
68    *
69    * @param toAdd
70    */
71    void addSearchResults(SearchResultsI toAdd);
72   
73    /**
74    * Answers true if the search results include the given sequence (or its
75    * dataset sequence), else false
76    *
77    * @param sequence
78    * @return
79    */
80    boolean involvesSequence(SequenceI sequence);
81   
82    /**
83    * Returns an array of [from, to, from, to..] matched columns (base 0) between
84    * the given start and end columns of the given sequence. Returns null if no
85    * matches overlap the specified region.
86    * <p>
87    * Implementations should provide an optimised method to return locations to
88    * highlight on a visible portion of an alignment.
89    *
90    * @param sequence
91    * @param start
92    * first column of range (base 0, inclusive)
93    * @param end
94    * last column of range base 0, inclusive)
95    * @return int[]
96    */
97    int[] getResults(SequenceI sequence, int start, int end);
98   
99    /**
100    * Returns the number of matches found. Note that if a match straddles ignored
101    * hidden residues, it is counted as one match, although formally recorded as
102    * two (or more) contiguous matched sequence regions
103    *
104    * @return
105    */
106    int getCount();
107   
108    /**
109    * Returns true if no search result matches are held.
110    *
111    * @return
112    */
113    boolean isEmpty();
114   
115    /**
116    * Returns the list of matches.
117    *
118    * @return
119    */
120    List<SearchResultMatchI> getResults();
121   
122    /**
123    * Set bits in a bitfield for all columns in the given sequence collection
124    * that are highlighted
125    *
126    * @param sqcol
127    * the set of sequences to search for highlighted regions
128    * @param bs
129    * bitset to set
130    * @return number of bits set
131    */
132    int markColumns(SequenceCollectionI sqcol, BitSet bs);
133   
134    /**
135    * Return sub-sequences corresponding to distinct contiguous ranges in the
136    * matching set
137    *
138    * @return list of sequence objects
139    */
140    List<SequenceI> getMatchingSubSequences();
141    }