From a14b9e1a4dd98235f72acfbcffa71554a4fceaeb Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 14 Sep 2018 12:38:41 +0100 Subject: [PATCH] JAL-345 also include any sequences that have highlighted regions --- src/jalview/controller/AlignViewController.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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) { -- 1.7.10.2