X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fschemes%2FAnnotationColourGradient.java;h=a84ea52aa5d5a0452ea5d231e63c84fec054b1ca;hb=bfdbaf7f1a8c1e4cad9af35075ffbe55f7f5683e;hp=f646963e85aa5517e099b1af52e0c2e97f4798b4;hpb=9f70ff4b6d193b340031997634c9e3602486bc8e;p=jalview.git diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index f646963..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); @@ -197,7 +198,7 @@ public class AnnotationColourGradient extends FollowerColourScheme } else { - seqannot = new IdentityHashMap(); + seqannot = new IdentityHashMap<>(); } // resolve the context containing all the annotation for the sequence AnnotatedCollectionI alcontext = alignment instanceof AlignmentI @@ -247,6 +248,10 @@ public class AnnotationColourGradient extends FollowerColourScheme perLineScore = plcount == ancount; aamax=plmax; } + else + { + perLineScore = false; + } if (rna) { ColourSchemeProperty.initRnaHelicesShading(1 + (int) aamax); @@ -359,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; } @@ -454,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 { @@ -480,11 +488,12 @@ public class AnnotationColourGradient extends FollowerColourScheme if (perLineScore) { trans = (int) ((1f - range) * midtr); - range = (float) ((annotation.score - plmin) / (plmax - aamin)); + range = (float) ((ann.score - plmin) / (plmax - aamin)); } - int dr = (int) (rr * range + r1), dg = (int) (gg * range + g1), db = (int) (bb - * range + b1); - if (annotation.score == annotation.score && positionToTransparency) + int dr = (int) (redRange * range + redMin), + dg = (int) (greenRange * range + greenMin), + db = (int) (blueRange * range + blueMin); + if (ann.score == ann.score && positionToTransparency) { return new Color(Math.min(dr + trans, midtr), Math.min(dg + trans, midtr), Math.min(db + trans, midtr)); @@ -528,7 +537,7 @@ public class AnnotationColourGradient extends FollowerColourScheme @Override public String getSchemeName() { - return "Annotation"; + return ANNOTATION_COLOUR; } @Override