Answers.Body: <p>Turns out two recalibration tables are needed to show pre-recalibration and post-recalibration plots. I previously only had generated the pre-calibration table by running <code>BaseRecalibrator</code> on the BAM that hadn't undergone <code>ApplyBQSR</code> to adjust base scores. Here are the steps to show pre and post recalibration plots in <code>MultiQC</code>:</p>
  
  <ol>
  <li>Run <code>BaseRecalibrator</code> on your initial input BAM. This will create a recalibration table with the original base scores. </li>
  <li>Run <code>ApplyBQSR</code> with the recalibration table from step 1 to create a new BAM with the adjusted base quality scores.</li>
  <li>Run <code>BaseRecalibrator</code> on the adjusted BAM generated in step 2 to create a new recalibration table with the adjusted base quality scores. </li>
  <li>Use both recalibration tables as inputs to <code>MultiQC</code>. This should create both plots. </li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-19T10:03:27.503Z
Answers.Text: hey did you method work ? I have done your steps and it does not create both plots. I believe we need to create a csv file report from `gatk AnalyzeCovariates`. Will try that now
Answers.UserDisplayName: moth
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-21T20:59:30.847Z
Answers.Text: @alex what part does not work? Does MultiQC not create both plots even though you give it both tables as input?
Answers.UserDisplayName: Tomas Bencomo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-22T03:35:20.703Z
Answers.Text: yes correct. the tables were in different directories and didn't work. I then tried to put the tables under the same directory, did not work either. then i noticed both tables had the same 'sample name'. I changed the names of the tables so multiqc would detect 2 'samples' and correctly use the tables as before and after. It also did not work. strangely their old test data for BQSR on github works. things have probaly changed since then and they did not update the code
Answers.UserDisplayName: moth
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-26T21:03:53.400Z
Answers.Text: Not sure what the issue is then. It has been awhile since I used that MultiQC function and eventually dropped those plots from my pipeline. I would ask the creator of MultiQC, Phil Ewels for help on his Gitter. There's instructions for how to contact him Github.
Answers.UserDisplayName: Tomas Bencomo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-27T21:20:53.797Z
Answers.LastActivityDate: 2020-01-27T21:20:53.797Z
Answers.UserDisplayName: Tomas Bencomo
Body: <p>I'm using GATK4 to build a somatic variant calling pipeline. The pipeline uses MultiQC to aggregate quality control data, and one of the QC measures reported is base quality score recalibration from GATK4's <code>BaseRecalibraton</code>. The description in MultiQC says</p>
  
  <blockquote>
    <p>This plot shows the distribution of base quality scores in each sample before and after base quality score recalibration (BQSR). Applying BQSR should broaden the distribution of base quality scores.</p>
  </blockquote>
  
  <p><a href="https://i.sstatic.net/rxcP5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rxcP5.png" alt="enter image description here"></a></p>
  
  <p>The black line is for my tumor sample and blue line is my normal sample. I don't understand how the before and after distributions are <strong>both</strong> shown in the plot as I only see 1 distribution per sample. Am I missing something, or should there be a "Post-calibration Count" plot that isn't shown? If nothing is missing, how should I be interpreting the plot?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-24T11:07:30.447Z
Comments.Text: Did you actually run the ApplyBQSR tool?
Comments.UserDisplayName: Devon Ryan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-24T20:48:36.640Z
Comments.Text: I ran both `BaseRecalibrator` and `ApplyBQSR` and the BAM headers show `ApplyBQSR` has been run. Is the post calibration data only stored in the BAM files or is it also in the tables output by `BaseRecalibrator`? If the post calibration data is only in the BAM files, I'm not sure how MultiQC is supposed to know the data exists...
Comments.UserDisplayName: Tomas Bencomo
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-25T11:15:14.157Z
Comments.Text: There may be an option to have GATK output a metrics file.
Comments.UserDisplayName: Devon Ryan
Tags: <fasta><ngs><variant-calling><gatk><qc>
Title: Interpreting MultiQC plot of GATK BaseRecalibration data?
ThreadText: # Interpreting MultiQC plot of GATK BaseRecalibration data?
  
  (Asked by: username_0 on 2020-01-23)
  
  I'm using GATK4 to build a somatic variant calling pipeline. The pipeline uses MultiQC to aggregate quality control data, and one of the QC measures reported is base quality score recalibration from GATK4's `BaseRecalibraton`. The description in MultiQC says
  
  > This plot shows the distribution of base quality scores in each sample before and after base quality score recalibration (BQSR). Applying BQSR should broaden the distribution of base quality scores.
  
  [![enter image description here](https://i.sstatic.net/rxcP5.png)](https://i.sstatic.net/rxcP5.png)
  
  The black line is for my tumor sample and blue line is my normal sample. I don't understand how the before and after distributions are **both** shown in the plot as I only see 1 distribution per sample. Am I missing something, or should there be a "Post-calibration Count" plot that isn't shown? If nothing is missing, how should I be interpreting the plot?
  
  **Tags:** fasta, ngs, variant-calling, gatk, qc
  
  > **Comments:**
  > **username_1**: Did you actually run the ApplyBQSR tool?  
  > **username_0**: I ran both `BaseRecalibrator` and `ApplyBQSR` and the BAM headers show `ApplyBQSR` has been run. Is the post calibration data only stored in the BAM files or is it also in the tables output by `BaseRecalibrator`? If the post calibration data is only in the BAM files, I'm not sure how MultiQC is supposed to know the data exists...  
  > **username_1**: There may be an option to have GATK output a metrics file.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-01-27. Score: 1 | Accepted answer
  
  Turns out two recalibration tables are needed to show pre-recalibration and post-recalibration plots. I previously only had generated the pre-calibration table by running `BaseRecalibrator` on the BAM that hadn't undergone `ApplyBQSR` to adjust base scores. Here are the steps to show pre and post recalibration plots in `MultiQC`:
  
  1. Run `BaseRecalibrator` on your initial input BAM. This will create a recalibration table with the original base scores.
  2. Run `ApplyBQSR` with the recalibration table from step 1 to create a new BAM with the adjusted base quality scores.
  3. Run `BaseRecalibrator` on the adjusted BAM generated in step 2 to create a new recalibration table with the adjusted base quality scores.
  4. Use both recalibration tables as inputs to `MultiQC`. This should create both plots.
  
  > **Comments:**
  > **username_2**: hey did you method work ? I have done your steps and it does not create both plots. I believe we need to create a csv file report from `gatk AnalyzeCovariates`. Will try that now  
  > **username_0**: @alex what part does not work? Does MultiQC not create both plots even though you give it both tables as input?  
  > **username_2**: yes correct. the tables were in different directories and didn't work. I then tried to put the tables under the same directory, did not work either. then i noticed both tables had the same 'sample name'. I changed the names of the tables so multiqc would detect 2 'samples' and correctly use the tables as before and after. It also did not work. strangely their old test data for BQSR on github works. things have probaly changed since then and they did not update the code  
  > **username_0**: Not sure what the issue is then. It has been awhile since I used that MultiQC function and eventually dropped those plots from my pipeline. I would ask the creator of MultiQC, Phil Ewels for help on his Gitter. There's instructions for how to contact him Github.  
  
  ---
  
  