In order to facilitate inspection of hundreds or even thousands of sites, IGV has a built-in batch mode. A batch control file can look as simple as this:
new
genome /data/ref/hs37.fasta
load /data/patient1.bam
load /data/patient2.bam
goto 1:28000000
snapshot /path/to/file.png
...
(Reference genome and BAMs should of course be indexed). Executing such a batch file is also straightforward:
/path/to/igv.sh --batch /path/to/batch/file
Now this will work fine if the computer you are executing this command on can provide a graphical user interface (GUI): IGV requires a GUI, even in batch mode.
This generally doesn't case problems under Windows or on Linux and Mac workstations. Linux servers, however, do not always readily provide an X server (and of course you would want to plot your 10,000 positions on your server rather than on your workstation).
So what to do if your server does not provide an X11 server? There are at least two possibilities:
- Use SSH to tunnel the X11 communication to your local workstation, and run a local X11 server.
Under Windows, for example, start by installing the X11 server Xming. I assume that you use Putty for SSH. Open the "Putty Configuration" dialogue, go to Connection -> SSH -> X11, activate "Enable X11 forwarding". Now start Xming, establish the SSH session with Putty and X11 should work. For a first test, try to start the program xterm. A terminal window should become visible on your Windows desktop.
IGV should work under this setup. However, latency can become a bit of a problem - IGV really insists on sending the data to properly display a particular position to your local X11 server before moving on to the next position.
This is why I generally try to avoid this situation, unless I just want to quickly manually check one or two positions. - Install an X11 server that does not care whether any real display hardware is available.
Xvfb, for example, does this job: it provides a virtual display which IGV will happily accept as a basis for batch-mode plotting.
It should usually be possible to install a precompiled Xvfb package for your distribution.
If you are lacking sufficient privileges, it is also straightforward to install a local version.
Xvfb is part of the XFree86 project, so go to http://ftp.xfree86.org/pub/XFree86/4.8.0/binaries/, navigate into the appropriate subfolder (depending on your distribution and LIBC version) and download Xvfb.tgz and Xfnts.tgz.
In my case, for example, I had to download
ftp://ftp.xfree86.org/pub/XFree86/4.8.0/binaries/Linux-x86_64-glibc23/Xfnts.tgz
and
ftp://ftp.xfree86.org/pub/XFree86/4.8.0/binaries/Linux-x86_64-glibc23/Xvfb.tgz
Now do a tar -xvzf on both files. (Sources are, of course, also available, but installation is perhaps a bit more cumbersome. Refer to XFree86 for more details).
Let's assume that you extracted the Xfnts file into /path/to/lib/X11/fonts/ (the latter part of the path is determined by the tar file), and the Xvfb into /path/to/xvfb.
Navigate into /path/to/xvfb, and type
./Xvfb :0 -nolisten tcp -fp /path/to/lib/X11/fonts/misc
(Note the added 'misc' for the -fp parameter!).
You might receive a complaint about lacking security data, which we are happily going to ignore for the moment. This nowithstanding, the program should continue execution without terminating.
You can now start the terminal server in the background, typing
./Xvfb :0 -nolisten tcp -fp /path/to/lib/X11/fonts/misc &
The last remaining task is to tell IGV that it is to utilize display port :0. In order to do so, simply type
DISPLAY=:0
immediately before starting IGV, e.g. with
/path/to/igv.sh --batch /path/to/batch/file
... and enjoy high-speed plotting on your server!