+ redRange = maxColour.getRed() - redMin;
+ greenRange = maxColour.getGreen() - greenMin;
+ blueRange = maxColour.getBlue() - blueMin;
+
+ noGradient = false;
+ checkLimits();
+ }
+
+ private void checkLimits()
+ {
+ aamax = annotation.graphMax;
+ aamin = annotation.graphMin;
+ if (annotation.isRNA())
+ {
+ // reset colour palette
+ ColourSchemeProperty.resetRnaHelicesShading();
+ ColourSchemeProperty.initRnaHelicesShading(1 + (int) aamax);
+ }
+ }
+
+ @Override
+ public void alignmentChanged(AnnotatedCollectionI alignment,
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
+ {
+ super.alignmentChanged(alignment, hiddenReps);
+
+ if (seqAssociated && annotation.getCalcId() != null)
+ {
+ if (seqannot != null)
+ {
+ seqannot.clear();
+ }
+ else
+ {
+ seqannot = new IdentityHashMap<>();
+ }
+ // resolve the context containing all the annotation for the sequence
+ AnnotatedCollectionI alcontext = alignment instanceof AlignmentI
+ ? alignment
+ : alignment.getContext();
+ boolean f = true, sf = true, rna = false;
+ long plcount = 0, ancount = 0;
+ for (AlignmentAnnotation alan : alcontext.findAnnotation(annotation
+ .getCalcId()))
+ {
+ if (alan.sequenceRef != null
+ && (alan.label != null && annotation != null
+ && alan.label.equals(annotation.label)))
+ {
+ ancount++;
+ if (!rna && alan.isRNA())
+ {
+ rna = true;
+ }
+ seqannot.put(alan.sequenceRef, alan);
+ if (f || alan.graphMax > aamax)
+ {
+ aamax = alan.graphMax;
+ }
+ if (f || alan.graphMin < aamin)
+ {
+ aamin = alan.graphMin;
+ }
+ f = false;
+ if (alan.score == alan.score)
+ {
+ if (sf || alan.score < plmin)
+ {
+ plmin = alan.score;
+ }
+ if (sf || alan.score > plmax)
+ {
+ plmax = alan.score;
+ }
+ sf = false;
+ plcount++;
+ }
+ }
+ }
+ if (plcount > 0 && plcount == ancount)
+ {
+ perLineScore = plmax!=plmin;
+ aamax=plmax;
+ }
+ else
+ {
+ perLineScore = false;
+ }
+ if (rna)
+ {
+ ColourSchemeProperty.initRnaHelicesShading(1 + (int) aamax);
+ }
+ }