From: Jim Procter Date: Wed, 14 Sep 2022 10:04:50 +0000 (+0100) Subject: JAL-4061 JAL-4062 Find can now search features X-Git-Tag: Release_2_11_4_0~519^2~9 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fae891ea08e5ceb278a0ff91313a2f50cbc017f0;p=jalview.git JAL-4061 JAL-4062 Find can now search features --- diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index f8cfcbf..ee296d7 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -20,26 +20,27 @@ */ package jalview.analysis; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; import java.util.Locale; +import com.stevesoft.pat.Regex; + import jalview.api.AlignViewportI; import jalview.api.FinderI; import jalview.datamodel.AlignmentI; import jalview.datamodel.SearchResultMatchI; import jalview.datamodel.SearchResults; import jalview.datamodel.SearchResultsI; +import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; +import jalview.datamodel.features.SequenceFeaturesI; import jalview.util.Comparison; import jalview.util.MapList; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import com.stevesoft.pat.Regex; - /** * Implements the search algorithm for the Find dialog */ @@ -99,7 +100,8 @@ public class Finder implements FinderI @Override public void findAll(String theSearchString, boolean matchCase, - boolean searchDescription, boolean ignoreHidden) + boolean searchDescription, boolean searchFeatureDesc, + boolean ignoreHidden) { /* * search from the start @@ -107,8 +109,8 @@ public class Finder implements FinderI sequenceIndex = 0; residueIndex = -1; - doFind(theSearchString, matchCase, searchDescription, true, - ignoreHidden); + doFind(theSearchString, matchCase, searchDescription, searchFeatureDesc, + true, ignoreHidden); /* * reset to start for next search @@ -119,10 +121,11 @@ public class Finder implements FinderI @Override public void findNext(String theSearchString, boolean matchCase, - boolean searchDescription, boolean ignoreHidden) + boolean searchDescription, boolean searchFeatureDesc, + boolean ignoreHidden) { - doFind(theSearchString, matchCase, searchDescription, false, - ignoreHidden); + doFind(theSearchString, matchCase, searchDescription, searchFeatureDesc, + false, ignoreHidden); if (searchResults.isEmpty() && idMatches.isEmpty()) { @@ -144,7 +147,8 @@ public class Finder implements FinderI * @param ignoreHidden */ protected void doFind(String theSearchString, boolean matchCase, - boolean searchDescription, boolean findAll, boolean ignoreHidden) + boolean searchDescription, boolean searchFeatureDesc, + boolean findAll, boolean ignoreHidden) { searchResults = new SearchResults(); idMatches = new ArrayList<>(); @@ -169,7 +173,7 @@ public class Finder implements FinderI while ((!found || findAll) && sequenceIndex < end) { found = findNextMatch(searchString, searchPattern, searchDescription, - ignoreHidden); + searchFeatureDesc, ignoreHidden); } } @@ -350,7 +354,8 @@ public class Finder implements FinderI * @return */ protected boolean findNextMatch(String searchString, Regex searchPattern, - boolean matchDescription, boolean ignoreHidden) + boolean matchDescription, boolean matchFeatureDesc, + boolean ignoreHidden) { if (residueIndex < 0) { @@ -380,6 +385,10 @@ public class Finder implements FinderI } else { + if (matchFeatureDesc) + { + matched = searchSequenceFeatures(residueIndex, searchPattern); + } residueIndex = Integer.MAX_VALUE; } } @@ -543,6 +552,34 @@ public class Finder implements FinderI } /** + * Searches for a match with the sequence features, and if found, adds the + * sequence to the list of match ids, (but not as a duplicate). Answers true + * if a match was added, else false. + * + * @param seq + * @param searchPattern + * @return + */ + protected boolean searchSequenceFeatures(int from, Regex searchPattern) + { + boolean matched = false; + SequenceI seq = viewport.getAlignment().getSequenceAt(sequenceIndex); + + SequenceFeaturesI sf = seq.getFeatures(); + for (SequenceFeature feature : sf.getAllFeatures(null)) + { + if (searchPattern.search(feature.type) || (feature.description != null + && searchPattern.search(feature.description))) + { + searchResults.addResult(seq, seq.findIndex(feature.getBegin()), + seq.findIndex(feature.getEnd())); + matched = true; + } + } + return matched; + } + + /** * Searches for a match with the sequence description, and if found, adds the * sequence to the list of match ids (but not as a duplicate). Answers true if * a match was added, else false. diff --git a/src/jalview/api/FinderI.java b/src/jalview/api/FinderI.java index 1d57d81..967bd5c 100644 --- a/src/jalview/api/FinderI.java +++ b/src/jalview/api/FinderI.java @@ -20,11 +20,11 @@ */ package jalview.api; +import java.util.List; + import jalview.datamodel.SearchResultsI; import jalview.datamodel.SequenceI; -import java.util.List; - /** * An interface for searching for a pattern in an aligment */ @@ -49,11 +49,13 @@ public interface FinderI * @param theSearchString * @param caseSensitive * @param searchDescription + * @param searchFeatureDesc * @param ignoreHidden * @return */ void findAll(String theSearchString, boolean caseSensitive, - boolean searchDescription, boolean ignoreHidden); + boolean searchDescription, boolean searchFeatureDesc, + boolean ignoreHidden); /** * Finds the next match for the given search string (interpreted as a regular @@ -71,11 +73,13 @@ public interface FinderI * @param theSearchString * @param caseSensitive * @param searchDescription + * @param searchFeatureDesc * @param ignoreHidden * @return */ void findNext(String theSearchString, boolean caseSensitive, - boolean searchDescription, boolean ignoreHidden); + boolean searchDescription, boolean searchFeatureDesc, + boolean ignoreHidden); /** * Returns the (possibly empty) list of sequences matched on sequence name or diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java index 31c914a..43a12ae 100644 --- a/src/jalview/appletgui/Finder.java +++ b/src/jalview/appletgui/Finder.java @@ -172,12 +172,12 @@ public class Finder extends Panel implements ActionListener if (doFindAll) { finder.findAll(searchString, isCaseSensitive, doSearchDescription, - false); + false, false); } else { finder.findNext(searchString, isCaseSensitive, doSearchDescription, - false); + false, false); } searchResults = finder.getSearchResults(); diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 358d9a4..2de06ec 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -286,16 +286,17 @@ public class Finder extends GFinder boolean isCaseSensitive = caseSensitive.isSelected(); boolean doSearchDescription = searchDescription.isSelected(); + boolean doSearchfeatures = searchFeatures.isSelected(); boolean skipHidden = ignoreHidden.isSelected(); if (doFindAll) { finder.findAll(searchString, isCaseSensitive, doSearchDescription, - skipHidden); + doSearchfeatures, skipHidden); } else { finder.findNext(searchString, isCaseSensitive, doSearchDescription, - skipHidden); + doSearchfeatures, skipHidden); } searchResults = finder.getSearchResults(); diff --git a/src/jalview/jbgui/GFinder.java b/src/jalview/jbgui/GFinder.java index c5488f0..aa79671 100755 --- a/src/jalview/jbgui/GFinder.java +++ b/src/jalview/jbgui/GFinder.java @@ -65,6 +65,8 @@ public class GFinder extends JPanel protected JCheckBox searchDescription; + protected JCheckBox searchFeatures; + protected JCheckBox ignoreHidden; public GFinder() @@ -152,6 +154,10 @@ public class GFinder extends JPanel searchDescription .setText(MessageManager.getString("label.include_description")); + searchFeatures = new JCheckBox(); + searchFeatures + .setText(MessageManager.getString("label.include_features")); + ignoreHidden = new JCheckBox(); ignoreHidden.setText(MessageManager.getString("label.ignore_hidden")); ignoreHidden.setToolTipText( @@ -159,6 +165,7 @@ public class GFinder extends JPanel centrePanel.add(caseSensitive); centrePanel.add(searchDescription); + centrePanel.add(searchFeatures); centrePanel.add(ignoreHidden); /* diff --git a/test/jalview/analysis/FinderTest.java b/test/jalview/analysis/FinderTest.java index 7e3bd86..42225e8 100644 --- a/test/jalview/analysis/FinderTest.java +++ b/test/jalview/analysis/FinderTest.java @@ -24,6 +24,12 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; +import java.util.List; + +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + import jalview.api.AlignViewportI; import jalview.api.FinderI; import jalview.bin.Cache; @@ -40,13 +46,6 @@ import jalview.gui.AlignViewport; import jalview.gui.JvOptionPane; import jalview.io.DataSourceType; import jalview.io.FileLoader; - -import java.util.List; - -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - import junit.extensions.PA; public class FinderTest @@ -100,7 +99,7 @@ public class FinderTest * find next match only */ Finder f = new Finder(av); - f.findNext("E.H", false, false, false); // 'E, any character, H' + f.findNext("E.H", false, false, false, false); // 'E, any character, H' // should match seq2 efH only SearchResultsI sr = f.getSearchResults(); assertEquals(sr.getCount(), 1); @@ -110,7 +109,7 @@ public class FinderTest assertEquals(matches.get(0).getEnd(), 7); f = new Finder(av); - f.findAll("E.H", false, false, false); // 'E, any character, H' + f.findAll("E.H", false, false, false, false); // 'E, any character, H' // should match seq2 efH and seq3 EFH sr = f.getSearchResults(); assertEquals(sr.getCount(), 2); @@ -131,7 +130,7 @@ public class FinderTest * single symbol should find *all* matching symbols */ Finder f = new Finder(av); - f.findAll("M", false, false, false); + f.findAll("M", false, false, false, false); SearchResultsI sr = f.getSearchResults(); assertEquals(sr.getCount(), 5); @@ -148,7 +147,7 @@ public class FinderTest /* * find first match should return seq1 residue 9 */ - f.findNext("9", false, false, false); + f.findNext("9", false, false, false, false); SearchResultsI sr = f.getSearchResults(); assertEquals(sr.getCount(), 1); List matches = sr.getResults(); @@ -163,7 +162,7 @@ public class FinderTest f = new Finder(av); String name = al.getSequenceAt(0).getName(); al.getSequenceAt(0).setName("Q9XA0"); - f.findAll("9", false, false, false); + f.findAll("9", false, false, false, false); sr = f.getSearchResults(); assertEquals(sr.getCount(), 2); matches = sr.getResults(); @@ -179,7 +178,7 @@ public class FinderTest * parsing of search string as integer is strict */ f = new Finder(av); - f.findNext(" 9", false, false, false); + f.findNext(" 9", false, false, false, false); assertTrue(f.getSearchResults().isEmpty()); } @@ -196,7 +195,7 @@ public class FinderTest Finder f = new Finder(av); PA.setValue(f, "sequenceIndex", 1); PA.setValue(f, "residueIndex", -1); - f.findNext("e", false, false, false); // matches id + f.findNext("e", false, false, false, false); // matches id assertTrue(f.getSearchResults().isEmpty()); assertEquals(f.getIdMatches().size(), 1); @@ -208,7 +207,7 @@ public class FinderTest f = new Finder(av); PA.setValue(f, "sequenceIndex", 1); PA.setValue(f, "residueIndex", 0); - f.findNext("e", false, false, false); // matches in sequence + f.findNext("e", false, false, false, false); // matches in sequence assertTrue(f.getIdMatches().isEmpty()); assertEquals(f.getSearchResults().getCount(), 1); List matches = f.getSearchResults().getResults(); @@ -224,7 +223,7 @@ public class FinderTest f = new Finder(av); PA.setValue(f, "sequenceIndex", 1); PA.setValue(f, "residueIndex", 7); - f.findNext("e", false, false, false); + f.findNext("e", false, false, false, false); assertEquals(f.getIdMatches().size(), 1); assertSame(f.getIdMatches().get(0), al.getSequenceAt(2)); assertTrue(f.getSearchResults().isEmpty()); @@ -246,7 +245,7 @@ public class FinderTest * find first match only */ Finder f = new Finder(av2); - f.findNext("rAF", false, true, false); + f.findNext("rAF", false, true, false, false); assertEquals(f.getIdMatches().size(), 1); assertSame(f.getIdMatches().get(0), al2.getSequenceAt(0)); assertTrue(f.getSearchResults().isEmpty()); @@ -255,7 +254,7 @@ public class FinderTest * find all matches */ f = new Finder(av2); - f.findAll("rAF", false, true, false); + f.findAll("rAF", false, true, false, false); assertEquals(f.getIdMatches().size(), 2); assertSame(f.getIdMatches().get(0), al2.getSequenceAt(0)); assertSame(f.getIdMatches().get(1), al2.getSequenceAt(1)); @@ -265,7 +264,7 @@ public class FinderTest * case sensitive */ f = new Finder(av2); - f.findAll("RAF", true, true, false); + f.findAll("RAF", true, true, false, false); assertEquals(f.getIdMatches().size(), 1); assertSame(f.getIdMatches().get(0), al2.getSequenceAt(0)); assertTrue(f.getSearchResults().isEmpty()); @@ -281,7 +280,7 @@ public class FinderTest /* * sequence matches should have no duplicates */ - f.findAll("EFH", false, true, false); + f.findAll("EFH", false, true, false, false); assertEquals(f.getIdMatches().size(), 2); assertSame(f.getIdMatches().get(0), al2.getSequenceAt(0)); assertSame(f.getIdMatches().get(1), al2.getSequenceAt(1)); @@ -309,7 +308,7 @@ public class FinderTest * case insensitive; seq1 occurs twice in sequence id but * only one match should be returned */ - f.findAll("SEQ1", false, false, false); + f.findAll("SEQ1", false, false, false, false); assertEquals(f.getIdMatches().size(), 1); assertSame(f.getIdMatches().get(0), al.getSequenceAt(0)); SearchResultsI searchResults = f.getSearchResults(); @@ -319,7 +318,7 @@ public class FinderTest * case sensitive */ f = new Finder(av); - f.findAll("SEQ1", true, false, false); + f.findAll("SEQ1", true, false, false, false); searchResults = f.getSearchResults(); assertTrue(searchResults.isEmpty()); @@ -330,7 +329,7 @@ public class FinderTest AlignViewportI av2 = new AlignViewport(al2); al2.addSequence(new Sequence("aBz", "xyzabZpqrAbZ")); f = new Finder(av2); - f.findAll("ABZ", false, false, false); + f.findAll("ABZ", false, false, false, false); assertEquals(f.getIdMatches().size(), 1); assertSame(f.getIdMatches().get(0), al2.getSequenceAt(4)); searchResults = f.getSearchResults(); @@ -359,7 +358,7 @@ public class FinderTest * efh should be matched in seq2 only */ FinderI f = new Finder(av); - f.findNext("EfH", false, false, false); + f.findNext("EfH", false, false, false, false); SearchResultsI searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); SearchResultMatchI match = searchResults.getResults().get(0); @@ -371,7 +370,7 @@ public class FinderTest * I should be found in seq1 (twice) and seq2 (once) */ f = new Finder(av); - f.findNext("I", false, false, false); // find next: seq1/16 + f.findNext("I", false, false, false, false); // find next: seq1/16 searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); match = searchResults.getResults().get(0); @@ -379,7 +378,7 @@ public class FinderTest assertEquals(match.getStart(), 16); assertEquals(match.getEnd(), 16); - f.findNext("I", false, false, false); // find next: seq1/18 + f.findNext("I", false, false, false, false); // find next: seq1/18 searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); match = searchResults.getResults().get(0); @@ -387,7 +386,7 @@ public class FinderTest assertEquals(match.getStart(), 18); assertEquals(match.getEnd(), 18); - f.findNext("I", false, false, false); // find next: seq2/8 + f.findNext("I", false, false, false, false); // find next: seq2/8 searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); match = searchResults.getResults().get(0); @@ -395,13 +394,13 @@ public class FinderTest assertEquals(match.getStart(), 8); assertEquals(match.getEnd(), 8); - f.findNext("I", false, false, false); + f.findNext("I", false, false, false, false); assertTrue(f.getSearchResults().isEmpty()); /* * find should reset to start of alignment after a failed search */ - f.findNext("I", false, false, false); // find next: seq1/16 + f.findNext("I", false, false, false, false); // find next: seq1/16 searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); match = searchResults.getResults().get(0); @@ -418,7 +417,7 @@ public class FinderTest public void testFindAll_maximalResultOnly() { Finder f = new Finder(av); - f.findAll("M+", false, false, false); + f.findAll("M+", false, false, false, false); SearchResultsI searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); SearchResultMatchI match = searchResults.getResults().get(0); @@ -434,7 +433,7 @@ public class FinderTest public void testFindAll() { Finder f = new Finder(av); - f.findAll("EfH", false, false, false); + f.findAll("EfH", false, false, false, false); SearchResultsI searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 2); SearchResultMatchI match = searchResults.getResults().get(0); @@ -449,7 +448,7 @@ public class FinderTest /* * find all I should find 2 positions in seq1, 1 in seq2 */ - f.findAll("I", false, false, false); + f.findAll("I", false, false, false, false); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 3); match = searchResults.getResults().get(0); @@ -477,7 +476,7 @@ public class FinderTest /* * BC should match seq1/9-10 and seq2/2-3 */ - f.findAll("BC", true, false, false); + f.findAll("BC", true, false, false, false); SearchResultsI searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 2); SearchResultMatchI match = searchResults.getResults().get(0); @@ -493,7 +492,7 @@ public class FinderTest * bc should match seq3/1-2 */ f = new Finder(av); - f.findAll("bc", true, false, false); + f.findAll("bc", true, false, false, false); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); match = searchResults.getResults().get(0); @@ -501,7 +500,7 @@ public class FinderTest assertEquals(match.getStart(), 1); assertEquals(match.getEnd(), 2); - f.findAll("bC", true, false, false); + f.findAll("bC", true, false, false, false); assertTrue(f.getSearchResults().isEmpty()); } @@ -524,7 +523,7 @@ public class FinderTest av.setSelectionGroup(sg); FinderI f = new Finder(av); - f.findNext("b", false, false, false); + f.findNext("b", false, false, false, false); assertTrue(f.getIdMatches().isEmpty()); SearchResultsI searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); @@ -536,12 +535,12 @@ public class FinderTest /* * a second Find should not return the 'b' in seq3 as outside the selection */ - f.findNext("b", false, false, false); + f.findNext("b", false, false, false, false); assertTrue(f.getSearchResults().isEmpty()); assertTrue(f.getIdMatches().isEmpty()); f = new Finder(av); - f.findNext("d", false, false, false); + f.findNext("d", false, false, false, false); assertTrue(f.getIdMatches().isEmpty()); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); @@ -549,7 +548,7 @@ public class FinderTest assertSame(match.getSequence(), al.getSequenceAt(1)); assertEquals(match.getStart(), 4); assertEquals(match.getEnd(), 4); - f.findNext("d", false, false, false); + f.findNext("d", false, false, false, false); assertTrue(f.getIdMatches().isEmpty()); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); @@ -581,7 +580,7 @@ public class FinderTest * search for 'e' should match two sequence ids and one residue */ Finder f = new Finder(av); - f.findAll("e", false, false, false); + f.findAll("e", false, false, false, false); assertEquals(f.getIdMatches().size(), 2); assertSame(f.getIdMatches().get(0), al.getSequenceAt(1)); assertSame(f.getIdMatches().get(1), al.getSequenceAt(2)); @@ -596,7 +595,7 @@ public class FinderTest * search for 'Q' should match two sequence ids only */ f = new Finder(av); - f.findAll("Q", false, false, false); + f.findAll("Q", false, false, false, false); assertEquals(f.getIdMatches().size(), 2); assertSame(f.getIdMatches().get(0), al.getSequenceAt(1)); assertSame(f.getIdMatches().get(1), al.getSequenceAt(2)); @@ -627,7 +626,7 @@ public class FinderTest * search for 'I' should match two sequence positions */ Finder f = new Finder(av); - f.findAll("I", false, false, false); + f.findAll("I", false, false, false, false); assertTrue(f.getIdMatches().isEmpty()); SearchResultsI searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 2); @@ -664,7 +663,7 @@ public class FinderTest hc.hideColumns(3, 3); al.setHiddenColumns(hc); Finder f = new Finder(av); - f.findAll("aaa", false, false, false); + f.findAll("aaa", false, false, false, false); SearchResultsI searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 2); SearchResultMatchI match = searchResults.getResults().get(0); @@ -686,7 +685,7 @@ public class FinderTest * find the visible D in seq2 */ f = new Finder(av); - f.findAll("D", false, false, false); + f.findAll("D", false, false, false, false); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); match = searchResults.getResults().get(0); @@ -699,7 +698,7 @@ public class FinderTest * consecutive in the visible columns */ f = new Finder(av); - f.findAll("AD", false, false, false); + f.findAll("AD", false, false, false, false); searchResults = f.getSearchResults(); assertTrue(searchResults.isEmpty()); @@ -708,7 +707,7 @@ public class FinderTest * (first run includes hidden gaps) */ f = new Finder(av); - f.findAll("aaa", false, false, false); + f.findAll("aaa", false, false, false, false); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 2); match = searchResults.getResults().get(0); @@ -727,7 +726,7 @@ public class FinderTest */ hc.hideColumns(2, 5); f = new Finder(av); - f.findAll("aaa", false, false, false); + f.findAll("aaa", false, false, false, false); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 2); match = searchResults.getResults().get(0); @@ -742,7 +741,7 @@ public class FinderTest /* * find all 'BE' should not match across hidden columns in seq1 */ - f.findAll("BE", false, false, false); + f.findAll("BE", false, false, false, false); assertTrue(f.getSearchResults().isEmpty()); /* @@ -752,7 +751,7 @@ public class FinderTest hc.revealAllHiddenColumns(new ColumnSelection()); hc.hideColumns(8, 13); f = new Finder(av); - f.findNext("H", false, false, false); + f.findNext("H", false, false, false, false); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); match = searchResults.getResults().get(0); @@ -795,7 +794,7 @@ public class FinderTest * should match seq2/1, seq2/7, not seq3/6 */ Finder f = new Finder(av); - f.findAll("[AH]", false, false, false); + f.findAll("[AH]", false, false, false, false); SearchResultsI searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 2); SearchResultMatchI match = searchResults.getResults().get(0); @@ -832,7 +831,7 @@ public class FinderTest * aaaMMMMaaa */ Finder f = new Finder(av); - f.findAll("abe", false, false, true); // true = ignore hidden + f.findAll("abe", false, false, false, true); // true = ignore hidden SearchResultsI searchResults = f.getSearchResults(); /* @@ -851,7 +850,7 @@ public class FinderTest assertEquals(match.getEnd(), 12); f = new Finder(av); - f.findNext("a.E", false, false, true); + f.findNext("a.E", false, false, false, true); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); assertEquals(searchResults.getResults().size(), 2); @@ -864,7 +863,7 @@ public class FinderTest assertEquals(match.getStart(), 12); // E assertEquals(match.getEnd(), 12); - f.findNext("a.E", false, false, true); + f.findNext("a.E", false, false, false, true); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); assertEquals(searchResults.getResults().size(), 2); @@ -881,7 +880,7 @@ public class FinderTest * find all matching across two hidden column regions * note one 'match' is returned as three contiguous matches */ - f.findAll("BEG", false, false, true); + f.findAll("BEG", false, false, false, true); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); assertEquals(searchResults.getResults().size(), 3); @@ -908,7 +907,7 @@ public class FinderTest selection.setEndRes(9); al.getSequences().forEach(seq -> selection.addSequence(seq, false)); av.setSelectionGroup(selection); - f.findAll("A.*H", false, false, true); + f.findAll("A.*H", false, false, false, true); searchResults = f.getSearchResults(); assertEquals(searchResults.getCount(), 1); assertEquals(searchResults.getResults().size(), 3); diff --git a/test/jalview/controller/AlignViewControllerTest.java b/test/jalview/controller/AlignViewControllerTest.java index ca3b55c..e8e0bb1 100644 --- a/test/jalview/controller/AlignViewControllerTest.java +++ b/test/jalview/controller/AlignViewControllerTest.java @@ -23,6 +23,13 @@ package jalview.controller; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; +import java.awt.Color; +import java.util.Arrays; +import java.util.BitSet; + +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + import jalview.analysis.Finder; import jalview.api.AlignViewControllerI; import jalview.api.FeatureColourI; @@ -40,13 +47,6 @@ import jalview.io.DataSourceType; import jalview.io.FileLoader; import jalview.schemes.FeatureColour; -import java.awt.Color; -import java.util.Arrays; -import java.util.BitSet; - -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - public class AlignViewControllerTest { @@ -226,7 +226,7 @@ public class AlignViewControllerTest * test Match/Find works first */ FinderI f = new Finder(af.getViewport()); - f.findAll("M+", true, false, false); + f.findAll("M+", true, false, false, false); assertEquals( "Finder found different set of results to manually created SearchResults", sr, f.getSearchResults());