import java.util.*;
+import jalview.util.Format;
import jalview.datamodel.*;
/**
public static void completeConsensus(AlignmentAnnotation consensus,
Hashtable[] hconsensus, int iStart, int width,
boolean ignoreGapsInConsensusCalculation,
- boolean includeAllConsSymbols)
+ boolean includeAllConsSymbols, long nseq)
{
float tval, value;
if (consensus == null || consensus.annotations == null
// initialised properly
return;
}
+ String fmtstr="%3.1f";
+ int precision=2;
+ while (nseq>100) {
+ precision++;
+ nseq/=10;
+ }
+ if (precision>2)
+ {
+ fmtstr = "%"+(2+precision)+"."+precision+"f";
+ }
+ Format fmt = new Format(fmtstr);
+
for (int i = iStart; i < width; i++)
{
Hashtable hci;
tval = (vl[c] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1
: 0]);
mouseOver += ((p == 0) ? "" : "; ") + (char) ((int[]) ca[c])[0]
- + (char) ((int[]) ca[c])[1] + " " + ((int) tval) + "%";
+ + (char) ((int[]) ca[c])[1] + " " + fmt.form(tval) + "%";
p++;
}
}
else
{
- mouseOver += ((int) value + "%");
+ mouseOver += (fmt.form(value) + "%");
}
consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ',
value);