How to Customize Tracks in IGV
By Dr. Zubair Khalid, DVM, MS, PhD ·

By the end of this guide you will be able to load BAM, VCF, and BED files into IGV and control how each track looks and behaves. You will change track height, display mode, color rules, sorting, grouping, filters, data ranges, and visibility windows. You will also save a reproducible session and run the same view from a batch script.
You need IGV 2.x installed with a current Java runtime, a reference genome in FASTA format or a hosted genome, and indexed data files. The examples use samtools, bcftools, bgzip, tabix, and standard shell tools. Install those before you start if you want to run the preparation and verification commands exactly as written.
What a Track Actually Is in IGV
A track is a data file plus a set of display attributes. The file supplies the data. The attributes decide how the data appear: height, color, scale, grouping, sorting, and visibility. IGV separates global defaults from per-track settings. Global defaults live under View > Preferences > Tracks. Per-track settings live in the right-click menu for that track. A saved session stores the per-track settings and the file locations.
That separation matters because most "my track looks wrong" problems are data problems or display problems. A missing index, an unsorted file, a contig mismatch, a collapsed track, or a data range that clips the signal can all look like a broken track. Fix the data problem first. Display settings cannot repair an unindexed or unsorted file.
Genomic data come in formats that serve different purposes, from raw sequence to aligned reads to variant calls [1]. IGV reads the formats that are already position-sorted and indexed. The common ones are below.
- FASTA: reference sequence. IGV loads a FASTA as the genome, not as a data track. A FASTA index (
.fai) is required. - BAM: binary alignment map, compressed aligned reads. A
.baiindex is required. BAM files are routinely visualized in genome browsers, which is one reason the format became a common currency for aligned data [2]. - VCF: variant call format, text, 1-based. Compress with
bgzipand index withtabixto produce.tbior.csi. - BED: browser extensible data, text, 0-based half-open intervals. Sort by chromosome and start, then compress and index.
- bigWig: binary coverage or signal track. No separate index is needed. BigWig is a common format for quantitative signal in genome browsers [3].
- GFF3 or GTF: gene annotation, 1-based and position-sorted.
- FASTQ: raw reads plus per-base quality scores. IGV does not render FASTQ as a track.
The FASTQ versus FASTA distinction trips up new users. FASTA stores sequence only, with a header line and wrapped bases. FASTQ stores sequence plus a quality string for every base. A FASTQ record has four lines: header, sequence, separator, quality. A FASTA record has two or more lines: header plus sequence. Neither is a track format in IGV. FASTA is a reference input. FASTQ is an alignment input for a mapper such as BWA or minimap2. If you drag a FASTQ into IGV, nothing useful happens because there are no coordinates that place reads on a genome.
Coordinate conventions are another source of one-base errors. BED intervals are 0-based and half-open, so a BED interval chr1 100 200 covers bases 101 through 200 in 1-based terms. VCF and GFF3 are 1-based. Keep the convention of the file you are editing, and let IGV handle the display.
Prepare Files Before You Customize
Clean files make customization predictable. Run these checks before IGV opens.
Check that BAM is complete and indexed
samtools quickcheck -v sample.bam
samtools index -@ 4 sample.bam
samtools view -H sample.bam | grep '^@SQ' | cut -f2 | head -3
Expected output looks like this:
$ samtools quickcheck -v sample.bam
$ echo $?
0
$ samtools view -H sample.bam | grep '^@SQ' | cut -f2 | head -3
SN:chr1
SN:chr2
SN:chr3
quickcheck -v prints nothing and returns 0 when the BAM is intact. A nonzero return means the file is truncated or malformed. samtools index writes sample.bam.bai. The @SQ lines list the contigs recorded by the aligner. Compare those names with the reference genome you plan to load.
Check VCF compression, sorting, and index
bcftools view -h variants.vcf | head
bgzip -c variants.vcf > variants.vcf.gz
tabix -p vcf variants.vcf.gz
tabix -l variants.vcf.gz
bcftools view -H variants.vcf.gz | wc -l
Expected output:
$ tabix -l variants.vcf.gz
chr1
chr2
chr3
$ bcftools view -H variants.vcf.gz | wc -l
1248
tabix -p vcf creates variants.vcf.gz.tbi. If the VCF is not coordinate-sorted, tabix fails. Sort with bcftools sort before compression when needed.
Check BED sorting and indexing
LC_ALL=C sort -k1,1 -k2,2n regions.bed | bgzip -c > regions.bed.gz
tabix -p bed regions.bed.gz
tabix regions.bed.gz chr1:1000000-1010000 | head
Expected output:
chr1 1000500 1001200 enhancer_1
chr1 1003400 1004100 enhancer_2
BED files must be sorted by chromosome and start coordinate. The LC_ALL=C prefix makes sorting deterministic across locales. Without it, chromosome names can sort differently on different machines.
Format, index, and coordinate basis
| Format | Index | Coordinate basis | Main use in IGV |
|---|---|---|---|
| FASTA | .fai from samtools faidx | 1-based sequence | Reference genome |
| BAM | .bai from samtools index | 1-based positions | Aligned reads and coverage |
| VCF | .tbi or .csi from tabix | 1-based positions | Variants and genotypes |
| BED | .tbi from tabix | 0-based half-open | Regions, peaks, intervals |
| bigWig | None | 0-based half-open | Quantitative coverage |
| GFF3 or GTF | Sorted text, optional tabix | 1-based | Gene and feature annotation |
Match contig names to the reference
A BAM aligned to chr1 will not display against a reference that names the contig 1. The same applies to chrM versus MT. Check both sides.
samtools view -H sample.bam | grep '^@SQ' | cut -f2 | head -5
grep '^>' reference.fa | head -5
If the names differ, load the matching reference or rename contigs consistently before alignment. Renaming after alignment is possible but error-prone because BAM headers, indexes, and variant files must all agree.
IGV Track Customization for BAM, VCF, and BED: Step by Step
The steps assume IGV 2.x is open with a reference genome loaded. The same controls appear in the macOS, Windows, and Linux builds. Menu names can shift slightly between releases, but the right-click track menu is stable.
Step 1: Load the reference and the tracks
Choose Genomes > Load Genome from File for a local FASTA. IGV reads or builds a .fai index and may prompt to create a .genome file. Then use File > Load from File, or drag files onto the window. Load BAM, VCF, and BED files in any order.
A reference genome is normally loaded from FASTA, and annotation tracks such as GFF3 are added separately [4]. That separation is deliberate. The reference defines the coordinate system. The tracks carry the measurements.
Expected result: the chromosome ideogram appears at the top, the gene track appears if an annotation is available, and each loaded file appears as a named track with a data panel.
Step 2: Set track height
Right-click the track name and choose Change Track Height. Drag the bottom edge of a track for a faster adjustment. For a global default, open View > Preferences > Tracks and set the default height.
Height is a display choice, not a data transformation. A taller BAM panel shows more reads. A taller coverage panel shows more of the y-axis. If a track looks empty, check whether it is collapsed before you change the height.
Step 3: Choose the display mode
Right-click a BAM track and choose Squished, Expanded, or Collapsed. Expanded draws each read on its own row. Squished packs reads into fewer rows. Collapsed hides the read panel and leaves the coverage track.
Use expanded mode for inspecting individual reads, squished mode for dense regions, and collapsed mode when you only need coverage. For paired-end data, View as Pairs connects mates with a line. That view is useful for insert-size and orientation checks, but it becomes cluttered in high-depth regions.
For coverage, right-click the coverage track and choose Autoscale or Set Data Range. Autoscale fits the y-axis to the visible window. Set Data Range fixes the axis, which makes comparisons across samples fair. A fixed range of 0 to 100 means the same height represents the same depth in every panel.
Step 4: Color alignments by the feature you care about
Right-click the BAM track and open Color Alignments by. Common choices are pair orientation, read strand, insert size, and tag.
Use pair orientation when you screen for structural variation or chimeric reads. Use read strand when you inspect strand-specific RNA-seq. Use a tag when the aligner or a downstream tool wrote a meaningful value into the BAM, such as YC or XS.
Step 5: Sort and group alignments
Right-click the BAM track, then choose Sort Alignments by. Options include base, strand, start position, mapping quality, insert size, and tag. Group Alignments by offers a similar list.
Sorting changes the row order in the visible window. It does not rewrite the BAM. Grouping adds visual separation between classes, for example reads with different tags or strands. Both are view-level operations, so they disappear when you close the session unless you save it.
Step 6: Filter alignments and variants
Right-click a BAM track and choose Set Filter. IGV accepts expressions such as MAPQ > 20 or insertSize > 300. The filter hides reads that fail the expression. It does not delete them.
For VCF tracks, the filter expression can use INFO fields. For example, AF > 0.01 hides variants below a 1 percent allele fraction, and FILTER == "PASS" hides records that failed the caller's filter. Check the field names in the VCF header before you write the expression.
Step 7: Customize a VCF track
VCF display settings include color by genotype, group by genotype, allele fraction, and visibility window. Right-click the VCF track and inspect the menu.
Color by genotype colors variant sites by the genotype in each sample. That is the fastest way to spot a sample with a distinct genotype pattern. Group by genotype reorders samples by genotype class. Allele fraction adjusts how allele balance is displayed for heterozygous calls. Visibility window controls the largest region at which variants are drawn. A small window improves performance on dense VCFs.
VCF is one of several variant formats that visualization tools accept, alongside MAF and TSV [5]. In IGV, VCF is the most direct route because it carries positions, alleles, genotypes, and optional annotations in one indexed file.
Step 8: Customize a BED track
BED tracks render as features. Right-click the track to change the display mode (Expanded, Squished, Collapsed), color, and label field. A BED track line can set the name and color behavior:
track name="Peaks" itemRgb="On" visibility=2
chr1 1000500 1001200 enhancer_1 0 + 1000500 1001200 0,0,255
chr1 1003400 1004100 enhancer_2 0 - 1003400 1004100 255,0,0
The itemRgb field in column 9 supplies a color when itemRgb="On" is set on the track line. IGV can use that color, or you can override it with a single track color. For BED12 records, columns 7 through 12 define blocks and thick regions, which lets IGV draw exon-like structures from a BED file.
BED is 0-based. A record that starts at 1000500 includes that coordinate in BED terms, and the displayed 1-based position begins at 1000501. When a peak appears one base shifted relative to a VCF, check the coordinate convention before you change the file.
Step 9: Overlay tracks for direct comparison
Right-click one track and choose Overlay Tracks, then select the second track. IGV draws both data sets in one panel. Overlays are useful for comparing coverage from two BAMs or signal from two bigWigs.
Set a shared data range before you compare. If each track autoscales independently, a two-fold difference can look identical. A fixed range makes the comparison honest.
Step 10: Save the session and script the batch
Use File > Save Session to write an .xml session file. The session stores track order, colors, heights, data ranges, and file paths. It does not copy the data. If you move the BAM or VCF, reopen the session and relink the file.
For repeated views, use a batch script. The script below loads a genome and three tracks, navigates to a locus, sorts and colors alignments, sets the panel height, and writes a snapshot.
new
genome hg38
load sample.bam
load variants.vcf.gz
load regions.bed
goto chr7:140753336-140754668
sort base
colorBy strand
maxPanelHeight 500
snapshotDirectory /tmp/igv_shots
snapshot sample.png
exit
Run it from the IGV directory:
./igv.sh -b script.txt
On Windows, use igv.bat -b script.txt. IGV opens, executes each line, writes /tmp/igv_shots/sample.png, and exits. A successful run leaves a PNG and a log with no error lines. If the genome name is wrong, the run stops at the genome line. If a file path is wrong, the run stops at the matching load line.
The log resembles this:
INFO [main] IGV.java: Start IGV
INFO [main] IGV.java: Loading genome: hg38
INFO [main] IGV.java: Loading sample.bam
INFO [main] IGV.java: Loading variants.vcf.gz
INFO [main] IGV.java: Loading regions.bed
INFO [main] BatchRunner.java: snapshot /tmp/igv_shots/sample.png
Exact log text varies by version. The key checks are that every load line succeeds and that the snapshot file exists with a nonzero size.
Key Options at a Glance
| Setting | Where to find it | Scope | What it changes |
|---|---|---|---|
| Track height | Right-click track, Change Track Height | One track | Vertical space for reads or features |
| Display mode | Right-click track, Squished or Expanded or Collapsed | One track | Row packing and whether reads are drawn |
| Color alignments by | Right-click BAM, Color Alignments by | One BAM track | Read color rule |
| Sort alignments by | Right-click BAM, Sort Alignments by | Visible window | Row order |
| Group alignments by | Right-click BAM, Group Alignments by | Visible window | Visual separation by class |
| Set filter | Right-click BAM or VCF, Set Filter | One track | Which records are shown |
| Autoscale | Right-click coverage, Autoscale | One coverage track | Y-axis fits visible window |
| Set data range | Right-click coverage or bigWig, Set Data Range | One track | Fixed y-axis limits |
| Visibility window | Right-click track, Set Visibility Window | One track | Largest region where features are drawn |
| Overlay tracks | Right-click track, Overlay Tracks | Two tracks | Combined panel |
| Save session | File, Save Session | Whole session | Stores display state and paths |
The most consequential setting for between-sample comparisons is the data range. Autoscale is convenient for exploration. A fixed range is better for figures, quality control, and any claim that one sample has more coverage than another.
Common Errors and Fixes
"No index found for sample.bam"
IGV cannot randomly access an unindexed BAM. Fix it with samtools index sample.bam. The index must sit next to the BAM and carry the expected name, sample.bam.bai by default. If the BAM was copied without the index, copy both files.
"File is not sorted" or a tabix failure
VCF and BED files must be coordinate-sorted before tabix indexing. Sort the VCF with bcftools sort, or sort the BED with LC_ALL=C sort -k1,1 -k2,2n. Then compress with bgzip and index with tabix. A plain gzip file is not the same as a bgzip file. IGV needs bgzip for tabix-indexed text tracks.
"Unrecognized file format"
IGV decides the format from the file extension and content. A VCF named .txt, a BED named .csv, or a BAM that was renamed to .sam can trigger this message. Rename the file to the correct extension and confirm the content with file or head.
"Unable to find sequence chr1" or an empty track
This is a contig naming mismatch. The BAM header says chr1, but the loaded reference says 1, or the reverse. Load the reference that matches the alignment. Do not rename contigs in a BAM after alignment unless you also rebuild the index and check every associated VCF and BED.
A VCF loads but no variants appear
Check three things. First, the VCF must be bgzip-compressed and tabix-indexed. Second, the locus must be inside the variant's coordinates. Third, the visibility window must be large enough. A dense VCF with a small visibility window may draw nothing at a wide view. Zoom in or raise the window.
A BED track appears shifted by one base
This is usually the 0-based BED convention colliding with a 1-based expectation. BED start coordinates are 0-based. VCF and GFF3 are 1-based. Compare the same feature in both formats before you edit either file.
IGV runs out of memory
Large BAMs, many tracks, and wide views consume heap. Close unused tracks, reduce the visibility window, or increase the Java heap in the IGV launch configuration. Whole-genome views are especially heavy because IGV must decide how much detail to draw.
The session opens with missing tracks
Session files store paths, not data. If the BAM or VCF moved, IGV cannot find it. Keep the project directory stable, or use relative paths where the launch setup supports them. Re-save the session after relinking files.
How to Check the Result Is Right
Display settings can hide data problems. Run independent checks.
For BAM coverage, compare a region in IGV with samtools depth:
samtools depth -a -r chr1:1000000-1001000 sample.bam | awk '{sum+=$3} END {print sum/NR}'
The number is the mean depth over the region. IGV's coverage track should show a comparable profile. Small differences can come from base quality filters, duplicate handling, or the exact interval boundaries. A large difference means the track is filtered, the wrong BAM is loaded, or the data range is clipping the display.
For VCF, count records in the region and compare with the variant rows in IGV:
bcftools view -H -r chr1:1000000-1010000 variants.vcf.gz | wc -l
If IGV shows fewer variants, check the filter expression, the genotype display mode, and the visibility window. If IGV shows more, check whether the loaded VCF is the same file and build.
For BED, count intervals with tabix:
tabix regions.bed.gz chr1:1000000-1010000 | wc -l
A mismatch usually means the BED was sorted or indexed from a different version than the one on screen.
Finally, save the session, close IGV, reopen the session, and confirm that the colors, heights, and data ranges survive. A reproducible view is one that reopens with the same settings and the same files.
Common Mistakes and Limitations
The first mistake is treating IGV as an analysis tool. IGV displays alignments and variants. It does not align FASTQ, call variants, or compute differential coverage. Use BWA, minimap2, STAR, bcftools, GATK, or another appropriate tool for those steps, then load the output.
The second mistake is customizing before checking the data. A collapsed track, a missing index, and a contig mismatch all look like a broken track. Confirm the file is complete, sorted, indexed, and built on the same reference before you change colors or heights.
The third mistake is comparing autoscaled tracks. Autoscale fits each track to its own visible window. Two samples can look equal when one has twice the coverage. Set a shared data range for any visual comparison that matters.
The fourth mistake is assuming that a saved session is portable. Session files store file paths. Move the project folder and the session breaks. Keep a project directory with the reference, BAM, VCF, BED, indexes, and session file together.
The fifth mistake is confusing FASTQ and FASTA. FASTA is a reference sequence format. FASTQ is raw read data with quality scores. IGV needs aligned coordinates, so a FASTQ must be aligned first. A FASTA can be loaded as the genome, but it is not a read track.
The sixth mistake is ignoring coordinate conventions. BED is 0-based half-open. VCF and GFF3 are 1-based. Off-by-one errors survive visual inspection and cause real problems in downstream intersection or annotation steps.
The seventh mistake is overloading the viewer. Hundreds of tracks, whole-genome views, and very large VCFs can exhaust memory. Reduce the visibility window, close unused tracks, and split the work into separate sessions.
Limitations matter too. IGV downsamples or summarizes data at wide views, so the pixel display is not a raw count. The coverage track is a visual summary, not a statistical test. The variant view shows calls, not evidence for or against a variant. Genome builds, contig naming, and index freshness are the user's responsibility. Individual datasets vary, and case-specific interpretation should come from a bioinformatician or the analyst who generated the data.
Interactive visualization packages commonly accept all major genomic file formats and then apply plotting parameters on top [6]. That flexibility is useful, but it also means the display can be customized into something misleading. A fixed data range, a recorded filter, and a saved session are the safeguards.
Score cutoffs and display thresholds are a standard customization axis for annotation tracks [7]. The same logic applies in IGV. A threshold hides low-scoring features and makes the remaining features easier to inspect. Record the threshold in the session or the figure legend so the view can be reproduced.
Format diversity is why parser libraries expose a common interface rather than a separate API for every file type [8]. IGV follows the same principle at the user level. Once a BAM, VCF, or BED is sorted and indexed, the customization controls behave consistently across tracks.
Annotation tracks derived from tools that emit GFF3 are intended to be inspected in a genome browser by location [9]. That is a useful reminder that the track is a view of a file, not a substitute for the file. Keep the original BED, VCF, and GFF3 in the project archive.
Frequently Asked Questions
How do I change the color of a BAM track in IGV?
Right-click the BAM track, choose Color Alignments by, and select a rule such as read strand, pair orientation, insert size, or a tag. For a single flat color, use the track color setting in the same menu. The change affects the current view and is stored if you save the session.
Why is my VCF track not showing in IGV?
The most common causes are a missing tabix index, a VCF that is not bgzip-compressed, a locus outside the variant coordinates, or a visibility window that is too small. Confirm the index with tabix -l variants.vcf.gz, then check the locus and zoom level.
Can IGV open FASTQ files?
No. IGV displays data with genomic coordinates. FASTQ contains raw reads and quality scores without alignment coordinates. Align the FASTQ to a reference to produce a BAM, index the BAM with samtools index, and load the BAM.
What is the difference between FASTA and FASTQ?
FASTA stores sequence only, usually as a reference. FASTQ stores sequence plus a per-base quality score for each read. FASTA is loaded as a reference genome in IGV. FASTQ is an input to an aligner, not a track format.
How do I make a BED track taller?
Right-click the BED track name and choose Change Track Height, or drag the bottom edge of the track. If the track is collapsed, change the display mode to Expanded or Squished first. Track height changes are display-only and do not alter the BED file.
How do I save track settings for later?
Use File > Save Session to write an .xml session file. The session stores track order, colors, heights, data ranges, filters, and file paths. Keep the data files in the same locations, or relink them when you reopen the session.
Why does my BAM coverage look different from samtools depth?
IGV may apply a visibility window, a filter, or a data range that clips the display. It may also summarize coverage at wide views. Compare a small region with samtools depth, check the track filter, and set a fixed data range before you compare samples.
How do I overlay two BAM tracks in IGV?
Right-click one BAM track, choose Overlay Tracks, and select the second BAM. Set a shared data range so both tracks use the same y-axis. Overlays are useful for comparing coverage, but they do not combine read counts into a new statistical result.
Sources
- Online resources for genomic analysis using high-throughput sequencing.
- proBAMsuite, a Bioinformatics Framework for Genome-Based Representation and Analysis of Proteomics Data.
- Prioritising positively selected variants in whole-genome sequencing data using FineMAV.
- Setting Up the JBrowse 2 Genome Browser.
- CoMutPlotter: a web tool for visual summary of mutations in cancer cohorts.
- SeqPlots - Interactive software for exploratory data analyses, pattern discovery and visualization in genomics.
- BioSAVE: display of scored annotation within a sequence context.
- jmzReader: A Java parser library to process and visualize multiple text and XML-based mass spectrometry data formats.
- BioNanoAnalyst: a visualisation tool to assess genome assembly quality using BioNano data.