Skip to content

Instantly share code, notes, and snippets.

@stevekm
Last active August 21, 2025 16:51
Show Gist options
  • Save stevekm/ac76c0c2fa4ee89db8ce2421cc6fbffc to your computer and use it in GitHub Desktop.
Save stevekm/ac76c0c2fa4ee89db8ce2421cc6fbffc to your computer and use it in GitHub Desktop.

Revisions

  1. stevekm revised this gist Nov 2, 2016. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion igv_test_bat.md
    Original file line number Diff line number Diff line change
    @@ -48,7 +48,15 @@ For scripting purposes, you can run the X11 virtualizer to avoid the requirement
    (Xvfb :10 &) && DISPLAY=:10 java -Xmx750m -jar bin/IGV_2.3.81/igv.jar -b code/IGV_test.bat && killall Xvfb
    ```

    Note that you can run an IGV batch script from within IGV itself as well. This allows you to load your tracks and apply manual customization, then iterate through a series of regions and take snapshots.
    Note that you can run an IGV batch script from within IGV itself as well. This allows you to load your tracks and apply manual customization, then iterate through a series of regions and take snapshots. Just omit the portions of the script that start and new session & adjust visual parameters. If you've already loaded your tracks, all your script needs is this:

    ```
    snapshotDirectory /path/to/snapshot_dir
    goto chr11:108138003-108138003
    snapshot custom_chr11-108138003-108138003.png
    goto chr9:21971111-21971111
    snapshot custom_chr9-21971111-21971111.png
    ```

    Example output:

  2. stevekm revised this gist Nov 2, 2016. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions igv_test_bat.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    You can use IGV to automatically & programmatically load genomic datasets and take snapshots of regions of interest. This is very handy and helps you avoid taking many screenshots manually.

    Manual page here:

    http://software.broadinstitute.org/software/igv/batch
    @@ -10,7 +12,7 @@ Download here:

    http://software.broadinstitute.org/software/igv/download

    After installing IGV, a script can be run from the terminal. Sample script (save this as `IGV_test.bat`):
    After installing IGV, a specially-formatted IGV batch script can be used to automate the program. Format your script like this: (save this as `IGV_test.bat`):

    ```
    new
    @@ -26,13 +28,13 @@ snapshot custom_chr9-21971111-21971111.png
    exit
    ```

    Example command to run IGV:
    You can run the script from the terminal like this:

    ```
    bin/IGV_2.3.81/igv.sh -b code/IGV_test.bat
    ```

    Running the script like this will cause a window to appear, and the commands will be executed.
    Upon running the script, a window to appear and you should see the tracks load and the regions appear on screen as snapshots are taken.

    If you are running IGV from a headless server (accessing the server via `ssh`), then this will require X11 to be running on the server and installed on your local computer (use XQuartz for OS X). Remember to enable X11 in your terminal by adding `-Y` to your `ssh` command, like so:

  3. stevekm revised this gist Nov 2, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions igv_test_bat.md
    Original file line number Diff line number Diff line change
    @@ -46,6 +46,8 @@ For scripting purposes, you can run the X11 virtualizer to avoid the requirement
    (Xvfb :10 &) && DISPLAY=:10 java -Xmx750m -jar bin/IGV_2.3.81/igv.jar -b code/IGV_test.bat && killall Xvfb
    ```

    Note that you can run an IGV batch script from within IGV itself as well. This allows you to load your tracks and apply manual customization, then iterate through a series of regions and take snapshots.

    Example output:

    ![chr3_185850354-185872709](https://cloud.githubusercontent.com/assets/10505524/19937792/013ef1d8-a0f9-11e6-8b17-289de9706c1d.png)
  4. stevekm revised this gist Nov 2, 2016. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion igv_test_bat.md
    Original file line number Diff line number Diff line change
    @@ -44,4 +44,8 @@ For scripting purposes, you can run the X11 virtualizer to avoid the requirement

    ```
    (Xvfb :10 &) && DISPLAY=:10 java -Xmx750m -jar bin/IGV_2.3.81/igv.jar -b code/IGV_test.bat && killall Xvfb
    ```
    ```

    Example output:

    ![chr3_185850354-185872709](https://cloud.githubusercontent.com/assets/10505524/19937792/013ef1d8-a0f9-11e6-8b17-289de9706c1d.png)
  5. stevekm revised this gist Nov 2, 2016. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions igv_test_bat.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,9 @@ These commands are also available:

    http://software.broadinstitute.org/software/igv/PortCommands

    Download here:

    http://software.broadinstitute.org/software/igv/download

    After installing IGV, a script can be run from the terminal. Sample script (save this as `IGV_test.bat`):

    @@ -28,3 +31,17 @@ Example command to run IGV:
    ```
    bin/IGV_2.3.81/igv.sh -b code/IGV_test.bat
    ```

    Running the script like this will cause a window to appear, and the commands will be executed.

    If you are running IGV from a headless server (accessing the server via `ssh`), then this will require X11 to be running on the server and installed on your local computer (use XQuartz for OS X). Remember to enable X11 in your terminal by adding `-Y` to your `ssh` command, like so:

    ```
    ssh [email protected] -Y
    ```

    For scripting purposes, you can run the X11 virtualizer to avoid the requirement for an active X11 window when you call IGV. Use this command:

    ```
    (Xvfb :10 &) && DISPLAY=:10 java -Xmx750m -jar bin/IGV_2.3.81/igv.jar -b code/IGV_test.bat && killall Xvfb
    ```
  6. stevekm revised this gist Nov 2, 2016. 1 changed file with 16 additions and 2 deletions.
    18 changes: 16 additions & 2 deletions igv_test_bat.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,13 @@
    Manual page here:

    Save this as a test file
    http://software.broadinstitute.org/software/igv/batch

    These commands are also available:

    http://software.broadinstitute.org/software/igv/PortCommands


    After installing IGV, a script can be run from the terminal. Sample script (save this as `IGV_test.bat`):

    ```
    new
    @@ -13,4 +21,10 @@ snapshot custom_chr11-108138003-108138003.png
    goto chr9:21971111-21971111
    snapshot custom_chr9-21971111-21971111.png
    exit
    ```
    ```

    Example command to run IGV:

    ```
    bin/IGV_2.3.81/igv.sh -b code/IGV_test.bat
    ```
  7. stevekm created this gist Nov 2, 2016.
    16 changes: 16 additions & 0 deletions igv_test_bat.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@

    Save this as a test file

    ```
    new
    snapshotDirectory /path/to/snapshot_dir
    load /path/to/sample1.bam
    load /path/to/sample2.bam
    genome hg19
    maxPanelHeight 400
    goto chr11:108138003-108138003
    snapshot custom_chr11-108138003-108138003.png
    goto chr9:21971111-21971111
    snapshot custom_chr9-21971111-21971111.png
    exit
    ```