More ways to access quality utils

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@573 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2009-04-30 22:12:07 +00:00
parent 63403d32cd
commit 1cc5e74435
1 changed files with 16 additions and 1 deletions

View File

@ -30,7 +30,22 @@ public class QualityUtils {
* @return a quality score (0-40)
*/
static public byte probToQual(double prob) {
return (byte) Math.round(-10.0*Math.log10(1.0 - prob + 0.0001));
return probToQual(prob, 0.0001);
//return (byte) Math.round(-10.0*Math.log10(1.0 - prob + 0.0001));
}
/**
* Convert a probability to a quality score. Note, this is capped at Q40.
*
* @param prob a probability (0.0-1.0)
* @param eps min probabilty allowed (0.0-1.0)
* @return a quality score (0-255)
*/
static public byte probToQual(double prob, double eps) {
double lp = Math.round(-10.0*Math.log10(1.0 - prob + eps));
byte b = (byte) Math.min(lp, 63);
//System.out.printf("LP is %f, byte is %d%n", lp, b);
return b;
}
/**