Sunday, September 9, 2012

Prepare custom track of numerical data

0 Make sure you have the tabix program installed.
You can download the latest source and compile:
http://sourceforge.net/projects/samtools/files/tabix/

Or if you're using Ubuntu operating system, install it using apt-get:
$ apt-get install tabix
You should have both tabix and bgzip programs available on your computer.

1 Skip this step if your file is bedGraph format.

For bigWig files...
Rrun the command bigWigToBedGraph in UCSC genome browser tool set and convert the bigWig file to a bedgraph text file.

For wiggle files...
Convert them into bedgraph text files. Only a few lines of code is needed for this task.
Or if you really hate coding, you can convert the wiggle file to bigWig format using wigToBigWig (also from UCSC genome browser tool set), then do bigWigToBedGraph.

2 Compress the bedgraph text file:
$ bgzip input.bedgraph

The old file is gone and a new file "input.bedgraph.gz" is there instead.

3 Build tabix index of the compressed bedgraph file
$ tabix -p bed input.bedgraph.gz

The "input.bedgraph.gz" is untouched but an index file "input.bedgraph.gz.tbi" is generated.

4 Display this file as a custom bedgraph track on WashU Genome Browser.
Put the .gz and .gz.tbi files on the SAME directory on your web server.
Use only the URL to the .gz file to make the custom track.