Overview

The Integrative Genomics Viewer (IGV) from the Broad Center allows you to view several types of data files involved in any NGS analysis that employs a reference genome, including how reads from a dataset are mapped, gene annotations, and predicted genetic variants.

Learning Objectives

In this tutorial, we're going to learn how to do the following in IGV:

Theory

Because NGS datasets are very large, it is often impossible or inefficient to read them entirely into a computer's memory when searching for a specific piece of data. In order to more quickly retrieve the data we are interested in analyzing or viewing, most programs have a way of treating these data files as databases. Database indexes enable one to rapidly pull specific subsets of the data from them.

The Integrative Genomics Viewer is a program for reading several types of indexed database information, including mapped reads and variant calls, and displaying them on a reference genome. It is invaluable as a tool for viewing and interpreting the "raw data" of many NGS data analysis pipelines.

Table of Contents

Workflow 1: Viewing E. coli data in IGV

Data files

You can start this tutorial two ways:

  1. If you have an intro_to_mapping directory with output from the Mapping tutorial or the Variant calling tutorial, then you should use those files for part 1 of this tutorial. You can proceed with either one alone or with both.
  2. If you do not have any results, you can use some "canned" ones that we provide. Copy the entire contents of this directory back to your local machine:
    $BI/ngs_course/intro_to_mapping/IGV
    
    Then skip down to #Launching IGV.

Prepare a GFF feature file for the reference sequence

IGV likes its reference genome files in GFF (Gene Feature Format). Unfortunately, our old friend bp_seqconvert.pl doesn't do GFF. So, we're going to show you another tool for sequence format conversion called Readseq.

Readseq is written in java. To use it you need to first download the file readseq.jar linked from here.

To get this onto TACC easily, use:

wget http://iubio.bio.indiana.edu/soft/molbio/readseq/java/readseq.jar

The general command to run the software is one of these:

java -jar readseq.jar
java -cp readseq.jar run

This should return the help for Readseq.

