Answers.Body: <p>I found that <a href="https://github.com/google/deepvariant/issues/318" rel="nofollow noreferrer">deepvariant does indeed not have this option</a>. What I am looking for is apparently equivalent to the BP resolution option of GATK<br />
  <code>-ERC BP_RESOLUTION</code>.</p>
  <p>The work around is to go into the bam files, and get the coverage per site. I am using <a href="https://github.com/telatin/BamToCov" rel="nofollow noreferrer">bamtocov</a>. But I might consider another one, since this one is extremely slow (even with multiple threads).</p>
  <p>Edit: <a href="https://github.com/telatin/BamToCov" rel="nofollow noreferrer">bamtocov</a> took more than 6 hours and still was only at 1/4 through the bam file. I used samtools like Yossi Farjoun suggested.</p>
  <pre><code>samtools depth {input.bam} -b {input.targets} --threads {threads} --min-BQ {params.baseq} --min-MQ {params.mapq} -J -o {output}
  </code></pre>
  <p>It does have more options to control what is counted, like base quality, mapping quality, and if to include reads with deletions in depth computation.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-05T07:27:36.920Z
Answers.LastActivityDate: 2024-06-06T07:55:30.057Z
Answers.LastEditDate: 2024-06-06T07:55:30.057Z
Answers.UserDisplayName: Dandelion
Answers.Body: <p>You would need to force an output for every site where you want depth information. if you just want depth, you can run samtools, but variant calling tools often take other things into account (base-quality, mapping, overlapping mates, etc) when calculating depth, so if you want <em>that</em> depth, with all the bells and whistles, you'll need to force an output on every base. I know this is possible with GATK, but I don't know about deep-variant.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-04T16:56:39.600Z
Answers.LastActivityDate: 2024-06-04T16:56:39.600Z
Answers.UserDisplayName: Yossi Farjoun
Body: <p>I am using <a href="https://github.com/google/deepvariant" rel="nofollow noreferrer">deepvariant</a> to calls variants on my (WES) data. I am outputting a gvcf file.</p>
  <p>I am wondering (I cannot find anything in the documentation) how it would be possible to get the true depth per site in the gvcf file and not only the min_dp per block. Currently I am converting the gvcf into vcf with <a href="https://samtools.github.io/bcftools/bcftools.html" rel="nofollow noreferrer">bcftools</a> for comparisons, but is there a way to calculate back what the true depth is for a site by adding some additional output to the gvcf file of some calculations?</p>
  <p>Edit, the code I used:</p>
  <pre><code>/opt/deepvariant/bin/run_deepvariant --model_type={params.model} --ref={input.ref} --reads={input.bam} --output_vcf={output.vcf} --output_gvcf={output.gvcf} --num_shards {threads} --logging_dir={log}
  
  bcftools convert --gvcf2vcf {input.gvcf} --fasta-ref {input.new_genome} --threads {threads} 2&gt; {log.convert}
  </code></pre>
  <p>The file I get (in part):</p>
  <pre><code>chr1    69043   .   G   &lt;*&gt; 0   .   .   GT:GQ:MIN_DP:PL 0/0:12:4:0,12,119
  chr1    69044   .   C   &lt;*&gt; 0   .   .   GT:GQ:MIN_DP:PL 0/0:12:4:0,12,119
  chr1    69045   .   A   &lt;*&gt; 0   .   .   GT:GQ:MIN_DP:PL 0/0:12:4:0,12,119
  chr1    69046   .   G   &lt;*&gt; 0   .   .   GT:GQ:MIN_DP:PL 0/0:12:4:0,12,119
  chr1    69047   .   A   &lt;*&gt; 0   .   .   GT:GQ:MIN_DP:PL 0/0:12:4:0,12,119
  chr1    21474900    .   A   G,&lt;*&gt;   64.3    PASS    .   GT:GQ:DP:AD:VAF:PL  0/1:63:91:49,41,0:0.450549,0:64,0,67,990,990,990
  </code></pre>
  <p>The non-variant sites have a MIN_DP that corresponds to the minimum depth in that block. So not per site. Compared to the variant that has a DP specific to that site.</p>
  <p>Thanks in advance,</p>
  
