X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FPIDColourScheme.java;h=7f4bebeae89016568d89bbe635c565f09fc6a1fe;hb=0bdaa0deb6ee514912d2ed730e19f618bc44cb69;hp=66f180be4c72186c75934d0e2cb817a4dd865b8f;hpb=95a46891288f4fc63d690cab4f56879678f54fb6;p=jalview.git diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index 66f180b..7f4bebe 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) 2006 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 @@ -21,6 +21,7 @@ package jalview.schemes; import java.awt.*; import jalview.datamodel.*; +import jalview.analysis.AAFrequency; public class PIDColourScheme extends ResidueColourScheme @@ -43,6 +44,11 @@ public class PIDColourScheme s = String.valueOf(res -= ('a' - 'A')); } + if (consensus == null || + j >= consensus.length) + { + return Color.white; + } if ( (threshold != 0) && !aboveThreshold(s, j)) { @@ -53,24 +59,27 @@ public class PIDColourScheme double sc = 0; - if ( (Integer.parseInt(consensus[j].get("maxCount").toString()) != -1) && - consensus[j].contains(s)) - { - sc = ((Float)consensus[j].get(ignoreGaps)).floatValue(); + if(consensus.length<=j) + return Color.white; - if (!jalview.util.Comparison.isGap( res )) + if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) != -1) && + consensus[j].contains(s)) { - for (int i = 0; i < thresholds.length; i++) + sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue(); + + if (!jalview.util.Comparison.isGap(res)) { - if (sc > thresholds[i]) + for (int i = 0; i < thresholds.length; i++) { - currentColour = pidColours[i]; + if (sc > thresholds[i]) + { + currentColour = pidColours[i]; - break; + break; + } } } } - } if(conservationColouring) applyConservation(j);