X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAAFrequency.java;h=aadd8f0e82ab8ec034b49f7fd0fd0d00f45bbb9d;hb=a81cd4fa55b7cade14dc0ee9a0875c63e96d3f44;hp=bc178dfdcf68cd3a6caebd93d99ab1ddfb38b72a;hpb=d423f22792e47dbc800ae220a58677f988971d06;p=jalview.git diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index bc178df..aadd8f0 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -105,6 +105,11 @@ public class AAFrequency for (j = 0; j < jSize; j++) { + if (sequences[j]==null) + { + System.err.println("WARNING: Consensus skipping null sequence - possible race condition."); + continue; + } seq = sequences[j].getSequence(); if (seq.length > i) { @@ -204,8 +209,22 @@ public class AAFrequency boolean includeAllConsSymbols, char[] alphabet) { float tval, value; + if (consensus == null || consensus.annotations == null + || consensus.annotations.length < width) + { + // called with a bad alignment annotation row - wait for it to be + // initialised properly + return; + } for (int i = iStart; i < width; i++) { + if (i >= hconsensus.length) + { + // happens if sequences calculated over were shorter than alignment + // width + consensus.annotations[i] = null; + continue; + } value = 0; if (ignoreGapsInConsensusCalculation) {