X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fschemes%2FPIDColourScheme.java;h=e1dbf4696706b9cd4b8c96bb4a6cf7f76d8a04cf;hb=1a0f6886ffdb431de180af2089db4910a1dfb564;hp=66f180be4c72186c75934d0e2cb817a4dd865b8f;hpb=95a46891288f4fc63d690cab4f56879678f54fb6;p=jalview.git diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index 66f180b..e1dbf46 100755 --- a/src/jalview/schemes/PIDColourScheme.java +++ b/src/jalview/schemes/PIDColourScheme.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -20,6 +20,7 @@ package jalview.schemes; import java.awt.*; +import jalview.analysis.*; import jalview.datamodel.*; public class PIDColourScheme @@ -35,30 +36,41 @@ public class PIDColourScheme this.thresholds = ResidueProperties.pidThresholds; } - public Color findColour(String s, int j) + public Color findColour(char c, int j) { - char res = s.charAt(0); - if ('a' <= res && res <= 'z') + if ('a' <= c && c <= 'z') { - s = String.valueOf(res -= ('a' - 'A')); + c -= ('a' - 'A'); } + if (consensus == null + || j >= consensus.length + || consensus[j] == null) + { + return Color.white; + } - if ( (threshold != 0) && !aboveThreshold(s, j)) + if ( (threshold != 0) && !aboveThreshold(c, j)) { return Color.white; } - currentColour = Color.white; + Color currentColour = Color.white; double sc = 0; - if ( (Integer.parseInt(consensus[j].get("maxCount").toString()) != -1) && - consensus[j].contains(s)) + if (consensus.length <= j) { - sc = ((Float)consensus[j].get(ignoreGaps)).floatValue(); + return Color.white; + } - if (!jalview.util.Comparison.isGap( res )) + if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) != + -1) && + consensus[j].contains(String.valueOf(c))) + { + sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue(); + + if (!jalview.util.Comparison.isGap(c)) { for (int i = 0; i < thresholds.length; i++) { @@ -72,8 +84,10 @@ public class PIDColourScheme } } - if(conservationColouring) - applyConservation(j); + if (conservationColouring) + { + currentColour = applyConservation(currentColour, j); + } return currentColour; }