Setting up a data server for IGV

The Broad’s Integrative Genome Viewer (IGV) is a popular tool for visualising genomic data. It can be run with java webstart or installed locally. See the downloads page for details.

If you have some genome data you want people to be able to view with IGV, you can set up your own data server. Essentially, all you have to do is put your datafiles online somewhere (IGV understands http basic auth if you need to password protect the data) and then create registry files to tell IGV where the data is. There are instructions on the Broad website.

This is how I set our IGV server up:

You need a registry file for each genome you want to provide data for. I’ll use hg18 as an example. Create a registry file for hg18 on your webserver. Mine is in


Corresponding to a URL of

The reason these registry files are php, rather than just plain text is that they pull in the contents of the Broad’s registry files as well as pointing to any local datasets or annotation.

It should look something like this:

// set the mime type to xml
$mtype = "text/plain";
header("Content-Type: $mtype");

// add my datasets to the list
echo "\n";

// add the Broad datasets to the list
$broad_reg = file_get_contents(
echo "$broad_reg\n";

Which produces:

As you can see the registry file points to a datasets.php file url:

Corresponding to a php file on my server:

This datasets file stores a list of available datasets on my server for the hg18 genome build.

Rather than just serving up one big datasets.xml file, describing all of our hg18 datasets, I prefer to have the xml descriptions of each dataset in the dataset directory and have a php file that collates them all. It’s easier to manage and more readable.

// set mime type to xml
$mtype = "text/xml";
header("Content-Type: $mtype");


// include all the dataset xml descriptions you want.


The individual dataset.xml files should look something like:

<Category name="My Dataset">
<Category name="Control">
<Resource name="Control Reads"
<Resource name="Control Peaks"
<Category name="Treatment">
<Resource name="Treatment Reads"
<Resource name="Treatment Peaks"

and so on.

Categories can be nested multiple times. You can have as many as you like, containing as many Resources as you need.

To use your new data server in IGV, start IGV and go to View -> Preferences -> Advanced

Click the Edit Server Properties checkbox and replace the Data Registry URL with$$.php

Hit OK.

The $$ is a placeholder for the genome name, so you can create more registries, for example igv_registry_mm9.php, and you won’t have to change this setting.

Now, if you select the hg18 genome go to File -> Load From Server, you will be able to select from a list of datasets hosted on the BRC-MH servers, as well as those hosted by the Broad.

One response to “Setting up a data server for IGV

  1. Nice post! Nice way of using PHP for generating a dynamic XML for IGV. Good job! After reading your post, I used PHP and regex to create a dynamic XML of the bam files on my server! Thanks for sharing…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s