<p><a href="https://github.com/dariober/ASCIIGenome" rel="nofollow noreferrer">ASCIIGenome</a> (I'm the author) has a command, <a href="http://asciigenome.readthedocs.io/en/latest/commandHelp.html#filtervariantreads" rel="nofollow noreferrer">filterVariantReads</a>, designed to inspect reads having a variant at a position or range. It would go along these lines:</p>

<pre><code>ASCIIGenome -fa genome.fa aln.bam
</code></pre>

<p>Then go to the region of interest and use:</p>

<pre><code>goto chr9:4917981-4918161
filterVariantReads -r 4918011
</code></pre>

<p>From this:</p>

<p><a href="https://i.sstatic.net/VigzQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VigzQ.png" alt="enter image description here"></a></p>

<p>You get:</p>

<p><a href="https://i.sstatic.net/lxoW2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lxoW2.png" alt="enter image description here"></a></p>

<p>You can also print to screen or save to file the underlying sam records with:</p>

<pre><code>print &gt; reads.sam
</code></pre>

<p>For several regions, the whole process can be scripted for automation.</p>

<p>Hope this helps!</p>

CC BY-SA 4.0
2021-06-10T06:52:07.170Z
Hello, I am having a trouble to download this tool neither with conda nor from the source code. The .jar file is missing...
user3224522
CC BY-SA 4.0
2021-06-10T07:44:45.497Z
@user3224522 What have you tried? The zip file [ASCIIGenome-1.16.0.zip](https://github.com/dariober/ASCIIGenome/releases/download/v1.16.0/ASCIIGenome-1.16.0.zip) should contain what you need. `conda install asciigenome` should also work. Please submit an issue to [GitHub](https://github.com/dariober/ASCIIGenome/issues) or post a question with more detail.
dariober
CC BY-SA 3.0
2018-01-15T20:00:03.513Z
2018-01-15T20:00:03.513Z
dariober
<p>The variant record in the VCF produced by GATK should include information about depth -- both total read depth (DP) and allelic depth (AD), ie depth per allele. </p>

<p>Keep in mind however that the caller makes its decision based on more than just allelic depth. There are some additional statistics involved, including the quality of the individual bases. Also, if any filtering was applied, your variant may have been excluded due to other statistics, like for example if there is evidence of strand bias -- eg if all the reads supporting your variant are in the same orientation, that is a classic red flag suggesting it's an artifact.</p>

CC BY-SA 4.0
2020-04-23T17:54:52.713Z
2020-04-23T17:54:52.713Z
Geraldine_VdAuwera
<p>If you don't mind a bit of manual counting, then <code>samtools mpileup -f reference.fa -r chr22:425236-425236 alignments.bam</code> will produce output where you can count the bases for that position. You could, of course, use the command line to do most of that automatically:</p>

<pre><code>samtools mpileup -f reference.fa -r chr22:425236-425236 alignments.bam |
    cut -f 5 | tr '[a-z]' '[A-Z]' | fold -w 1 | sort | uniq -c
</code></pre>

<p>That'll give you a count of how many of each base were seen.</p>

CC BY-SA 3.0
2018-01-15T10:39:33.430Z
2018-01-15T10:44:20.830Z
2018-01-15T10:44:20.830Z
Devon Ryan
<p>I am calling variants from a human sample using bwa mem to align the reads and gatk to call the variants. I'm trying to understand why a specific variant was not called in my sample. I have checked the bam alignments in a GUI viewer and I can see that there are reads supporting the missing variant. It looks like the issue is a low allelic balance, with far more reads supporting the reference than the alternate allele but I want to get the actual numbers. </p>

<p>So, given a specific variant like this:</p>

<pre><code>chr22   425236  C T
</code></pre>

<p>How can I count the number of reads in my <code>sample.bam</code> file that support that variant and the number that don't on Linux?</p>

<sam><ngs><variant-calling>
How can I count the number of reads that support a variant in a bam file?
# How can I count the number of reads that support a variant in a bam file?

(Asked by: username_0 on 2018-01-15)

I am calling variants from a human sample using bwa mem to align the reads and gatk to call the variants. I'm trying to understand why a specific variant was not called in my sample. I have checked the bam alignments in a GUI viewer and I can see that there are reads supporting the missing variant. It looks like the issue is a low allelic balance, with far more reads supporting the reference than the alternate allele but I want to get the actual numbers. 
So, given a specific variant like this:
chr22   425236  C T

How can I count the number of reads in my sample.bam file that support that variant and the number that don't on Linux?

**Tags:** sam, ngs, variant-calling

---

## 3 answers

### Answer by username_4 on 2018-01-15. Score: 8 | Accepted answer

If you don't mind a bit of manual counting, then samtools mpileup -f reference.fa -r chr22:425236-425236 alignments.bam will produce output where you can count the bases for that position. You could, of course, use the command line to do most of that automatically:
samtools mpileup -f reference.fa -r chr22:425236-425236 alignments.bam |
    cut -f 5 | tr '[a-z]' '[A-Z]' | fold -w 1 | sort | uniq -c

That'll give you a count of how many of each base were seen.


---

### Answer by username_1 on 2018-01-15. Score: 4

ASCIIGenome (I'm the author) has a command, filterVariantReads, designed to inspect reads having a variant at a position or range. It would go along these lines:
ASCIIGenome -fa genome.fa aln.bam

Then go to the region of interest and use:
goto chr9:4917981-4918161
filterVariantReads -r 4918011

From this:

You get:

You can also print to screen or save to file the underlying sam records with:
print > reads.sam

For several regions, the whole process can be scripted for automation.
Hope this helps!

> **Comments:**
> **username_2**: Hello, I am having a trouble to download this tool neither with conda nor from the source code. The .jar file is missing...  
> **username_1**: @user3224522 What have you tried? The zip file [ASCIIGenome-1.16.0.zip](https://github.com/dariober/ASCIIGenome/releases/download/v1.16.0/ASCIIGenome-1.16.0.zip) should contain what you need. `conda install asciigenome` should also work. Please submit an issue to [GitHub](https://github.com/dariober/ASCIIGenome/issues) or post a question with more detail.  

---

### Answer by username_3 on 2020-04-23. Score: 0

The variant record in the VCF produced by GATK should include information about depth -- both total read depth (DP) and allelic depth (AD), ie depth per allele.

Keep in mind however that the caller makes its decision based on more than just allelic depth. There are some additional statistics involved, including the quality of the individual bases. Also, if any filtering was applied, your variant may have been excluded due to other statistics, like for example if there is evidence of strand bias -- eg if all the reads supporting your variant are in the same orientation, that is a classic red flag suggesting it's an artifact.


---

