Question: Hello everyone,

I have RNA-seq data set that I downloaded the BAM file from GEO. I loaded BAM file into IGV but could not see any thing in IGV! I don't know whats wrong! Is my BAM file sorted? or is the created .bai file the correct one and indexed fully?! could some one help me, please?

BAM file that I downloaded from GEO is about 5GB, after loading from my local file to remote file in ssh the size is about 4.5GB

Steps that I followed:

1. I sorted BAM file using `samtools sort file_name.bam file_name.sorted` in Bitvise SSH

sorted file size: about 4.5GB

2. made index using `samtools index file name.sorted.bam`

I got the .bai file quickly with size about 13.5KB!

Then transferred all sorted,bai file into the same place that I saved BAM file on my PC and tried to visualize with IGV (Hg19)

Thank you very much for your help in advance.

Best regards

Answer: I'm going to summarize how we got to the resolution, and hopefully provide some context to help you dig deeper into your follow-up questions.

For the purposes of quick understanding, it's reasonable to consider a BAM file as a list of sequence alignments, where each alignment is composed of a single line which has exhaustive detail about the nature of the alignment to the reference. For more information, [read the SAM specification][1]. It's not long and it will provide a lot of information as to what's going on.

A BAM file is simply the compressed, non-human-readable (binary) form of a SAM file. One of the most common ways to interrogate BAM files is a very powerful command-line program called [samtools][2].

You weren't seeing any alignments at first because you weren't zoomed in far enough. The genome is HUGE compared to the length of a typical Illumina read (seven orders of magnitude larger), so unless you zoom in really far the relative length of an alignment is going to be smaller than a single pixel.

BUT! It's definitely possible that there are large regions of the genome which have poor coverage, especially if the dataset is from exome or RNA-Seq, or is WGS with lousy coverage. So just zooming in randomly, you wouldn't necessarily expect to see alignments appear.

What I asked you to do was use samtools to pull out the first few reads from your sorted BAM file. Since the BAM file was sorted, the alignments start at the beginning of chromosome 1. In the screenshot, I saw that you had some reads around base 14,000 of chromosome 1, so I asked you to jump to that area in IGV.

IGV can also search based on gene names, but remember that gene names differ based on the reference used and the entity which is cataloguing the genes. Another approach would be to use a resource like gene metabase like [GeneCards][3] to search for your gene, find a consensus start site, and then search based on that coordinate in IGV. For your SPP1 gene, it looks like the start site is at chromosome 4, base 88,896,802, so if you type `chr4:88896802` in IGV it will take you to that region of the genome.

Similarly, you can use samtools to query for alignments in a BAM file. If you wanted to find all of the alignments within the consensus start/end region of SPP1, you could type something like this:

samtools view [bamfile] chr4:88896802-88904563

That will give you all of the alignments in human-readable form. You can pipe these to a text file if you want, or use perl/python/sed/awk to pull out specific details.

[1]: http://samtools.github.io/hts-specs/SAMv1.pdf
[2]: http://samtools.sourceforge.net/samtools.shtml
[3]: http://www.genecards.org/cgi-bin/carddisp.pl?gene=SPP1&search=ad2ea86fba8fff5aeff951de700448c2