boundQual function for capping qual values

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@623 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2009-05-07 18:04:18 +00:00
parent e848f34896
commit 71e8f47a6c
1 changed files with 5 additions and 1 deletions

View File

@ -43,11 +43,15 @@ public class QualityUtils {
*/
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);
byte b = boundQual((int)lp);
//System.out.printf("LP is %f, byte is %d%n", lp, b);
return b;
}
static public byte boundQual(int qual) {
return (byte) Math.min(qual, 63);
}
/**
* Compress a base and a probability into a single byte so that it can be output in a SAMRecord's SQ field.
* Note: the highest probability this function can encode is 64%, so this function should only never be used on the best base hypothesis.