From b55dff11e4b566dcaa3a219c463f09afb65cf92d Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 26 Sep 2019 16:25:16 +0100 Subject: [PATCH] JAL-3070 JAL-3066 JAL-2808 allow feature filter definition via FeatureSettingsModelI --- src/jalview/api/FeatureSettingsModelI.java | 11 +++++++++++ src/jalview/gui/AlignViewport.java | 9 +++++++++ src/jalview/schemes/FeatureSettingsAdapter.java | 7 +++++++ 3 files changed, 27 insertions(+) diff --git a/src/jalview/api/FeatureSettingsModelI.java b/src/jalview/api/FeatureSettingsModelI.java index c0fc523..5e910dc 100644 --- a/src/jalview/api/FeatureSettingsModelI.java +++ b/src/jalview/api/FeatureSettingsModelI.java @@ -20,6 +20,8 @@ */ package jalview.api; +import jalview.datamodel.features.FeatureMatcherSetI; + import java.util.Comparator; /** @@ -60,6 +62,15 @@ public interface FeatureSettingsModelI extends Comparator FeatureColourI getFeatureColour(String type); /** + * Returns any filters defined for the feature type, or null if not known + * + * @param type + * @return + */ + + FeatureMatcherSetI getFeatureFilters(String type); + + /** * Returns the transparency value, from 0 (fully transparent) to 1 (fully * opaque) * diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index d6e2ae5..e60b76f 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -39,6 +39,7 @@ import jalview.datamodel.SearchResults; import jalview.datamodel.SearchResultsI; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; +import jalview.datamodel.features.FeatureMatcherSetI; import jalview.renderer.ResidueShader; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; @@ -1053,6 +1054,9 @@ public void setNormaliseSequenceLogo(boolean state) { FeatureColourI preferredColour = featureSettings .getFeatureColour(type); + FeatureMatcherSetI preferredFilters = featureSettings + .getFeatureFilters(type); + FeatureColourI origColour = fr.getFeatureStyle(type); if (!mergeOnly || (!origRenderOrder.contains(type) || origColour == null @@ -1067,6 +1071,11 @@ public void setNormaliseSequenceLogo(boolean state) { fr.setColour(type, preferredColour); } + if (preferredFilters != null + && (!mergeOnly || fr.getFeatureFilter(type) != null)) + { + fr.setFeatureFilter(type, preferredFilters); + } if (featureSettings.isFeatureDisplayed(type)) { displayed.setVisible(type); diff --git a/src/jalview/schemes/FeatureSettingsAdapter.java b/src/jalview/schemes/FeatureSettingsAdapter.java index b15e4cf..3d82f9b 100644 --- a/src/jalview/schemes/FeatureSettingsAdapter.java +++ b/src/jalview/schemes/FeatureSettingsAdapter.java @@ -22,6 +22,7 @@ package jalview.schemes; import jalview.api.FeatureColourI; import jalview.api.FeatureSettingsModelI; +import jalview.datamodel.features.FeatureMatcherSetI; /** * An adapter class that may be extended to instantiate feature colour schemes @@ -65,4 +66,10 @@ public class FeatureSettingsAdapter implements FeatureSettingsModelI return false; } + @Override + public FeatureMatcherSetI getFeatureFilters(String type) + { + return null; + } + } -- 1.7.10.2