IGV from the command line

From the Download IGV page you can download a version of IGV that includes scripts for launching the IGV application and the igvtools utilities from the command line.

IGV application#

Usage#

igv.sh [flags] [file]

Example#

Supply an oAuth token for a Google hosted file:

igv.sh  -H "Authorization: Bearer <token>" gs://genomics-public-data/platinum-genomes/bam/NA12877_S1.bam

igvtools#

igvtools provides a number of utilities to preprocess data files.

Launching the scripts#

The igvtools utilities can be invoked, with or without the graphical user interface (GUI), from one of the following scripts:

The GUI version is launched without any options or arguments. Once it has been launched, everything is the same as when you run igvtools from the IGV interface. See igvtools in the Tools Menu for more information.

The general form of the command-line version is:

igvtools [command] [options] [arguments]
igvtools.bat [command] [options] [arguments]

Recognized tools, options, arguments, and file types are described below.

Memory settings#

The igvtools scripts allocate a fixed amount of memory. If this is more than the amount available on your platform, you will get an error along the lines of "Could not start the Virtual Machine". If this happens you will need to edit the scripts to reduce the amount of memory requested, or use the option to start igvtools directly with Java (see below). The memory is set via a -Xmx parameter. For example -Xmx1500mrequests 1500 MB, -Xmx1g requests 1 gigabyte.

Launching with Java#

The command line has become more complex with Java 11 compared to Java 8. We recommend the scripts above for most users.

igvtools can also be started directly using Java. This option allows more control over Java parameters, such as the maximum memory to allocate. In the example shown below, igvtools is started with 1500 MB of memory allocated and launched in the location where you have unpacked igvtools.

java -Xmx1500m --module-path=lib @igv.args --module=org.igv/org.broad.igv.tools.IgvTools [command] [options] [arguments]

To start with a GUI the command is

java -Xmx1500m --module-path=lib @igv.args --module=org.igv/org.broad.igv.tools.IgvTools gui

For more information about other settings, see the downloaded file igvtools_readme.txt.

Commands#

igvtools includes the following commands: sort, index, count, toTDF, and version.

sort#

Sorts a file by start position.

igvtools sort [options] [inputFile] [outputFile]

index#

Creates an index for an alignment or feature file. Index files are required for loading alignment files into IGV, and can significantly improve performance for large feature files. Note that the index file is not directly loaded into IGV. Rather, IGV looks for the index file when the alignment or feature file is loaded. This command does not take an output file argument. Instead, the filename is generated by appending ".sai" (for alignments) or ".idx" (for features) to the input filename as IGV relies on this naming convention to find the index.

igvtools index [inputFile]

The "sai" index is an IGV format, it does not work with samtools or any other application.

count#

Computes average feature density over a specified window size across the genome. Common usages include computing coverage for alignment files and counting hits in ChIP-seq experiments. By default, the resulting file will be displayed as a bar chart when loaded into IGV.

igvtools count [options] [inputFile] [outputFile] [genome]

Example:

igvtools count -z 5 -w 25 -e 250 alignments.bam alignments.cov.tdf hg18

toTDF#

Converts a sorted data input file to a binary tiled data (.tdf) file. Use this command to pre-process large datasets for improved IGV performance. This tool was previously known as tile.

igvtools toTDF [options] [inputFile] [outputFile] [genome]

Example:

igvtools toTDF -z 5 copyNumberFile.cn copyNumberFile.tdf hg18

version#

Prints the igvtools version number to the console.

igvtools version