Skip to content

Instantly share code, notes, and snippets.

@ctokheim
Last active April 21, 2022 22:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctokheim/5209723 to your computer and use it in GitHub Desktop.
Save ctokheim/5209723 to your computer and use it in GitHub Desktop.
UCSC Genome Browser Track Hub

Overview

UCSC's track hubs allow multiple wig files to be displayed in a single custom track. Thus possibly overlaying multiple types of data or displaying strand specific read depth. Individual sub-tracks within a custom track can then be toggled on/off.

Getting Started

The official documentation of UCSC's track hubs can be found at http://genome.ucsc.edu/goldenPath/help/hgTrackHubHelp.html.

Essentially you need a server that can be accessed via http, https, or ftp. Setting up the track hub, besides the custom track files, requires several configuration files. Below is how I placed all of the files:

./hub.txt
./genomes.txt
./myDirectory/trackDb.txt
./myDirectory/brain1.bw
./myDirectory/brain2.bw

The above assumes you have two BigWig files named brain1.bw and brain2.bw which are in a directory named myDirectory.

hub.txt

The hub.txt file intuitively sets the configurations like the hub name and the genome configureation file (genomes.txt) for the track hub.

hub my_hub 
shortLabel my hub short label
longLabel my hub longer label
genomesFile genomes.txt
email your_email@example.com

genomes.txt

In the below example the track hub is for hg19 and the information about custom tracks can be found in the trackDb.txt file in the myDirectory folder.

genome hg19
trackDb myDirectory/trackDb.txt

trackDb.txt

To display multiple wigs in one track, you need to specify a track as having a container of "multiwig". Then in subsequent sub-track definitions point to the multiwig track as the parent of that sub-track. You may have many "multiwig" custom tracks in your track hub, it is not limited to one. You can edit the parameters for the track to get exactly what you want.

track brain
container multiWig
shortLabel My Brain Data
longLabel My Brain Data
type bigWig 0 30000
viewLimits 0:100
visibility full
maxHeightPixels 150:30:11
aggregate transparentOverlay
showSubtrackColorOnUi on
windowingFunction mean
priority 1.4
configurable on
autoScale on

track brain1
bigDataUrl brain1.bw
shortLabel brain1_data
longLabel brain1_data
parent brain
type bigWig
color 125,0,0

track brain2
bigDataUrl brain2.bw
shortLabel brain2_data
longLabel brain2_data
type bigWig
parent brain
color 0,125,0

Add the Track Hub

  1. Go to http://genome.ucsc.edu/cgi-bin/hgHubConnect

  2. Click on the My Hubs tab

  3. Paste your url into text entry. It may look something like the following if you are using ftp:

     ftp://userName:password@example.com/myDirectory/hub.txt
    
  4. Click the Add Hub button

If you run into issues, you can check the official documentation at http://genome.ucsc.edu/goldenPath/help/hgTrackHubHelp.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment