2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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.
21 package jalview.viewmodel.seqfeatures;
23 import jalview.api.AlignViewportI;
24 import jalview.api.FeatureColourI;
25 import jalview.api.FeaturesDisplayedI;
26 import jalview.datamodel.AlignmentI;
27 import jalview.datamodel.SequenceFeature;
28 import jalview.datamodel.SequenceI;
29 import jalview.datamodel.features.FeatureMatcherSetI;
30 import jalview.datamodel.features.SequenceFeatures;
31 import jalview.renderer.seqfeatures.FeatureRenderer;
32 import jalview.schemes.FeatureColour;
33 import jalview.util.ColorUtils;
35 import java.awt.Color;
36 import java.beans.PropertyChangeListener;
37 import java.beans.PropertyChangeSupport;
38 import java.util.ArrayList;
39 import java.util.Arrays;
40 import java.util.HashMap;
41 import java.util.HashSet;
42 import java.util.Hashtable;
43 import java.util.Iterator;
44 import java.util.List;
47 import java.util.concurrent.ConcurrentHashMap;
49 public abstract class FeatureRendererModel
50 implements jalview.api.FeatureRenderer
53 * a data bean to hold one row of feature settings from the gui
55 public static class FeatureSettingsBean
57 public final String featureType;
59 public final FeatureColourI featureColour;
61 public final FeatureMatcherSetI filter;
63 public final Boolean show;
65 public FeatureSettingsBean(String type, FeatureColourI colour,
66 FeatureMatcherSetI theFilter, Boolean isShown)
69 featureColour = colour;
76 * global transparency for feature
78 protected float transparency = 1.0f;
81 * colour scheme for each feature type
83 protected Map<String, FeatureColourI> featureColours = new ConcurrentHashMap<>();
86 * visibility flag for each feature group
88 protected Map<String, Boolean> featureGroups = new ConcurrentHashMap<>();
91 * filters for each feature type
93 protected Map<String, FeatureMatcherSetI> featureFilters = new HashMap<>();
95 protected String[] renderOrder;
97 Map<String, Float> featureOrder = null;
99 protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
102 protected AlignViewportI av;
105 public AlignViewportI getViewport()
110 public FeatureRendererSettings getSettings()
112 return new FeatureRendererSettings(this);
115 public void transferSettings(FeatureRendererSettings fr)
117 this.renderOrder = fr.renderOrder;
118 this.featureGroups = fr.featureGroups;
119 this.featureColours = fr.featureColours;
120 this.transparency = fr.transparency;
121 this.featureOrder = fr.featureOrder;
125 * update from another feature renderer
130 public void transferSettings(jalview.api.FeatureRenderer _fr)
132 FeatureRenderer fr = (FeatureRenderer) _fr;
133 FeatureRendererSettings frs = new FeatureRendererSettings(fr);
134 this.renderOrder = frs.renderOrder;
135 this.featureGroups = frs.featureGroups;
136 this.featureColours = frs.featureColours;
137 this.featureFilters = frs.featureFilters;
138 this.transparency = frs.transparency;
139 this.featureOrder = frs.featureOrder;
140 if (av != null && av != fr.getViewport())
142 // copy over the displayed feature settings
143 if (_fr.getFeaturesDisplayed() != null)
145 FeaturesDisplayedI fd = getFeaturesDisplayed();
148 setFeaturesDisplayedFrom(_fr.getFeaturesDisplayed());
155 for (String type : _fr.getFeaturesDisplayed()
156 .getVisibleFeatures())
166 public void setFeaturesDisplayedFrom(FeaturesDisplayedI featuresDisplayed)
168 av.setFeaturesDisplayed(new FeaturesDisplayed(featuresDisplayed));
172 public void setVisible(String featureType)
174 FeaturesDisplayedI fdi = av.getFeaturesDisplayed();
177 av.setFeaturesDisplayed(fdi = new FeaturesDisplayed());
179 if (!fdi.isRegistered(featureType))
181 pushFeatureType(Arrays.asList(new String[] { featureType }));
183 fdi.setVisible(featureType);
187 public void setAllVisible(List<String> featureTypes)
189 FeaturesDisplayedI fdi = av.getFeaturesDisplayed();
192 av.setFeaturesDisplayed(fdi = new FeaturesDisplayed());
194 List<String> nft = new ArrayList<>();
195 for (String featureType : featureTypes)
197 if (!fdi.isRegistered(featureType))
199 nft.add(featureType);
204 pushFeatureType(nft);
206 fdi.setAllVisible(featureTypes);
210 * push a set of new types onto the render order stack. Note - this is a
211 * direct mechanism rather than the one employed in updateRenderOrder
215 private void pushFeatureType(List<String> types)
218 int ts = types.size();
219 String neworder[] = new String[(renderOrder == null ? 0
220 : renderOrder.length) + ts];
221 types.toArray(neworder);
222 if (renderOrder != null)
224 System.arraycopy(neworder, 0, neworder, renderOrder.length, ts);
225 System.arraycopy(renderOrder, 0, neworder, 0, renderOrder.length);
227 renderOrder = neworder;
230 protected Map<String, float[][]> minmax = new Hashtable<>();
232 public Map<String, float[][]> getMinMax()
238 * normalise a score against the max/min bounds for the feature type.
240 * @param sequenceFeature
241 * @return byte[] { signed, normalised signed (-127 to 127) or unsigned
244 protected final byte[] normaliseScore(SequenceFeature sequenceFeature)
246 float[] mm = minmax.get(sequenceFeature.type)[0];
247 final byte[] r = new byte[] { 0, (byte) 255 };
250 if (r[0] != 0 || mm[0] < 0.0)
253 r[1] = (byte) ((int) 128.0
254 + 127.0 * (sequenceFeature.score / mm[1]));
258 r[1] = (byte) ((int) 255.0 * (sequenceFeature.score / mm[1]));
264 boolean newFeatureAdded = false;
266 boolean findingFeatures = false;
268 protected boolean updateFeatures()
270 if (av.getFeaturesDisplayed() == null || renderOrder == null
274 if (av.getFeaturesDisplayed().getVisibleFeatureCount() < 1)
279 // TODO: decide if we should check for the visible feature count first
284 * search the alignment for all new features, give them a colour and display
285 * them. Then fires a PropertyChangeEvent on the changeSupport object.
288 protected void findAllFeatures()
290 synchronized (firing)
292 if (firing.equals(Boolean.FALSE))
294 firing = Boolean.TRUE;
295 findAllFeatures(true); // add all new features as visible
296 changeSupport.firePropertyChange("changeSupport", null, null);
297 firing = Boolean.FALSE;
303 public List<SequenceFeature> findFeaturesAtColumn(SequenceI sequence, int column)
306 * include features at the position provided their feature type is
307 * displayed, and feature group is null or marked for display
309 List<SequenceFeature> result = new ArrayList<>();
310 if (!av.areFeaturesDisplayed() || getFeaturesDisplayed() == null)
315 Set<String> visibleFeatures = getFeaturesDisplayed()
316 .getVisibleFeatures();
317 String[] visibleTypes = visibleFeatures
318 .toArray(new String[visibleFeatures.size()]);
319 List<SequenceFeature> features = sequence.findFeatures(column, column,
323 * include features unless their feature group is not displayed, or
324 * they are hidden (have no colour) based on a filter or colour threshold
326 for (SequenceFeature sf : features)
328 if (!featureGroupNotShown(sf) && getColour(sf) != null)
337 * Searches alignment for all features and updates colours
339 * @param newMadeVisible
340 * if true newly added feature types will be rendered immediately
341 * TODO: check to see if this method should actually be proxied so
342 * repaint events can be propagated by the renderer code
345 public synchronized void findAllFeatures(boolean newMadeVisible)
347 newFeatureAdded = false;
351 newFeatureAdded = true;
355 findingFeatures = true;
356 if (av.getFeaturesDisplayed() == null)
358 av.setFeaturesDisplayed(new FeaturesDisplayed());
360 FeaturesDisplayedI featuresDisplayed = av.getFeaturesDisplayed();
362 Set<String> oldfeatures = new HashSet<>();
363 if (renderOrder != null)
365 for (int i = 0; i < renderOrder.length; i++)
367 if (renderOrder[i] != null)
369 oldfeatures.add(renderOrder[i]);
374 AlignmentI alignment = av.getAlignment();
375 List<String> allfeatures = new ArrayList<>();
377 for (int i = 0; i < alignment.getHeight(); i++)
379 SequenceI asq = alignment.getSequenceAt(i);
380 for (String group : asq.getFeatures().getFeatureGroups(true))
382 boolean groupDisplayed = true;
385 if (featureGroups.containsKey(group))
387 groupDisplayed = featureGroups.get(group);
391 groupDisplayed = newMadeVisible;
392 featureGroups.put(group, groupDisplayed);
397 Set<String> types = asq.getFeatures().getFeatureTypesForGroups(
399 for (String type : types)
401 if (!allfeatures.contains(type)) // or use HashSet and no test?
403 allfeatures.add(type);
405 updateMinMax(asq, type, true); // todo: for all features?
411 // uncomment to add new features in alphebetical order (but JAL-2575)
412 // Collections.sort(allfeatures, String.CASE_INSENSITIVE_ORDER);
415 for (String type : allfeatures)
417 if (!oldfeatures.contains(type))
419 featuresDisplayed.setVisible(type);
425 updateRenderOrder(allfeatures);
426 findingFeatures = false;
430 * Updates the global (alignment) min and max values for a feature type from
431 * the score for a sequence, if the score is not NaN. Values are stored
432 * separately for positional and non-positional features.
438 protected void updateMinMax(SequenceI seq, String featureType,
441 float min = seq.getFeatures().getMinimumScore(featureType, positional);
442 if (Float.isNaN(min))
447 float max = seq.getFeatures().getMaximumScore(featureType, positional);
451 * { {positionalMin, positionalMax}, {nonPositionalMin, nonPositionalMax} }
455 minmax = new Hashtable<>();
457 synchronized (minmax)
459 float[][] mm = minmax.get(featureType);
460 int index = positional ? 0 : 1;
463 mm = new float[][] { null, null };
464 minmax.put(featureType, mm);
466 if (mm[index] == null)
468 mm[index] = new float[] { min, max };
472 mm[index][0] = Math.min(mm[index][0], min);
473 mm[index][1] = Math.max(mm[index][1], max);
477 protected Boolean firing = Boolean.FALSE;
480 * replaces the current renderOrder with the unordered features in
481 * allfeatures. The ordering of any types in both renderOrder and allfeatures
482 * is preserved, and all new feature types are rendered on top of the existing
483 * types, in the order given by getOrder or the order given in allFeatures.
484 * Note. this operates directly on the featureOrder hash for efficiency. TODO:
485 * eliminate the float storage for computing/recalling the persistent ordering
486 * New Cability: updates min/max for colourscheme range if its dynamic
490 private void updateRenderOrder(List<String> allFeatures)
492 List<String> allfeatures = new ArrayList<>(allFeatures);
493 String[] oldRender = renderOrder;
494 renderOrder = new String[allfeatures.size()];
495 boolean initOrders = (featureOrder == null);
497 if (oldRender != null && oldRender.length > 0)
499 for (int j = 0; j < oldRender.length; j++)
501 if (oldRender[j] != null)
505 setOrder(oldRender[j],
506 (1 - (1 + (float) j) / oldRender.length));
508 if (allfeatures.contains(oldRender[j]))
510 renderOrder[opos++] = oldRender[j]; // existing features always
511 // appear below new features
512 allfeatures.remove(oldRender[j]);
515 float[][] mmrange = minmax.get(oldRender[j]);
518 FeatureColourI fc = featureColours.get(oldRender[j]);
519 if (fc != null && !fc.isSimpleColour() && fc.isAutoScaled()
520 && !fc.isColourByAttribute())
522 fc.updateBounds(mmrange[0][0], mmrange[0][1]);
530 if (allfeatures.size() == 0)
532 // no new features - leave order unchanged.
535 int i = allfeatures.size() - 1;
537 boolean sort = false;
538 String[] newf = new String[allfeatures.size()];
539 float[] sortOrder = new float[allfeatures.size()];
540 for (String newfeat : allfeatures)
545 // update from new features minmax if necessary
546 float[][] mmrange = minmax.get(newf[i]);
549 FeatureColourI fc = featureColours.get(newf[i]);
550 if (fc != null && !fc.isSimpleColour() && fc.isAutoScaled()
551 && !fc.isColourByAttribute())
553 fc.updateBounds(mmrange[0][0], mmrange[0][1]);
557 if (initOrders || !featureOrder.containsKey(newf[i]))
559 int denom = initOrders ? allfeatures.size() : featureOrder.size();
560 // new unordered feature - compute persistent ordering at head of
561 // existing features.
562 setOrder(newf[i], i / (float) denom);
564 // set order from newly found feature from persisted ordering.
565 sortOrder[i] = 2 - featureOrder.get(newf[i]).floatValue();
568 // only sort if we need to
569 sort = sort || sortOrder[i] > sortOrder[i + 1];
573 if (iSize > 1 && sort)
575 jalview.util.QuickSort.sort(sortOrder, newf);
578 System.arraycopy(newf, 0, renderOrder, opos, newf.length);
582 * get a feature style object for the given type string. Creates a
583 * java.awt.Color for a featureType with no existing colourscheme.
589 public FeatureColourI getFeatureStyle(String featureType)
591 FeatureColourI fc = featureColours.get(featureType);
594 Color col = ColorUtils.createColourFromName(featureType);
595 fc = new FeatureColour(col);
596 featureColours.put(featureType, fc);
602 public Color getColour(SequenceFeature feature)
604 FeatureColourI fc = getFeatureStyle(feature.getType());
605 return getColor(feature, fc);
609 * Answers true if the feature type is currently selected to be displayed,
615 protected boolean showFeatureOfType(String type)
617 return type == null ? false : (av.getFeaturesDisplayed() == null ? true
618 : av.getFeaturesDisplayed().isVisible(type));
622 public void setColour(String featureType, FeatureColourI col)
624 featureColours.put(featureType, col);
628 public void setTransparency(float value)
630 transparency = value;
634 public float getTransparency()
640 * analogous to colour - store a normalized ordering for all feature types in
641 * this rendering context.
644 * Feature type string
646 * normalized priority - 0 means always appears on top, 1 means
649 public float setOrder(String type, float position)
651 if (featureOrder == null)
653 featureOrder = new Hashtable<>();
655 featureOrder.put(type, Float.valueOf(position));
660 * get the global priority (0 (top) to 1 (bottom))
663 * @return [0,1] or -1 for a type without a priority
665 public float getOrder(String type)
667 if (featureOrder != null)
669 if (featureOrder.containsKey(type))
671 return featureOrder.get(type).floatValue();
678 public Map<String, FeatureColourI> getFeatureColours()
680 return featureColours;
684 * Replace current ordering with new ordering
687 * an array of { Type, Colour, Filter, Boolean }
688 * @return true if any visible features have been reordered, else false
690 public boolean setFeaturePriority(FeatureSettingsBean[] data)
692 return setFeaturePriority(data, true);
696 * Sets the priority order for features, with the highest priority (displayed on
697 * top) at the start of the data array
700 * an array of { Type, Colour, Filter, Boolean }
702 * when true current featureDisplay list will be cleared
703 * @return true if any visible features have been reordered or recoloured, else
704 * false (i.e. no need to repaint)
706 public boolean setFeaturePriority(FeatureSettingsBean[] data,
710 * note visible feature ordering and colours before update
712 List<String> visibleFeatures = getDisplayedFeatureTypes();
713 Map<String, FeatureColourI> visibleColours = new HashMap<>(
714 getFeatureColours());
716 FeaturesDisplayedI av_featuresdisplayed = null;
719 if ((av_featuresdisplayed = av.getFeaturesDisplayed()) != null)
721 av.getFeaturesDisplayed().clear();
725 av.setFeaturesDisplayed(
726 av_featuresdisplayed = new FeaturesDisplayed());
731 av_featuresdisplayed = av.getFeaturesDisplayed();
737 // The feature table will display high priority
738 // features at the top, but these are the ones
739 // we need to render last, so invert the data
740 renderOrder = new String[data.length];
744 for (int i = 0; i < data.length; i++)
746 String type = data[i].featureType;
747 setColour(type, data[i].featureColour);
750 av_featuresdisplayed.setVisible(type);
753 renderOrder[data.length - i - 1] = type;
758 * get the new visible ordering and return true if it has changed
759 * order or any colour has changed
761 List<String> reorderedVisibleFeatures = getDisplayedFeatureTypes();
762 if (!visibleFeatures.equals(reorderedVisibleFeatures))
765 * the list of ordered visible features has changed
771 * return true if any feature colour has changed
773 for (String feature : visibleFeatures)
775 if (visibleColours.get(feature) != getFeatureStyle(feature))
785 * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
787 public void addPropertyChangeListener(PropertyChangeListener listener)
789 changeSupport.addPropertyChangeListener(listener);
794 * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
796 public void removePropertyChangeListener(PropertyChangeListener listener)
798 changeSupport.removePropertyChangeListener(listener);
801 public Set<String> getAllFeatureColours()
803 return featureColours.keySet();
806 public void clearRenderOrder()
811 public boolean hasRenderOrder()
813 return renderOrder != null;
817 * Returns feature types in ordering of rendering, where last means on top
819 public List<String> getRenderOrder()
821 if (renderOrder == null)
823 return Arrays.asList(new String[] {});
825 return Arrays.asList(renderOrder);
828 public int getFeatureGroupsSize()
830 return featureGroups != null ? 0 : featureGroups.size();
834 public List<String> getFeatureGroups()
836 // conflict between applet and desktop - featureGroups returns the map in
837 // the desktop featureRenderer
838 return (featureGroups == null) ? Arrays.asList(new String[0])
839 : Arrays.asList(featureGroups.keySet().toArray(new String[0]));
842 public boolean checkGroupVisibility(String group,
843 boolean newGroupsVisible)
845 if (featureGroups == null)
847 // then an exception happens next..
849 if (featureGroups.containsKey(group))
851 return featureGroups.get(group).booleanValue();
853 if (newGroupsVisible)
855 featureGroups.put(group, Boolean.valueOf(true));
862 * get visible or invisible groups
865 * true to return visible groups, false to return hidden ones.
866 * @return list of groups
869 public List<String> getGroups(boolean visible)
871 if (featureGroups != null)
873 List<String> gp = new ArrayList<>();
875 for (String grp : featureGroups.keySet())
877 Boolean state = featureGroups.get(grp);
878 if (state.booleanValue() == visible)
889 public void setGroupVisibility(String group, boolean visible)
891 featureGroups.put(group, Boolean.valueOf(visible));
895 public void setGroupVisibility(List<String> toset, boolean visible)
897 if (toset != null && toset.size() > 0 && featureGroups != null)
899 boolean rdrw = false;
900 for (String gst : toset)
902 Boolean st = featureGroups.get(gst);
903 featureGroups.put(gst, Boolean.valueOf(visible));
906 rdrw = rdrw || (visible != st.booleanValue());
911 // set local flag indicating redraw needed ?
917 public Map<String, FeatureColourI> getDisplayedFeatureCols()
919 Map<String, FeatureColourI> fcols = new Hashtable<>();
920 if (getViewport().getFeaturesDisplayed() == null)
924 Set<String> features = getViewport().getFeaturesDisplayed()
925 .getVisibleFeatures();
926 for (String feature : features)
928 fcols.put(feature, getFeatureStyle(feature));
934 public FeaturesDisplayedI getFeaturesDisplayed()
936 return av.getFeaturesDisplayed();
940 * Returns a (possibly empty) list of visible feature types, in render order
944 public List<String> getDisplayedFeatureTypes()
946 List<String> typ = getRenderOrder();
947 List<String> displayed = new ArrayList<>();
948 FeaturesDisplayedI feature_disp = av.getFeaturesDisplayed();
949 if (feature_disp != null)
951 synchronized (feature_disp)
953 for (String type : typ)
955 if (feature_disp.isVisible(type))
966 public List<String> getDisplayedFeatureGroups()
968 List<String> _gps = new ArrayList<>();
969 for (String gp : getFeatureGroups())
971 if (checkGroupVisibility(gp, false))
980 * Answers true if the feature belongs to a feature group which is not
981 * currently displayed, else false
983 * @param sequenceFeature
986 protected boolean featureGroupNotShown(final SequenceFeature sequenceFeature)
988 return featureGroups != null
989 && sequenceFeature.featureGroup != null
990 && sequenceFeature.featureGroup.length() != 0
991 && featureGroups.containsKey(sequenceFeature.featureGroup)
992 && !featureGroups.get(sequenceFeature.featureGroup)
1000 public List<SequenceFeature> findFeaturesAtResidue(SequenceI sequence,
1003 List<SequenceFeature> result = new ArrayList<>();
1004 if (!av.areFeaturesDisplayed() || getFeaturesDisplayed() == null)
1010 * include features at the position provided their feature type is
1011 * displayed, and feature group is null or the empty string
1012 * or marked for display
1014 Set<String> visibleFeatures = getFeaturesDisplayed()
1015 .getVisibleFeatures();
1016 String[] visibleTypes = visibleFeatures
1017 .toArray(new String[visibleFeatures.size()]);
1018 List<SequenceFeature> features = sequence.getFeatures().findFeatures(
1019 resNo, resNo, visibleTypes);
1021 for (SequenceFeature sf : features)
1023 if (!featureGroupNotShown(sf) && getColour(sf) != null)
1032 * Removes from the list of features any whose group is not shown, or that are
1033 * visible and duplicate the location of a visible feature of the same type.
1034 * Should be used only for features of the same, simple, feature colour (which
1035 * normally implies the same feature type). No filtering is done if
1036 * transparency, or any feature filters, are in force.
1040 public void filterFeaturesForDisplay(List<SequenceFeature> features)
1043 * don't remove 'redundant' features if
1044 * - transparency is applied (feature count affects depth of feature colour)
1045 * - filters are applied (not all features may be displayable)
1047 if (features.isEmpty() || transparency != 1f
1048 || !featureFilters.isEmpty())
1053 SequenceFeatures.sortFeatures(features, true);
1054 SequenceFeature lastFeature = null;
1056 Iterator<SequenceFeature> it = features.iterator();
1057 while (it.hasNext())
1059 SequenceFeature sf = it.next();
1060 if (featureGroupNotShown(sf))
1067 * a feature is redundant for rendering purposes if it has the
1068 * same extent as another (so would just redraw the same colour);
1069 * (checking type and isContactFeature as a fail-safe here, although
1070 * currently they are guaranteed to match in this context)
1072 if (lastFeature != null
1073 && sf.getBegin() == lastFeature.getBegin()
1074 && sf.getEnd() == lastFeature.getEnd()
1075 && sf.isContactFeature() == lastFeature.isContactFeature()
1076 && sf.getType().equals(lastFeature.getType()))
1085 public Map<String, FeatureMatcherSetI> getFeatureFilters()
1087 return featureFilters;
1091 public void setFeatureFilters(Map<String, FeatureMatcherSetI> filters)
1093 featureFilters = filters;
1097 public FeatureMatcherSetI getFeatureFilter(String featureType)
1099 return featureFilters.get(featureType);
1103 public void setFeatureFilter(String featureType, FeatureMatcherSetI filter)
1105 if (filter == null || filter.isEmpty())
1107 featureFilters.remove(featureType);
1111 featureFilters.put(featureType, filter);
1116 * Answers the colour for the feature, or null if the feature is excluded by
1117 * feature group visibility, by filters, or by colour threshold settings. This
1118 * method does not take feature visibility into account.
1124 public Color getColor(SequenceFeature sf, FeatureColourI fc)
1127 * is the feature group displayed?
1129 if (featureGroupNotShown(sf))
1135 * does the feature pass filters?
1137 if (!featureMatchesFilters(sf))
1142 return fc.getColor(sf);
1146 * Answers true if there no are filters defined for the feature type, or this
1147 * feature matches the filters. Answers false if the feature fails to match
1153 protected boolean featureMatchesFilters(SequenceFeature sf)
1155 FeatureMatcherSetI filter = featureFilters.get(sf.getType());
1156 return filter == null ? true : filter.matches(sf);
1160 public boolean isVisible(SequenceFeature feature)
1162 if (feature == null)
1166 if (getFeaturesDisplayed() == null
1167 || !getFeaturesDisplayed().isVisible(feature.getType()))
1171 if (featureGroupNotShown(feature))
1175 FeatureColourI fc = featureColours.get(feature.getType());
1176 if (fc != null && fc.isOutwithThreshold(feature))
1180 if (!featureMatchesFilters(feature))