<p>Partially a shameless plug... I've written a genome browser, <a href="http://asciigenome.readthedocs.io/en/latest/" rel="noreferrer">ASCIIGenome</a>, entirely controlled through the command line. As such, it makes relatively easy to deal with questions like yours. For example, you could do: </p>

<pre><code>ASCIIGenome bam/WW00292a.bam  # Load bam file(s)
</code></pre>

<p>Filter for reads matching the regex passed to <code>-i</code> option:</p>

<pre><code>[h] for help: grep -i '72789|57688|70785|56299|27116|12086'
</code></pre>

<p>(Optionally, show sam records as strings)</p>

<pre><code>[h] for help: print
</code></pre>

<p>Example result:</p>

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

<p>For command help type <code>grep -h</code> and for more filtering options see also <code>awk -h</code>.</p>

<p>Hope this helps and feel free to post questions and open issues on github!</p>

CC BY-SA 3.0
2018-01-05T09:47:22.237Z
2018-01-05T09:47:22.237Z
dariober
<p>I have a large BAM file on my IGV. I'd like to visualize a read alignment. I have the read name, and I don't care anything else in the file.</p>

<p>IGV has an option "Select by name" (see screenshot). The problem is that IGV doesn't hide the alignments not matching the name. I'd still have to <strong>manually navigate</strong> on IGV with my mouse to find my read.</p>

<p>That was too cumbersome. What I'm  doing now is make a new alignment BAM file. For example,</p>

<p><code>samtools view -h L.V.51.bam | grep '@\|HWI-D00119:228:CB08RANXX:8:2116:4095:45403' | samtools view -bS - | samtools sort - &gt; new.bam</code></p>

<p>I'd load the new alignment file on my IGV.</p>

<p>If I have 20 reads, I'd have to create 20 new BAM files... Is there anything I can do on IGV that I'm not aware of?</p>

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

<igv>
How to show only my read on IGV?
# How to show only my read on IGV?

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

I have a large BAM file on my IGV. I'd like to visualize a read alignment. I have the read name, and I don't care anything else in the file.

IGV has an option "Select by name" (see screenshot). The problem is that IGV doesn't hide the alignments not matching the name. I'd still have to **manually navigate** on IGV with my mouse to find my read.

That was too cumbersome. What I'm doing now is make a new alignment BAM file. For example,

`samtools view -h L.V.51.bam | grep '@\|HWI-D00119:228:CB08RANXX:8:2116:4095:45403' | samtools view -bS - | samtools sort - > new.bam`

I'd load the new alignment file on my IGV.

If I have 20 reads, I'd have to create 20 new BAM files... Is there anything I can do on IGV that I'm not aware of?

[![enter image description here](https://i.sstatic.net/ZBqFb.png)](https://i.sstatic.net/ZBqFb.png)

**Tags:** igv

---

## 1 answers

### Answer by username_1 on 2018-01-05. Score: 7

Partially a shameless plug... I've written a genome browser, ASCIIGenome, entirely controlled through the command line. As such, it makes relatively easy to deal with questions like yours. For example, you could do: 
ASCIIGenome bam/WW00292a.bam  # Load bam file(s)

Filter for reads matching the regex passed to -i option:
[h] for help: grep -i '72789|57688|70785|56299|27116|12086'

(Optionally, show sam records as strings)
[h] for help: print

Example result:

For command help type grep -h and for more filtering options see also awk -h.
Hope this helps and feel free to post questions and open issues on github!


---

