X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FAnnotationColourGradient.java;fp=src%2Fjalview%2Fschemes%2FAnnotationColourGradient.java;h=1a3e9efe49a8b0b105afc08aaefdb55f1c3b51d0;hb=77bebd0b42826a8ba2f54293b05ccc1dbfbd6ae7;hp=89b8f0711ad3e764b202e2fa30274e2a0cfec663;hpb=9d7c487b4a2774d380d0807527e365e9002a1fd5;p=jalview.git diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index 89b8f07..1a3e9ef 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -64,11 +64,11 @@ public class AnnotationColourGradient extends FollowerColourScheme IdentityHashMap seqannot = null; @Override - public ColourSchemeI applyTo(AnnotatedCollectionI sg, + public ColourSchemeI getInstance(AnnotatedCollectionI sg, Map hiddenRepSequences) { AnnotationColourGradient acg = new AnnotationColourGradient(annotation, - colourScheme, aboveAnnotationThreshold); + getColourScheme(), aboveAnnotationThreshold); acg.thresholdIsMinMax = thresholdIsMinMax; acg.annotationThreshold = (annotationThreshold == null) ? null : new GraphLine(annotationThreshold); @@ -92,11 +92,12 @@ public class AnnotationColourGradient extends FollowerColourScheme { if (originalColour instanceof AnnotationColourGradient) { - colourScheme = ((AnnotationColourGradient) originalColour).colourScheme; + setColourScheme(((AnnotationColourGradient) originalColour) + .getColourScheme()); } else { - colourScheme = originalColour; + setColourScheme(originalColour); } this.annotation = annotation; @@ -250,6 +251,7 @@ public class AnnotationColourGradient extends FollowerColourScheme * * @return DOCUMENT ME! */ + @Override public Color findColour(char c) { return Color.red; @@ -275,88 +277,89 @@ public class AnnotationColourGradient extends FollowerColourScheme { return currentColour; } - if ((threshold == 0) || aboveThreshold(c, j)) + // if ((threshold == 0) || aboveThreshold(c, j)) + // { + if (annotation.annotations != null && j < annotation.annotations.length + && annotation.annotations[j] != null + && !jalview.util.Comparison.isGap(c)) { - if (annotation.annotations != null - && j < annotation.annotations.length - && annotation.annotations[j] != null - && !jalview.util.Comparison.isGap(c)) + Annotation aj = annotation.annotations[j]; + // 'use original colours' => colourScheme != null + // -> look up colour to be used + // predefined colours => preconfigured shading + // -> only use original colours reference if thresholding enabled & + // minmax exists + // annotation.hasIcons => null or black colours replaced with glyph + // colours + // -> reuse original colours if present + // -> if thresholding enabled then return colour on non-whitespace glyph + + if (aboveAnnotationThreshold == NO_THRESHOLD + || (annotationThreshold != null && (aboveAnnotationThreshold == ABOVE_THRESHOLD ? aj.value >= annotationThreshold.value + : aj.value <= annotationThreshold.value))) { - Annotation aj = annotation.annotations[j]; - // 'use original colours' => colourScheme != null - // -> look up colour to be used - // predefined colours => preconfigured shading - // -> only use original colours reference if thresholding enabled & - // minmax exists - // annotation.hasIcons => null or black colours replaced with glyph - // colours - // -> reuse original colours if present - // -> if thresholding enabled then return colour on non-whitespace glyph - - if (aboveAnnotationThreshold == NO_THRESHOLD - || (annotationThreshold != null && (aboveAnnotationThreshold == ABOVE_THRESHOLD ? aj.value >= annotationThreshold.value - : aj.value <= annotationThreshold.value))) + if (predefinedColours && aj.colour != null + && !aj.colour.equals(Color.black)) { - if (predefinedColours && aj.colour != null - && !aj.colour.equals(Color.black)) - { - currentColour = aj.colour; - } - else if (annotation.hasIcons - && annotation.graph == AlignmentAnnotation.NO_GRAPH) + currentColour = aj.colour; + } + else if (annotation.hasIcons + && annotation.graph == AlignmentAnnotation.NO_GRAPH) + { + if (aj.secondaryStructure > ' ' && aj.secondaryStructure != '.' + && aj.secondaryStructure != '-') { - if (aj.secondaryStructure > ' ' && aj.secondaryStructure != '.' - && aj.secondaryStructure != '-') + if (getColourScheme() != null) { - if (colourScheme != null) + currentColour = getColourScheme().findColour(c, j, seq, null, + 0f); + } + else + { + if (annotation.isRNA()) { - currentColour = colourScheme.findColour(c, j, seq); + currentColour = ColourSchemeProperty.rnaHelices[(int) aj.value]; } else { - if (annotation.isRNA()) - { - currentColour = ColourSchemeProperty.rnaHelices[(int) aj.value]; - } - else - { - currentColour = annotation.annotations[j].secondaryStructure == 'H' ? jalview.renderer.AnnotationRenderer.HELIX_COLOUR - : annotation.annotations[j].secondaryStructure == 'E' ? jalview.renderer.AnnotationRenderer.SHEET_COLOUR - : jalview.renderer.AnnotationRenderer.STEM_COLOUR; - } + currentColour = annotation.annotations[j].secondaryStructure == 'H' ? jalview.renderer.AnnotationRenderer.HELIX_COLOUR + : annotation.annotations[j].secondaryStructure == 'E' ? jalview.renderer.AnnotationRenderer.SHEET_COLOUR + : jalview.renderer.AnnotationRenderer.STEM_COLOUR; } } - else - { - // - return Color.white; - } } - else if (noGradient) + else { - if (colourScheme != null) - { - currentColour = colourScheme.findColour(c, j, seq); - } - else - { - if (aj.colour != null) - { - currentColour = aj.colour; - } - } + // + return Color.white; + } + } + else if (noGradient) + { + if (getColourScheme() != null) + { + currentColour = getColourScheme().findColour(c, j, seq, null, + 0f); } else { - currentColour = shadeCalculation(annotation, j); + if (aj.colour != null) + { + currentColour = aj.colour; + } } } - if (conservationColouring) + else { - currentColour = applyConservation(currentColour, j); + currentColour = shadeCalculation(annotation, j); } } + // if (conservationColouring) + // { + // currentColour = applyConservation(currentColour, j); + // } } + // } return currentColour; } @@ -419,4 +422,16 @@ public class AnnotationColourGradient extends FollowerColourScheme { seqAssociated = sassoc; } + + @Override + public String getSchemeName() + { + return "Annotation"; + } + + @Override + public boolean isSimple() + { + return false; + } }