X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FFeatureColour.java;fp=src%2Fjalview%2Fschemes%2FFeatureColour.java;h=f34478cf0abefd63b2f6f082c99496c8280696df;hb=09d3b755d9b00f5c3acb44049aedd49361dc0690;hp=51e7645de48a7d63df8c2c9d3f3d714dd3de2119;hpb=d34f80c67881e79d7304eb143e9c907bc16d052b;p=jalview.git diff --git a/src/jalview/schemes/FeatureColour.java b/src/jalview/schemes/FeatureColour.java index 51e7645..f34478c 100644 --- a/src/jalview/schemes/FeatureColour.java +++ b/src/jalview/schemes/FeatureColour.java @@ -689,9 +689,12 @@ public class FeatureColour implements FeatureColourI /** * Returns the colour for the given instance of the feature. This may be a - * simple colour, a colour generated from the feature description (if - * isColourByLabel()), or a colour derived from the feature score (if - * isGraduatedColour()). + * simple colour, a colour generated from the feature description or other + * attribute (if isColourByLabel()), or a colour derived from the feature + * score or other attribute (if isGraduatedColour()). + *

+ * Answers null if feature score (or attribute) value lies outside a + * configured threshold. * * @param feature * @return @@ -890,4 +893,32 @@ public class FeatureColour implements FeatureColourI attributeName = name; } + @Override + public boolean isOutwithThreshold(SequenceFeature feature) + { + if (!isGraduatedColour()) + { + return false; + } + float scr = feature.getScore(); + if (attributeName != null) + { + try + { + String attVal = feature.getValueAsString(attributeName); + scr = Float.valueOf(attVal); + } catch (Throwable e) + { + scr = Float.NaN; + } + } + if (Float.isNaN(scr)) + { + return false; + } + + return ((isAboveThreshold() && scr <= threshold) + || (isBelowThreshold() && scr >= threshold)); + } + }