Skip to content
Script to automatically create and run IGV snapshot batchscripts
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
regions.bed update script and add samples Mar 5, 2017

IGV Snapshot Automator

A script to automatically create and run IGV snapshot batchscripts. This script will first write an IGV batch script for the supplied input files, then load all supplied files for visualization (.bam, etc) in a headless IGV session and take snapshots at the locations defined in the regions.bed file.

Designed for use on Linux systems, and intended to be used as a component of sequencing analysis pipelines.


Download IGV

You can use the included script in the bin directory to download IGV:

$ cd bin
$ ./

Alternatively, a copy of IGV has been saved in the bin branch of this repo:

$ git checkout origin/bin bin/ && unzip bin/ -d bin

Run Snapshotter

  • Put your chromosome regions to visualize in the regions.bed file (provided), or another BED format file

  • Locate your files to visualize (e.g. .bam & .bam.bai files)

  • Create and run batchscript. Example command:

$ python /path/to/alignments1.bam /path/to/alignments2.bam


To run the script on the included demo files:

$ python test_data/test_alignments.bam test_data/test_alignments2.bam


See python --help for available options. Here are a few:

  • -r: Path to the BED formatted regions file to use:
$ python /path/to/alignments1.bam /path/to/alignments2.bam -r /path/to/my_peaks.bed
  • -nosnap: Make batchscript without taking snapshots:
$ python /path/to/alignments1.bam /path/to/alignments2.bam -nosnap
  • -g: Genome to use, e.g. hg19
  • -ht: Height of the snapshot, default is 500
  • -o: Name of the output directory to save the snapshots in.
  • -bin: Path to the IGV jar binary to run
  • -mem: Memory to allocate to IGV (MB)
  • -suffix: Filename suffix to place before '.png' in the snapshots
  • -onlysnap: Skip batchscript creation and only run IGV using the supplied batchscript file
  • -nf4: "Name field 4" mode, uses values saved in 4th field of the regions.bed file as the output filename of the PNG snapshot. Use this when you have pre-made filenames you wish to use for each snapshot.
  • -s or -group_by_strand: Group alignment(s) by read strand with forward on top and reverse on the bottom.

Example Output



Default memory allotment is set at 4GB; this can be changed with the -mem argument (e.g. -mem 1000 sets memory to 1GB).

IGV may take several minutes to run, depending on the number of input files and regions to snapshot. Stdout messages from the program may not appear immediately in the console.

Software Requirements

  • Python 2.7 or 3+
  • bash version 4.1.2+
  • IGV (download script provided in bin directory)
  • Xvfb
  • xdpyinfo
  • Java runtime environment
You can’t perform that action at this time.