bigWig Track Format
 

The bigWig format is for display of dense, continuous data that will be displayed in the Genome Browser as a graph. BigWig files are created initially from wiggle (wig) type files, using the program wigToBigWig. The resulting bigWig files are in an indexed binary format. The main advantage of the bigWig files is that only the portions of the files needed to display a particular region are transferred to UCSC, so for large data sets bigWig is considerably faster than regular wiggle files. The bigWig file remains on your web accessible server (http, https, or ftp), not on the UCSC server. Only the portion that is needed for the chromosomal position you are currently viewing is locally cached as a "sparse file".

Wiggle data must be continuous and the elements must be equally sized. If your data is sparse or contains elements of varying size, use the bedGraph format instead of the wiggle format. If you have a very large bedGraph data set, you can convert it to the bigWig format using the bedGraphToBigWig program. For details, see Example Three below.

See this page for help in selecting a graphing track data format that is most approriate for the type of data you have.

Please note that the wigToBigWig utility uses a lot of memory; somewhere on the order of 1.5 times more memory than the uncompressed wiggle input file. We recommend that as you run the program you monitor your memory usage by using the top command. The bedGraphToBigWig utility uses somewhere on the order of 1/4 times more RAM than the uncompressed bedGraph input file.

To create a bigWig track from a wiggle file, follow these steps:

  1. Create a wig format file following the directions here. Note that when converting a wig file to a bigWig file, you are limited to one track of data in your input file; you must create a separate wig file for each data track. Note that this is the file that is referred to as input.wig in step 5 below.
  2. Remove any existing 'track' or 'browser' lines from your wig file so that it contains only data.
  3. Download the wigToBigWig program from the directory of binary utilities.
  4. Use the fetchChromSizes script from the same directory to create the chrom.sizes file for the UCSC database you are working with (e.g. hg19). Note that this is the file that is referred to as chrom.sizes in step 5 below.
  5. Create the bigWig file from your wig file using the wigToBigWig utility like so: wigToBigWig input.wig chrom.sizes myBigWig.bw
    (Note that the wigToBigWig program also accepts a gzipped wig input file.)
  6. Move the newly created bigWig file (myBigWig.bw) to a http, https, or ftp location.
  7. If the file URL ends with .bigWig or .bw, you can paste the URL directly into the custom track management page, click submit and view in the Genome Browser. The track name will then be the name of the file. If you want to configure the track label or other visualisation options, you will need to create a track line, as shown below.
  8. Construct a custom track using a single track line. The most basic version of the track line will look something like this:
    track type=bigWig name="My Big Wig" description="A Graph of Data from My Lab" bigDataUrl=http://myorg.edu/mylab/myBigWig.bw

    Optional values can include:

      autoScale         <on|off>                             # default is on
      alwaysZero        <on|off>                             # default is off
      gridDefault       <on|off>                             # default is off
      maxHeightPixels   <max:default:min>                    # default is 128:128:11
      graphType         <bar|points>                         # default is bar
      viewLimits        <lower:upper>                        # default is range found in data
      viewLimitsMax     <lower:upper>                        # suggested bounds of viewLimits, but not enforced
      yLineMark         <real-value>                         # default is 0.0
      yLineOnOff        <on|off>                             # default is off
      windowingFunction <mean+whiskers|maximum|mean|minimum> # default is maximum, mean+whiskers is recommended
      smoothingWindow   <off|[2-16]>                         # default is off
      transformFunc     <NONE|LOG>                           # default is NONE

    For further information on custom bigWig track settings, see the Track Database Definition Document. For further information on how bigWig settings are used in native Browser tracks, see the Configuring graph-based tracks page.

  9. Paste this custom track line into the text box in the custom track management page.

Example One

In this example, you will use an existing bigWig file to create a bigWig custom track. A bigWig file that spans chromosome 21 on the hg19 assembly has been placed on our http server. You can create a custom track using this bigWig file by pasting the URL http://genome.ucsc.edu/goldenPath/help/examples/bigWigExample.bw into the custom track management page for the human assembly hg19 (Feb. 2009), then press the submit button. On the following page, press the chr21 link in the custom track listing to view the bigWig track at position chr21:33,031,597-33,041,570 in the Genome Browser.

