Skip to content

Lab 04: IGV

MattHuff edited this page Aug 15, 2023 · 5 revisions

After running an alignment tool, you may be interested in visualizing how your reads align with your genome of interest. A popular tool for this job is Broad Institute's Interactive Genome Viewer (IGV), a Java-based desktop application for viewing large, integrated genomics datasets. IGV supports a wide variety of data types, including the results of STAR Alignment. This Lab will teach you how to download IGV, how to load your data into IGV, and how to use IGV.

Step 1: Index BAM files

IGV requires that any BAM files loaded into IGV must be sorted and indexed. You have already completed the first step, by outputting sorted BAM files with STAR, so we will focus on indexing a file.

A BAM Index file, or BAI for short, is an external table of contents for its respective BAM file. This file contains no actual sequence data, instead containing the chromosome names for your organism of interest. On its own, a BAI file is useless, but with a corresponding BAM file, it allows programs to jump to a specific point in the BAM file without having to go through every other sequence in the file.

mkdir 04_igv
cd 04_igv
ln -s ../03_mapping_star/SRR17062759.Aligned.sortedByCoord.out.bam .

To index our bam files, run the following command:

spack load /b7zjybq
samtools index SRR17062759.Aligned.sortedByCoord.out.bam

This process takes only a few seconds. You will only get a message if there are any errors, so the job will simply stop running if everything runs smoothly.

Step 2: Access IGV

Go to IGV's web browser app. While a downloadable version is available, we prefer using this version.

Step 3: Copy BAM and Index Files

Since IGV is a desktop program, you will need to copy all of your files from the server to your personal computer.

I usually create a new directory in my Downloads folder, and load the files there. If you aren't sure where this is in relation to your default folder on terminal, you can access it by doing this:

cd ~/Downloads

Once you are within your Downloads folder, run the following commands:

scp <your_username>@centaur.ag.utk.edu:/pickett_shared/teaching/RNASeq_workshop/analysis/<your_username>/04_igv/SRR17062759.Aligned.sortedByCoord.out.bam* .

Step 4: Load Data Onto IGV

Loading a Genome Sequence

IGV allows you to load a new genome onto IGV: go to Genomes > Local File ..., and select your genome Fasta file of interest. In this lab, because we are using the TAIR 10 genome assembly, we do not have to load our genome; scroll down the list of default genomes, and select A. thaliana (TAIR 10).

Loading BAM Files and Genome Annotation

Go to Tracks > Local File ... and select one or more BAM files to load onto IGV. This will add two tracks for each BAM file - a Coverage track that shows how many reads, in total, cover a given base in the genome, and an Alignment track that shows each read in relation to the reference genome.

Navigating IGV

To zoom into a chromosome, you can use the zoom slider on the top right corner of IGV, the + or - keys on your computer, or click and drag on the genome ruler to select an area of interest.

Saving and Loading Sessions

To save your current IGV session, which will include all alignment and annotation files loaded, go to Session > Save .... To load it, simply go to Session > Local File... and select that session.