From b78278b3ee2cb653c439fa207b78a469d53ce697 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 15 Dec 2004 17:25:25 +0000 Subject: [PATCH] isGap method implemented in utils --- src/jalview/schemes/Blosum62ColourScheme.java | 5 ++-- src/jalview/schemes/ScoreColourScheme.java | 32 ++++++++++--------------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/jalview/schemes/Blosum62ColourScheme.java b/src/jalview/schemes/Blosum62ColourScheme.java index d91d49f..d0546dc 100755 --- a/src/jalview/schemes/Blosum62ColourScheme.java +++ b/src/jalview/schemes/Blosum62ColourScheme.java @@ -36,9 +36,10 @@ public class Blosum62ColourScheme extends ResidueColourScheme this.av = av; } - public Color findColour(SequenceI seq, String s, int j, Vector aa) + public Color findColour(String s, int j, Vector aa) { - if (!s.equals("-") && !s.equals(".") && !s.equals(" ")) + + if (!jalview.util.Comparison.isGap((s.charAt(0)))) { String max = av.getVisibleConsensus().charAt(j) + ""; diff --git a/src/jalview/schemes/ScoreColourScheme.java b/src/jalview/schemes/ScoreColourScheme.java index 89e94fd..225f8dd 100755 --- a/src/jalview/schemes/ScoreColourScheme.java +++ b/src/jalview/schemes/ScoreColourScheme.java @@ -22,35 +22,27 @@ public class ScoreColourScheme extends ResidueColourScheme { this.max = max; } - /* public Color getColour(SequenceI seq, int j, Vector aa) { - Color c = Color.white; - String s = seq.getSequence(j,j+1); + + public Color findColour(String s,int j,Vector aa) + { if (threshold > 0) { - if (aboveThreshold(aa,seq,j,threshold)) - c = findColour(seq,s,j,aa); + if (!aboveThreshold(aa,s,j)) + return Color.white; } - else if ( !s.equals("-") && !s.equals(".") && !s.equals(" ") ) - c = findColour(seq,s,j,aa); - // else - // c = Color.white; - - return c; - }*/ - - public Color findColour(SequenceI seq,String s,int j,Vector aa) - { float red = (float)(scores[((Integer)ResidueProperties.aaHash.get(s)).intValue()] - (float)min)/(float)(max - min); - if (red > (float)1.0) - red = (float)1.0; + if (red > 1.0f) + red = 1.0f; + + if (red < 0.0f) + red = 0.0f; - if (red < (float)0.0) - red = (float)0.0; + char c = s.charAt(0); - if(s.equals(" ")|| s.equals(".") || s.equals("-")) + if(jalview.util.Comparison.isGap((c))) return Color.white; // This isn';t great - pool of colours in here? -- 1.7.10.2