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


1 Answer 1


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:

enter image description here

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!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.