X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAAFrequency.java;h=11e7a3d8514be3d0e14e3c249278a64dce353c1e;hb=153dd62dc91da13ae732600e6ea55ddbe15eab39;hp=fc8cb4c49431005a7c9863687434bea2fd1eb317;hpb=ae6a322ef448be046ec78410b26e512e1c780d96;p=jalview.git diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index fc8cb4c..11e7a3d 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -1,20 +1,19 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) - * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) + * Copyright (C) 2010 J Procter, AM Waterhouse, 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 - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This file is part of Jalview. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ package jalview.analysis; @@ -194,9 +193,9 @@ public class AAFrequency boolean includeAllConsSymbols) { completeConsensus(consensus, hconsensus, iStart, width, - ignoreGapsInConsensusCalculation, includeAllConsSymbols, - null); //new char[] - // { 'A', 'C', 'G', 'T', 'U' }); + ignoreGapsInConsensusCalculation, includeAllConsSymbols, null); // new + // char[] + // { 'A', 'C', 'G', 'T', 'U' }); } public static void completeConsensus(AlignmentAnnotation consensus, @@ -205,8 +204,18 @@ public class AAFrequency boolean includeAllConsSymbols, char[] alphabet) { float tval, value; + if (consensus==null || consensus.annotations==null || consensus.annotations.length=hconsensus.length) { + // happens if sequences calculated over were shorter than alignment width + consensus.annotations[i]=null; + continue; + } value = 0; if (ignoreGapsInConsensusCalculation) { @@ -230,7 +239,7 @@ public class AAFrequency if (profile != null && includeAllConsSymbols) { mouseOver = ""; - if (alphabet!=null) + if (alphabet != null) { for (int c = 0; c < alphabet.length; c++) {