X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FAnnotationColourGradient.java;h=a84ea52aa5d5a0452ea5d231e63c84fec054b1ca;hb=b5667f39acdf309cd92881b73edfda591e0acaf4;hp=7133f130fdb2a53f6db8e49bfd0c38d96013fee5;hpb=1903e771d3dae79e9a57fcc1147efd37e8a51421;p=jalview.git diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index 7133f13..a84ea52 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -20,6 +20,7 @@ */ package jalview.schemes; +import jalview.api.AlignViewportI; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AnnotatedCollectionI; @@ -86,8 +87,8 @@ public class AnnotationColourGradient extends FollowerColourScheme private IdentityHashMap seqannot = null; @Override - public ColourSchemeI getInstance(AnnotatedCollectionI sg, - Map hiddenRepSequences) + public ColourSchemeI getInstance(AlignViewportI view, + AnnotatedCollectionI sg) { AnnotationColourGradient acg = new AnnotationColourGradient(annotation, getColourScheme(), aboveAnnotationThreshold); @@ -363,9 +364,9 @@ public class AnnotationColourGradient extends FollowerColourScheme if (annotationThreshold != null) { if ((aboveAnnotationThreshold == ABOVE_THRESHOLD - && aj.value < annotationThreshold.value) + && aj.value <= annotationThreshold.value) || (aboveAnnotationThreshold == BELOW_THRESHOLD - && aj.value > annotationThreshold.value)) + && aj.value >= annotationThreshold.value)) { return Color.white; } @@ -458,14 +459,17 @@ public class AnnotationColourGradient extends FollowerColourScheme && aboveAnnotationThreshold == ABOVE_THRESHOLD && value >= ann.threshold.value) { - range = (value - ann.threshold.value) + range = ann.graphMax == ann.threshold.value ? 1f + : (value - ann.threshold.value) / (ann.graphMax - ann.threshold.value); } else if (thresholdIsMinMax && ann.threshold != null && aboveAnnotationThreshold == BELOW_THRESHOLD && value <= ann.threshold.value) { - range = (value - ann.graphMin) / (ann.threshold.value - ann.graphMin); + range = ann.graphMin == ann.threshold.value ? 0f + : (value - ann.graphMin) + / (ann.threshold.value - ann.graphMin); } else { @@ -533,7 +537,7 @@ public class AnnotationColourGradient extends FollowerColourScheme @Override public String getSchemeName() { - return "Annotation"; + return ANNOTATION_COLOUR; } @Override