From: amwaterhouse Date: Tue, 1 Feb 2005 18:59:47 +0000 (+0000) Subject: No need for drawableSequence X-Git-Tag: Release_2_0~713 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=87d56eefe64f0463c08126695b61bf76a630dcac;p=jalview.git No need for drawableSequence --- diff --git a/src/jalview/schemes/ConservationColourScheme.java b/src/jalview/schemes/ConservationColourScheme.java index f6726bb..af52bda 100755 --- a/src/jalview/schemes/ConservationColourScheme.java +++ b/src/jalview/schemes/ConservationColourScheme.java @@ -34,92 +34,58 @@ public class ConservationColourScheme extends ResidueColourScheme { super(); conserve = cons; cs = oldcs; + } - public void setColours(DrawableSequence seq, int j) { - Color c = Color.white; - String s = seq.getSequence().substring(j,j+1); - if (colourThreshold > 0 && conserve.getConsSequence() != null) { - if (fullConservation(j)) { - if (byResidue) { - c = findColour(seq,s,j); - } else { - c = Color.red; - } - } else { - if (byResidue) { - - int tmp = 10; - int t = Integer.parseInt(conserve.getConsSequence().getSequence().substring(j,j+1)); - c = findColour(seq,s,j); - - while (tmp >= t) { - // c = c.darker(); - c = lighter(c,inc); - tmp--; - } - } else { - c = Color.yellow; - } - } - } - - seq.setColor(c); - } public Color findColour(String s, int i, java.util.Vector whatever) { Color c = null; if (colourThreshold > 0 && conserve.getConsSequence() != null) { - if (fullConservation(i)) { - if (byResidue) { - c = findColour(null,s,i); - } else { - c = Color.red; - } - } else { - if (byResidue) { + if (conserve.getConsSequence().getSequence().charAt(i)=='*') + { + if (byResidue) + c = findColour(s, i); + else + c = Color.red; + } + else + { + if (byResidue) + { int tmp = 10; int t = 0; - if( !jalview.util.Comparison.isGap( conserve.getConsSequence().getSequence().charAt(i) )) - t=Integer.parseInt(conserve.getConsSequence().getSequence().substring(i,i+1)); + if (!jalview.util.Comparison.isGap(conserve.getConsSequence(). + getSequence().charAt(i))) + t = Integer.parseInt(conserve.getConsSequence().getSequence(). + substring(i, i + 1)); - c = findColour(null,s,i); + c = findColour(s, i); - while (tmp >= t) { + while (tmp >= t) + { // c = c.darker(); - c = lighter(c,inc); - tmp--; - } - } else { - c = Color.yellow; + c = lighter(c, inc); + tmp--; + } } + else + c = Color.yellow; } } return c; } - public Color findColour(DrawableSequence seq, String s, int j) { + public Color findColour(String s, int j) { if(cs!=null) - return cs.findColour( s, -1, null); + return cs.findColour( s, j, null); else return Color.white; } - public boolean fullConservation(int j) { - String tmp = conserve.getConsSequence().getSequence().substring(j,j+1); - if (tmp.equals("*")) return true; else return false; - } - public boolean aboveThreshold(DrawableSequence seq, int j, int threshold) { - String tmp = conserve.getConsSequence().getSequence().substring(j,j+1); - - if (Integer.parseInt(tmp) >= threshold || tmp.equals("*")) { - return true; - } else { - return false; - } - } + + public Color lighter(Color c, int inc) { int red = c.getRed();