Answers.Body: <p>This is purely a guess based on what you write given that you are not showing the exact command for samtools etc.</p>
  <p>I suspect that you are allowing sequences with MAPQ==0 (supplementary alignments) into your depth calculation. A brief google search tells me that <a href="https://www.biostars.org/p/350188/" rel="nofollow noreferrer">this issue has been previously observed</a> with <code>samtools depth</code>.</p>
  <p>In principle, you should be able to see this directly in IGV, by controlling how supplementary alignments are displayed.</p>
  <p>This is something that <a href="http://www.htslib.org/doc/samtools-depth.html" rel="nofollow noreferrer">you can directly control with the <code>-Q</code> flag</a>, to restrict it to uniquely mapping reads (where you set the flag to e.g. <code>-Q 1</code> or higher).</p>
  <p>I'd suggest trying to play with <code>samtools depth</code> parameters and seeing if you can bring it more into alignment.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-06T20:10:05.150Z
Answers.LastActivityDate: 2024-02-06T20:10:05.150Z
Answers.UserDisplayName: Maximilian Press
Body: <p>I'm encountering a discrepancy in the depth of coverage assessment for specific coordinates when comparing results obtained from pileup files and samtools depth.</p>
  <p>I've processed pileup files and extracted coverage information for a given coordinate, resulting in a coverage depth of <strong>8028</strong>. However, when using samtools depth on the same coordinate, the coverage depth is reported as <strong>88565</strong>.</p>
  <p>My analysis involves the following steps:</p>
  <p>Alignment of paired-end reads using bwa mem.
  Generation of pileup files and extraction of coverage information.
  Utilizing samtools depth to calculate coverage depth for the same coordinates.
  Visual inspection in IGV for validation, where I observe that the number of reads aligning to the region matches the count obtained from samtools depth.
  I've noticed that in this region, there are no structural variations. The versions of samtools I'm using are samtools 1.19.2.</p>
  <p>Could you please help me understand the potential reasons for such big discrepancies? What parameters should I review, and could the differences be attributed to any specific factors?</p>
  <p>Thank you for your assistance!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-03T21:58:08.800Z
Comments.Text: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Comments.UserDisplayName: Community
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-04T18:55:56.167Z
Comments.Text: How are you generating the pileup files? Can you please show the command line steps you use in your analysis to generate these pileup files & depth calculations?
Comments.UserDisplayName: gringer
Tags: <samtools><coverage><mpileup>
Title: Discrepancy in Depth of Coverage Estimation between Pileup and samtools depth
ThreadText: # Discrepancy in Depth of Coverage Estimation between Pileup and samtools depth
  
  (Asked by: username_0 on 2024-02-03)
  
  I'm encountering a discrepancy in the depth of coverage assessment for specific coordinates when comparing results obtained from pileup files and samtools depth.
  
  I've processed pileup files and extracted coverage information for a given coordinate, resulting in a coverage depth of **8028**. However, when using samtools depth on the same coordinate, the coverage depth is reported as **88565**.
  
  My analysis involves the following steps:
  
  Alignment of paired-end reads using bwa mem.
  Generation of pileup files and extraction of coverage information.
  Utilizing samtools depth to calculate coverage depth for the same coordinates.
  Visual inspection in IGV for validation, where I observe that the number of reads aligning to the region matches the count obtained from samtools depth.
  I've noticed that in this region, there are no structural variations. The versions of samtools I'm using are samtools 1.19.2.
  
  Could you please help me understand the potential reasons for such big discrepancies? What parameters should I review, and could the differences be attributed to any specific factors?
  
  Thank you for your assistance!
  
  **Tags:** samtools, coverage, mpileup
  
  > **Comments:**
  > **username_1**: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.  
  > **username_2**: How are you generating the pileup files? Can you please show the command line steps you use in your analysis to generate these pileup files & depth calculations?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2024-02-06. Score: 1
  
  This is purely a guess based on what you write given that you are not showing the exact command for samtools etc.
  
  I suspect that you are allowing sequences with MAPQ==0 (supplementary alignments) into your depth calculation. A brief google search tells me that [this issue has been previously observed](https://www.biostars.org/p/350188/) with `samtools depth`.
  
  In principle, you should be able to see this directly in IGV, by controlling how supplementary alignments are displayed.
  
  This is something that [you can directly control with the `-Q` flag](http://www.htslib.org/doc/samtools-depth.html), to restrict it to uniquely mapping reads (where you set the flag to e.g. `-Q 1` or higher).
  
  I'd suggest trying to play with `samtools depth` parameters and seeing if you can bring it more into alignment.
  
  
  ---
  
  