From: Jim Procter Date: Fri, 14 Sep 2018 11:38:41 +0000 (+0100) Subject: JAL-345 also include any sequences that have highlighted regions X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a14b9e1a4dd98235f72acfbcffa71554a4fceaeb;p=jalview.git JAL-345 also include any sequences that have highlighted regions --- diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index 13b84ef..e9205f6 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -29,6 +29,7 @@ import jalview.api.FeatureRenderer; import jalview.commands.OrderCommand; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SearchResultsI; import jalview.datamodel.SequenceCollectionI; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; @@ -410,19 +411,37 @@ public class AlignViewController implements AlignViewControllerI ? viewport.getSelectionGroup() : new SequenceGroup(); + SearchResultsI searchResults = viewport.getSearchResults(); if (invert) { List nothighlighted = new ArrayList(); for (SequenceI seq : alignPanel.getAlignViewport().getAlignment() .getSequences()) { - if (!results.contains(seq)) + if (!results.contains(seq) && (searchResults == null + || !searchResults.involvesSequence(seq))) { nothighlighted.add(seq); } } results = nothighlighted; } + else + { + // copy list and add in search results + results = new ArrayList(results); + if (searchResults != null) + { + for (SequenceI seq : alignPanel.getAlignViewport().getAlignment() + .getSequences()) + { + if (searchResults.involvesSequence(seq)) + { + results.add(seq); + } + } + } + } if (results == null || results.size() == 0) {