From 71e8f47a6c29ab905eec927afb22b7b966beb442 Mon Sep 17 00:00:00 2001 From: depristo Date: Thu, 7 May 2009 18:04:18 +0000 Subject: [PATCH] boundQual function for capping qual values git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@623 348d0f76-0448-11de-a6fe-93d51630548a --- java/src/org/broadinstitute/sting/utils/QualityUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/src/org/broadinstitute/sting/utils/QualityUtils.java b/java/src/org/broadinstitute/sting/utils/QualityUtils.java index f8f283bbd..c06ba3b08 100755 --- a/java/src/org/broadinstitute/sting/utils/QualityUtils.java +++ b/java/src/org/broadinstitute/sting/utils/QualityUtils.java @@ -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.