(Why the funny invocation? You are actually using the command java and telling it where to find a "jar" file of java code to run. The -jar and -cp options run it in different ways. It's pretty confusing.)

To do the conversion that we want, use this command:

java -cp readseq.jar run NC_012967.1.gbk -f GFF -o NC_012967.1.gbk.gff

It's a bit hard to figure out because, unlike most conventions, it takes the unnamed arguments before the optional flag arguments, there is no example command, and you have to switch -jar to -cp. Search online for usage examples when you can't figure something out from the help.

Take a look at the contents of the original Genbank file and the new GFF file and try to get a handle on what is going on in this conversion.

Another useful trick with either IGV or UCSC: displaying your own BLAST results: BioPerl allows for super-easy conversion from blast output to a gff file; IGV and the UCSC browser both understand GFF files. The short script bl2gff.pl does the conversion.

Let's use the blast result we had from the earlier test for the JAG1 gene to show you how. You'll need to provide the input file - it's the ".oNNNNNN" output file from your blast job.

grep '^gi' blast_jag1.o586038 > jag1_blast.out
module load perl
module load bioperl
bl2gff.pl jag1_blast.out > jag1_blast.out.gff

The resulting jag1_blast.out.gff can be moved to your local machine and opened in IGV. Load the human reference first though!

If you have only done the mapping tutorial and NOT the variant calling tutorial

You will need to index your reference FASTA and convert your SAM output files into sorted and indexed BAM files. The "why?" behind these steps is described more fully in the Variant calling tutorial. If you are in your intro_to_mapping directory, these commands will perform the necessary steps.

samtools faidx NC_012967.1.fasta
samtools view -b -S -o bowtie/SRR030257.bam bowtie/SRR030257.sam
samtools sort bowtie/SRR030257.bam bowtie/SRR030257.sorted
samtools index bowtie/SRR030257.sorted.bam

Repeat the last three commands for each SAM output file that you want to visualize in IGV.

Copy files to your desktop

IGV is an interactive graphical viewer program. You can't run it on TACC, so we need to get the relevant files back to your desktop machine.

They include:

The easiest way to to this is probably to copy everything you want to transfer into a new directory called IGV. Since many of the tutorial output files had the same names (but resided in different directories) be careful to give them unique destination names when you copy them into the new directory together.

For starters, you could change into your intro_to_mapping directory and run commands like these if you just came from the Mapping tutorial:

mkdir IGV
cp NC_012967.1.fasta IGV
cp NC_012967.1.fasta.fai IGV
cp NC_012967.1.gbk.gff IGV
cp bowtie/SRR030257.sorted.bam IGV/bowtie.sorted.bam
cp bowtie/SRR030257.sorted.bam.bai IGV/bowtie.sorted.bam.bai
...

Now, copy this entire IGV directory back to your local Desktop machine.

In the terminal connected to Lonestar, figure out the complete path to the IGV directory.

pwd

Open a new terminal window on your Desktop. Fill in the parts in brackets <> in this command:

scp -r <username>@lonestar.tacc.utexas.edu:</full/path/to/IGV/> .

Launching IGV

There are two ways; Launching IGV in your web browser or by downloading the binaries locally and running IGV from your machine.

In Browser

Navigate a web browser to this page:http://www.broadinstitute.org/software/igv/download

Go ahead and click on the "Launch with 2 GB" option. This will download a "Java Web Start" file that you can launch by locating it on your Desktop and double-clicking.

Locally on the classroom machines booted in Linux

wget http://www.broadinstitute.org/igv/projects/downloads/IGV_2.3.5.zip
unzip IGV_2.3.5.zip
cd IGV_2.3.5
java -Xmx2g -jar igv.jar

Locally on your own Mac or Windows computer

Use this link to download IGV:

http://www.broadinstitute.org/igv/projects/downloads/IGV_2.3.5.zip

After unzipping, you should be able to click on igv.bat for Windows or igv.command on MacOSX to lauch IGV. If this is not working, you might need to try the web start.

Load genome into IGV

From the main window of IGV, click on File ? Import Genome... and you should be presented with the following window.

Enter the ID and Name of the Genome you are working with (these can be anything that makes sense to you) and select the path to your *.fasta file (the index, *.fai file needs to be in the same directory), then select the path to your *.gff file for the Gene File.

Load mapped reads into IGV

From the main window of IGV, click on File ? Load from File.... Choose bowtie.sorted.bam

After importing your reference genome and loading an alignment file, your screen should look similar to the following:

And you are now free to investigate different areas and their alignments in the genome.

Navigating in IGV

There are a lot of things you can do in IGV. Here are a few:

See the IGV Manual for more tips and how to load other kinds of data.

Exercises

Load variant calls into IGV

We're really interested in places in the genome where we think there are mutations. If you have completed the Variant calling tutorial, then you can load your VCF files to check out those spots, but first you need to (guess what?) index it.

You can do this from within IGV:

  1. Choose File ? Run igvtools....
  2. Choose "index" from the commands drop-down menu.
  3. Select your *.vcf file (Ex: bowtie.vcf) for "Input File"
  4. Click the "run" button.

It will look like nothing has happened, but you can now close the "Run" window and choose File ? Load File. If you navigate to your IGV directory, you will now see a brand new bowtie.vcf.idx file. You can now load the file bowtie.vcf, and it will show up as a new track near the top of your window.

Tip: You can also index BAM and FASTA files the same way inside of IGV if you haven't already created indexes for them. But, it's usually easier and quicker to do this on the command line.

Exercises

Workflow 2: Viewing Human Genome Data in IGV

If you've made it through the other exercises on your own data, take a look at some human genome re-sequencing data where the files can be loaded directly from public databases.

Advanced exercise: human data scavenger hunt

Data from the CEU trio from the 1000 Genomes Project can be found directly from the Broad's server for IGV. There are now MANY genomes available this way - one of the original family trios are represented in samples NA12892, NA12891, and NA12878 (mom, dad, child respectively).

Find one or more dbSNP accession numbers for SNPs apparent in one of the two 1000 genomes project trios in the GABBR1 gene.

Steps:

  1. Download and install the Integrative Genome Viewer from the Broad Institute.
  2. Select "Human hg18" as the reference genome
  3. Get some data: File ? “Load from Server…” ? 1000 genomes ? CEU -> select those 3 samples
  4. Navigate to the GABBR1 gene and the rightmost exons
  5. Zoom in until you find some SNPs
  6. Load and look at the SNP track: File ? Load from server ? Annotations ? Variants ? dbSNP

This is whole genome coverage data; later we'll look at exome data.

rs29220, rs29222, rs28359988 there might be more in the locus; I got tired of looking.

Is there an alternate allele in the child which correlates with one or both of the parents? (i.e. - do genetics work?)

From here...

You can also use IGV to visualize RNA-seq data in later tutorials.

Check out alternative genome browsers: