A class with some static methods that aid the manipulation of quality scores and probabilities (including a method to compress a base and quality score into a byte for SAM output.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@271 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
b7a67da775
commit
a8a6c63a32
|
|
@ -0,0 +1,22 @@
|
|||
package org.broadinstitute.sting.utils;
|
||||
|
||||
public class QualityUtils {
|
||||
private QualityUtils() {}
|
||||
|
||||
static public double qualToProb(byte qual) {
|
||||
return 1.0 - Math.pow(10.0, ((double) qual)/-10.0);
|
||||
}
|
||||
|
||||
static public byte probToQual(double prob) {
|
||||
return (byte) Math.round(-10.0*Math.log10(1.0 - prob + 0.0001));
|
||||
}
|
||||
|
||||
static public byte qualAndProbToCompressedQuality(int baseIndex, double prob) {
|
||||
byte compressedQual = (byte) baseIndex;
|
||||
byte cprob = (byte) (100.0*prob);
|
||||
byte qualmask = (byte) 252;
|
||||
compressedQual += ((cprob << 2) & qualmask);
|
||||
|
||||
return compressedQual;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue