# Changes

## BamUtil: recab

, 16:59, 18 September 2012
no edit summary
# Build Recalibration Table
# Apply Recalibration Table

The Recalibration Table groups bases based on a set of covariates:
* Quality (either from the quality string or [[#Read the quality from a tag(--qualField)|from a tag]])
* Cycle (reverse complement for reverse strands)
The Recalibration Table tracks the number of matches/mismatches for each set of covariates.

Only bases meeting all of the following criteria are used to Build the Recalibration Table:
* Base criteria
** match/mismatch (not an insertion/deletion/skip/clip)
** not a [[#DBSNP File (--dbsnp)|dbSNP position]]** base quality > [[#Minimum Recalibration Base Quality (--minBaseQual)|minBaseQual (5 by default)]]
* Additional criteria for cycle != 1 (can be turned off via flags)
** previous base is a CIGAR Match/Mismatch
** previous base position is not a [[#DBSNP File (--dbsnp)|dbSNP position]]  The Recalibration Table is applied to all bases meeting all of the following criteria (even if they were not used for creating the table):* base quality > [[#Minimum Recalibration Base Quality (--minBaseQual)|minBaseQual (5 by default)]]* at least 1 match or mismatch for the set of covariates  Recalibrated Quality is: $-10 * \log \frac{mismatches + 1}{mismatches + matches + 1}$
The Recalibration Table is applied to all bases meeting all of the following criteria:
* base quality > minBaseQual (5 by default)
The If the Recalibrated Quality is calculated using: $greater than [[#Maximum Recalibration Base Quality (-10 * \log \frac{mismatches + 1}{mismatches + matches + 1}$-maxBaseQual)|maxBaseQual]], the updated quality is set to maxBaseQual.
If the Recalibration Table has no matches & no mismatches for a set of covariates, the original base quality is kept.
If Optionally, the Recalibrated Quality is greater than maxBaseQual, previous quality can be [[#Store the updated original quality is set to maxBaseQual(--storeQualTag)|stored in a tag]].
Optionally, the previous quality can be stored in a tag.
The current recalibration logic was designed for recalibrating ILLUMINA data.
3,045
edits