Merged bug fix from Stable into Unstable
This commit is contained in:
commit
3463774f2a
|
|
@ -9,7 +9,7 @@ import net.sf.samtools.SAMUtils;
|
|||
* @author Kiran Garimella
|
||||
*/
|
||||
public class QualityUtils {
|
||||
public final static byte MAX_RECALIBRATED_Q_SCORE = 93;
|
||||
public final static byte MAX_RECALIBRATED_Q_SCORE = SAMUtils.MAX_PHRED_SCORE;
|
||||
public final static byte MAX_QUAL_SCORE = SAMUtils.MAX_PHRED_SCORE;
|
||||
public final static double ERROR_RATE_OF_MAX_QUAL_SCORE = qualToErrorProbRaw(MAX_QUAL_SCORE);
|
||||
|
||||
|
|
|
|||
|
|
@ -406,10 +406,15 @@ public class BAQ {
|
|||
// so BQi = Qi - BAQi + 64
|
||||
byte[] bqTag = new byte[baq.length];
|
||||
for ( int i = 0; i < bqTag.length; i++) {
|
||||
int bq = (int)read.getBaseQualities()[i] + 64;
|
||||
int baq_i = (int)baq[i];
|
||||
int tag = bq - baq_i;
|
||||
if ( tag < 0 ) throw new ReviewedStingException("BAQ tag calculation error. BAQ value above base quality at " + read);
|
||||
final int bq = (int)read.getBaseQualities()[i] + 64;
|
||||
final int baq_i = (int)baq[i];
|
||||
final int tag = bq - baq_i;
|
||||
// problem with the calculation of the correction factor; this is our problem
|
||||
if ( tag < 0 )
|
||||
throw new ReviewedStingException("BAQ tag calculation error. BAQ value above base quality at " + read);
|
||||
// the original quality is too high, almost certainly due to using the wrong encoding in the BAM file
|
||||
if ( tag > Byte.MAX_VALUE )
|
||||
throw new UserException.MalformedBAM(read, "we encountered an extremely high quality score (" + (bq - 64) + ") with BAQ correction factor of " + baq_i + "; the BAM file appears to be using the wrong encoding for quality scores");
|
||||
bqTag[i] = (byte)tag;
|
||||
}
|
||||
return new String(bqTag);
|
||||
|
|
|
|||
Loading…
Reference in New Issue