IGV Tutorial -- GVA2016
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:
- Create a custom genome database (usually used for microbial genomes) or load a pre-existing genome assembly (usually used for the genomes of model organisms and higher Eukaryotes).
- Load output from mapping reads to a reference genome.
- Load output from calling genetic variants.
- Navigate the view of the genome and interpret the display of this data.
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.
Workflow 1: Viewing E. coli data in IGV
Data files
You can start this tutorial two ways:
- If you have a
mapping
directory with output from the Mapping tutorial and the SNV calling tutorial, then you should use those files for part 1 of this tutorial. You can proceed with either one alone or with both.
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. We've already installed it into the $BI/bin directory so you don't have to, but here we provide the steps that can be used to install it in a local directory.
Readseq is written in java which makes it a little more complicated to use, but the general command to run the software is one of these (note that you do need to include the entire path, not just the "readseq.jar" name):
java -jar /corral-repl/utexas/BioITeam/bin/readseq.jar java -cp /corral-repl/utexas/BioITeam/bin/readseq.jar run
This should return the help for Readseq.
To do the conversion that we want, use this command:
cds mkdir BDIB_IGV_Tutorial cd BDIB_IGV_Tutorial java -cp /corral-repl/utexas/BioITeam/bin/readseq.jar run $SCRATCH/BDIB_bowtie2_mapping/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 using commands like head and tail.
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:
- Indexed reference FASTA files
- GFF reference sequence feature files
- Sorted and indexed mapped read BAM files
- VCF result files
- ... and possibly many other types of files.
The easiest way to to this is probably to copy everything you want to transfer into a new directory called IGV_export
. 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. To ensure you don't overwrite things be sure to use the -n or -i option with the cp command. The difference comes from different versions of linux having slightly different cp command options. The -n command will not allow you to overwrite files, while the -i command will prompt you before overwriting anything.
mkdir BDIB_IGV_export cp -i NC_012967.1.gbk.gff BDIB_IGV_export # copy the new file you just converted to the export directory cp -i $SCRATCH/BDIB_bowtie2_mapping/NC_012967.1.fasta BDIB_IGV_export cp -i $SCRATCH/BDIB_samtools_tutorial/NC_012967.1.fasta.fai BDIB_IGV_export cp -i $SCRATCH/BDIB_samtools_tutorial/SRR030257.vcf BDIB_IGV_export cp -i $SCRATCH/BDIB_samtools_tutorial/SRR030257.sorted.bam BDIB_IGV_export/bowtie2.sorted.bam cp -i $SCRATCH/BDIB_samtools_tutorial/SRR030257.sorted.bam.bai BDIB_IGV_export/bowtie2.sorted.bam.bai tar -czvf BDIB_IGV_export.tar.gz BDIB_IGV_export
Now, copy the entire compressed IGV directory back to your local Desktop machine.
Launching IGV
For the remainder of the tutorial, work on your local machine. NOT TACC!
There are multiple ways to launch IGV on a local computer, in decreasing order of recommendation due to recent mac OS updates and easy of use:
Load genome into IGV
From the main window of IGV, click on Genomes > Create .genome File... 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. Click OK and then save this *.genome file inside the same folder as your data.
Load mapped reads into IGV
From the main window of IGV, click on File > Load from File.... Choose bowtie2.sorted.bam
After importing your reference genome and loading an alignment file, click on the + button in the upper right until reads appear! Then, your screen should look similar to the following:
Load variant calls into IGV
We're really interested in places in the genome where we think there are mutations. In the Variant calling tutorial we identified such locations but lacked a good way to visualize them. This is your opportunity to visualize them. We have already transferred the SRR030257.vcf
file back to your local computer, but before we can visualize them, we need to (guess what?) index it.
You can do this from within IGV:
- Choose Tools > Run igvtools....
- Choose "index" from the commands drop-down menu.
- Select the
SRR030257.vcf
file for "Input File" - Click the "run" button.
It will look like nothing has happened aside from the appearance of "Done" in the messages box, but you can now close the "Run" window and choose File > Load from File. If you navigate to your IGV directory, you will now see a brand new SRR030257.vcf.idx
file. You can now load the SRR030257.vcf
file, 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 at TACC. Indexing BAM files can be a computationally hefty task.
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:
- Zoom in using the slider in the upper right. Do this until you see mapped reads and finally individual bases appear.
- Navigate by clicking and dragging in the window. This is how you move left and right along the genome.
- Navigate more quickly. Use
page-up
page-down
,home
,end
. - Jump to the next point of interest. Click on a track name on the left side of the window (Ex: SRR030257.vcf), to select it. You can then use
control-f
andcontrol-b
to jump forward and backward within that list of features. Try this on the variant calls track. - Jump right to a gene. (If you have gene features loaded.) Type its name into the search box. Try "topA".
- Load multiple BAM alignments or VCF files at once. Try this to compare a few different regions between the bowtie and BWA results.
- Change the appearance of genes. Right click on the gene track and try "expanded". Experiment with the other options.
- Change the appearance of reads. Right click on a BAM track and choose "show all bases" and "expanded". Experiment with the other options.
See the IGV Manual for more tips and how to load other kinds of data.
Exercises
- Why are some reads different colors? Hint: Try changing the display options to show read pairs and editing some of the distance constraints.
What is a typical mapping quality (MQ) for a read? Convert this to the probability that it is mismapped.
Can you find a variant where the sequenced sample differs from the reference? This would be like looking for a needle in a haystack if not for the use of variant callers and the
control-f
andcontrol-b
options to zoom right to areas where there are discrepancies between reads and the reference genome that might indicate there were mutations in the sequenced E. coli.
Workflow 2: Viewing Human Genome Data in IGV
Now that you've familiarized yourself with IGV using a "simple" bacteria, let's look at something a "little" more complex: the human genome.
Advanced exercise: human data scavenger hunt
Data from the 1000 Genomes Project can be found directly from the Broad's server for IGV. There are now MANY genomes available this way.
Find one or more dbSNP accession numbers for SNPs apparent in one of the two 1000 genomes project trios in the GABBR1 gene.
Steps:
- Download and install the Integrative Genome Viewer from the Broad Institute.
- Select "Human hg19" as the reference genome from the top left drop down (you may need to select "more" to have hg19 as an option)
- Get some data: File > Load from Server… > 1000 genomes > Alignments > ACB > exome > HG01880
- Navigate to the rightmost exons of the GABBR1 gene.
- Zoom in until you find some SNPs. (Hint look just to the left of the 2nd exon).
- What type of library is this? (Hint: zoom out)
- If you knew this was a cancer patient, consider how strongly you would think this may be a potentially causative mutation.
- Imagine it was actually in the exon rather than just into the intron... would that make you consider it more?
- Load and look at the SNP track: File > Load from server > Annotations > Variants and Repeats > dbSNP 1.3.7
- The track may load with the Refseq genes, making it useful to resize that window to view both the gene and the dbSNP information simultaneously.
- Consider if this makes you think it more likely or less likely that this is a causative mutation.
Optional Tutorial Exercises ...
You can use IGV to visualize mapped reads and predicted variants from any later tutorial!
You may also want to check out alternative genome browsers:
Welcome to the University Wiki Service! Please use your IID (yourEID@eid.utexas.edu) when prompted for your email address during login or click here to enter your EID. If you are experiencing any issues loading content on pages, please try these steps to clear your browser cache.