Tags: <vcf><variant-calling><bcftools>
Title: true depth per gvcf location instead of min depth per gvcf block
ThreadText: # true depth per gvcf location instead of min depth per gvcf block
  
  (Asked by: username_0 on 2024-06-03)
  
  I am using [deepvariant](https://github.com/google/deepvariant) to calls variants on my (WES) data. I am outputting a gvcf file.
  
  I am wondering (I cannot find anything in the documentation) how it would be possible to get the true depth per site in the gvcf file and not only the min\_dp per block. Currently I am converting the gvcf into vcf with [bcftools](https://samtools.github.io/bcftools/bcftools.html) for comparisons, but is there a way to calculate back what the true depth is for a site by adding some additional output to the gvcf file of some calculations?
  
  Edit, the code I used:
  
  ```
  /opt/deepvariant/bin/run_deepvariant --model_type={params.model} --ref={input.ref} --reads={input.bam} --output_vcf={output.vcf} --output_gvcf={output.gvcf} --num_shards {threads} --logging_dir={log}
  
  bcftools convert --gvcf2vcf {input.gvcf} --fasta-ref {input.new_genome} --threads {threads} 2> {log.convert}
  
  ```
  
  The file I get (in part):
  
  ```
  chr1    69043   .   G   <*> 0   .   .   GT:GQ:MIN_DP:PL 0/0:12:4:0,12,119
  chr1    69044   .   C   <*> 0   .   .   GT:GQ:MIN_DP:PL 0/0:12:4:0,12,119
  chr1    69045   .   A   <*> 0   .   .   GT:GQ:MIN_DP:PL 0/0:12:4:0,12,119
  chr1    69046   .   G   <*> 0   .   .   GT:GQ:MIN_DP:PL 0/0:12:4:0,12,119
  chr1    69047   .   A   <*> 0   .   .   GT:GQ:MIN_DP:PL 0/0:12:4:0,12,119
  chr1    21474900    .   A   G,<*>   64.3    PASS    .   GT:GQ:DP:AD:VAF:PL  0/1:63:91:49,41,0:0.450549,0:64,0,67,990,990,990
  
  ```
  
  The non-variant sites have a MIN\_DP that corresponds to the minimum depth in that block. So not per site. Compared to the variant that has a DP specific to that site.
  
  Thanks in advance,
  
  **Tags:** vcf, variant-calling, bcftools
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2024-06-05. Score: 2
  
  I found that [deepvariant does indeed not have this option](https://github.com/google/deepvariant/issues/318). What I am looking for is apparently equivalent to the BP resolution option of GATK  
  `-ERC BP_RESOLUTION`.
  
  The work around is to go into the bam files, and get the coverage per site. I am using [bamtocov](https://github.com/telatin/BamToCov). But I might consider another one, since this one is extremely slow (even with multiple threads).
  
  Edit: [bamtocov](https://github.com/telatin/BamToCov) took more than 6 hours and still was only at 1/4 through the bam file. I used samtools like username_1 username_1 suggested.
  
  ```
  samtools depth {input.bam} -b {input.targets} --threads {threads} --min-BQ {params.baseq} --min-MQ {params.mapq} -J -o {output}
  
  ```
  
  It does have more options to control what is counted, like base quality, mapping quality, and if to include reads with deletions in depth computation.
  
  
  ---
  
  ### Answer by username_1 on 2024-06-04. Score: 2
  
  You would need to force an output for every site where you want depth information. if you just want depth, you can run samtools, but variant calling tools often take other things into account (base-quality, mapping, overlapping mates, etc) when calculating depth, so if you want *that* depth, with all the bells and whistles, you'll need to force an output on every base. I know this is possible with GATK, but I don't know about deep-variant.
  
  
  ---
  
  