/*
- * 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.1)
+ * 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 <http://www.gnu.org/licenses/>.
*/
package jalview.analysis;
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)
{
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,
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)
{
if (profile != null && includeAllConsSymbols)
{
mouseOver = "";
- if (alphabet!=null)
+ if (alphabet != null)
{
for (int c = 0; c < alphabet.length; c++)
{