Alternatively, you can construct a "track" line that references this file like so:

track type=bigWig name="Example One" description="A bigWig file" bigDataUrl=http://genome.ucsc.edu/goldenPath/help/examples/bigWigExample.bw

Include the following "browser" line to ensure that the custom track opens at the correct position:

browser position chr21:33,031,597-33,041,570

Paste the "browser" line and "track" line into the custom track management page for the human assembly hg19 (Feb. 2009), then press the submit button. On the following page, press the chr21 link in the custom track listing to view the bigWig track in the Genome Browser.

Example Two

In this example, you will create your own bigWig file from an existing wiggle file.

  • Save this wiggle file to your machine (this satisfies steps 1 and 2 above).
  • Save this text file to your machine. It contains the chrom.sizes for the human (hg19) assembly (this satisfies step 4 above).
  • Download the wigToBigWig utility (see step 3).
  • Run the utility to create the bigWig output file (see step 5):
    wigToBigWig wigVarStepExample.gz hg19.chrom.sizes myBigWig.bw
  • Place the bigWig file you just created (myBigWig.bw) on a web-accessible server (see step 6).
  • Paste the URL to the file into the custom track entry form or construct a "track" line that points to your bigWig file (see step 7).
  • Create the custom track on the human assembly hg19 (Feb. 2009), and view it in the genome browser (see step 8). Note that the original wiggle file spans only chromsome 21.

Example Three

To create a bigWig track from a bedGraph file, follow these steps:

  1. Create a bedGraph format file following the directions here. Note that when converting a bedGraph file to a bigWig file, you are limited to one track of data in your input file; you must create a separate bedGraph file for each data track. Note that this is the file that is referred to as in.bedGraph in step 5 below.
  2. Remove any existing 'track' or 'browser' lines from your bedGraph file so that it contains only data.
  3. Download the bedGraphToBigWig program from the directory of binary utilities.
  4. Use the fetchChromSizes script from the same directory to create the chrom.sizes file for the UCSC database you are working with (e.g. hg19). Note that this is the file that is referred to as chrom.sizes in step 5 below.
  5. Create the bigWig file from your bedGraph file using the bedGraphToBigWig utility like so: bedGraphToBigWig in.bedGraph chrom.sizes myBigWig.bw
    (Note that the bedGraphToBigWig program DOES NOT accept a gzipped bedGraph input file.)
  6. Move the newly created bigWig file (myBigWig.bw) to a http, https, or ftp location.
  7. Paste the URL into the custom track entry form or construct a custom track using a single track line.
  8. Paste this custom track line into the text box in the custom track management page.

Sharing Your Data with Others

If you would like to share your bigWig data track with a colleague, learn how to create a URL by looking at Example 11 on this page.

Extracting Data from the bigWig Format

Because the bigWig files are indexed binary files, they can be difficult to extract data from. Consequently, we have developed the following two programs, both of which are available from the directory of binary utilities.

  • bigWigToBedGraph — this program converts a bigWig file to ASCII bedGraph format.
  • bigWigToWig — this program converts a bigWig file to wig format.
  • bigWigSummary — this program extracts summary information from a bigWig file.
  • bigWigAverageOverBed — this program computes the average score of a bigWig over each bed, which may have introns.
  • bigWigInfo — this program prints out information about a bigWig file.
These utilities accept paths to files or alternatively URLs to file. As with all UCSC Genome Browser programs, simply type the program name at the command line with no parameters to see the usage statement.

In some cases, bigWigSummary and bigWigAverageOverBed will produce very similar results, but in other cases, the results may differ. This is due to differences in how the utilities handle data. Summary levels are used with bigWigSummary, so some rounding errors and border conditions are encountered when extracting data over relatively small regions. The bigWigAverageOverBed utility uses the actual data which ensures the highest level of accuracy.