*/
public static float completeInformation(AlignmentAnnotation information,
ProfilesI profiles, int startCol, int endCol, long nseq,
- Float currentMax)
+ float currentMax)
{
// long now = System.currentTimeMillis();
if (information == null || information.annotations == null
return 0;
}
- Float max = 0f;
+ float max = 0f;
+ SequenceI hmmSeq = information.sequenceRef;
+ HiddenMarkovModel hmm = hmmSeq.getHMM();
- for (int i = startCol; i < endCol; i++)
+ for (int column = startCol; column < endCol; column++)
{
- ProfileI profile = profiles.get(i);
+ ProfileI profile = profiles.get(column);
if (profile == null)
{
/*
* happens if sequences calculated over were
* shorter than alignment width
*/
- information.annotations[i] = null;
- return 0;
+ information.annotations[column] = null;
+ return 0f;
}
- SequenceI hmmSeq = information.sequenceRef;
-
- HiddenMarkovModel hmm = hmmSeq.getHMM();
-
- float value = hmm.getInformationContent(i);
-
- if (value > max)
+ float value = hmm.getInformationContent(column);
+ if (!Float.isNaN(value))
{
- max = value;
+ max = Math.max(max, value);
}
- String description = value + " bits";
- information.annotations[i] = new Annotation(
+ String description = Float.isNaN(value) ? null
+ : String.format("%.4f bits", value);
+ information.annotations[column] = new Annotation(
Character.toString(Character
- .toUpperCase(hmm.getConsensusAtAlignColumn(i))),
+ .toUpperCase(hmm.getConsensusAtAlignColumn(column))),
description, ' ', value);
}
- if (max > currentMax)
- {
- information.graphMax = max;
- return max;
- }
- else
- {
- information.graphMax = currentMax;
- return currentMax;
- }
+
+ max = Math.max(max, currentMax);
+ information.graphMax = max;
+ return max;
}
/**