import java.util.*;
+import jalview.util.Format;
import jalview.datamodel.*;
/**
// 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;
consensus.annotations[i] = null;
continue;
}
-
value = 0;
Float fv;
if (ignoreGapsInConsensusCalculation)
tval = profile[0][alphabet[c]] * 100f
/ profile[1][ignoreGapsInConsensusCalculation ? 1 : 0];
mouseOver += ((c == 0) ? "" : "; ") + alphabet[c] + " "
- + ((int) tval) + "%";
+ + fmt.form(tval) + "%";
}
}
else
* 100f
/ profile[1][ignoreGapsInConsensusCalculation ? 1 : 0];
mouseOver += ((p == 0) ? "" : "; ") + ((char[]) ca[c])[0]
- + " " + ((int) tval) + "%";
+ + " " + fmt.form(tval) + "%";
p++;
}
}
else
{
- mouseOver += ((int) value + "%");
+ mouseOver += (fmt.form(value) + "%");
}
consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ',
value);
import java.util.*;
+import jalview.util.Format;
import jalview.datamodel.*;
/**
// 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);