If you happen to see a question you know the answer to, please do chime in and help your fellow community members. We appreciate your help!

Test-drive the GATK tools and Best Practices pipelines on Terra

Check out this blog post to learn how you can get started with GATK and try out the pipelines in preconfigured workspaces (with a user-friendly interface!) without having to install anything.

Per-base alignment qualities (BAQ) in the GATK

Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie admin
edited March 2016 in Archive

This article is out of date and no longer applicable. BAQs are no longer used in GATK.

1. Introduction

The GATK provides an implementation of the Per-Base Alignment Qualities (BAQ) developed by Heng Li in late 2010. See this SamTools page for more details.

2. Using BAQ

The BAQ algorithm is applied by the GATK engine itself, which means that all GATK walkers can potentially benefit from it. By default, BAQ is OFF, meaning that the engine will not use BAQ quality scores at all.

The GATK engine accepts the argument -baq with the following enum values:

public enum CalculationMode {
    OFF,                        // don't apply a BAQ at all, the default
    CALCULATE_AS_NECESSARY,     // do HMM BAQ calculation on the fly, as necessary, if there's no tag
    RECALCULATE                 // do HMM BAQ calculation on the fly, regardless of whether there's a tag present

If you want to enable BAQ, the usual thing to do is CALCULATE_AS_NECESSARY, which will calculate BAQ values if they are not in the BQ read tag. If your reads are already tagged with BQ values, then the GATK will use those. RECALCULATE will always recalculate the BAQ, regardless of the tag, which is useful if you are experimenting with the gap open penalty (see below).

If you are really an expert, the GATK allows you to specify the BAQ gap open penalty (-baqGOP) to use in the HMM. This value should be 40 by default, a good value for whole genomes and exomes for highly sensitive calls. However, if you are analyzing exome data only, you may want to use 30, which seems to result in more specific call set. We continue to play with these values some. Some walkers, where BAQ would corrupt their analyses, forbid the use of BAQ and will throw an exception if -baq is provided.

3. Some example uses of the BAQ in the GATK

  • For UnifiedGenotyper to get more specific SNP calls.

  • For PrintReads to write out a BAM file with BAQ tagged reads

  • For TableRecalibrator or IndelRealigner to write out a BAM file with BAQ tagged reads. Make sure you use -baq RECALCULATE so the engine knows to recalculate the BAQ after these tools have updated the base quality scores or the read alignments. Note that both of these tools will not use the BAQ values on input, but will write out the tags for analysis tools that will use them.

Note that some tools should not have BAQ applied to them.

This last option will be a particularly useful for people who are already doing base quality score recalibration. Suppose I have a pipeline that does:


PrintReads (with --BQSR input)


A highly efficient BAQ extended pipeline would look like

IndelRealigner // don't bother with BAQ here, since we will calculate it in table recalibrator

PrintReads (with --BQSR input) -baq RECALCULATE // now the reads will have a BAQ tag added.  Slows the tool down some

UnifiedGenotyper -baq CALCULATE_AS_NECESSARY // UG will use the tags from TableRecalibrate, keeping UG fast

4. BAQ and walker control

Walkers can control via the @BAQMode annotation how the BAQ calculation is applied. Can either be as a tag, by overwriting the qualities scores, or by only returning the baq-capped qualities scores. Additionally, walkers can be set up to have the BAQ applied to the incoming reads (ON_INPUT, the default), to output reads (ON_OUTPUT), or HANDLED_BY_WALKER, which means that calling into the BAQ system is the responsibility of the individual walker.

Post edited by Geraldine_VdAuwera on


  • volaviivolavii Member

    hi, I`am a little confused... I thought, that BAQ calculation and realignment around indels is roughly the same.. The difference is just, that the realigner changes the alignment, where as the BAQ calculation highlights bad alignment positions by quality values. So is it realy necessary to do both? I did only realignment and no BAQ calculation and I am now worried, that I missed an importand pipeline step for SNP calling.

  • Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie admin

    They are different processes that serve different purposes. BAQ calculation gives a sense of how trustworthy the existing alignment is. Realignment around indels ensures that all the reads overlapping an indel are aligned consistently.

  • When BAQ is calculated during the CountCovariates stage is it calculated using the recalibrated Q scores, or is it calculated before the Q scores are recalibrated? We get different results if we set BAQ RECALCULATE at the UG step than if just using CALCULATE_AS_NECESSARY. Should BAQ be calculated on Recalibrated values?

  • mmokrejsmmokrejs Czech RepublicMember

    Also, it could be made clearer that although the following help seems to confirm HaplotypeCaller accepts -baq as an argument, in real the program dies upon real execution.

    java -Xmx1g -jar GenomeAnalysisTK-3.7/GenomeAnalysisTK.jar -baq CALCULATE_AS_NECESSARY --baqGapOpenPenalty 30 -T HaplotypeCaller --help | grep baq
    ] [-baq ] [-baqGOP ] [-fixNDN] [-fixMisencodedQuals]
    -baq,--baq Type of BAQ calculation to
    -baqGOP,--baqGapOpenPenalty BAQ gap open penalty

  • Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie admin
    This will be addressed in GATK4 where baq is entirely non-existent.
This discussion has been closed.