The bigBed format stores annotation items that can be either a simple or a linked collection of
exons, much as BED files do. BigBed files are created
from BED type files using the program
bedToBigBed. The resulting bigBed
files are in an indexed binary format. The main advantage of the bigBed files is that only
those portions of the files needed to display a particular region are transferred to the Genome
Browser server. Because of this, bigBed has considerably faster display performance than
regular BED when working with large data sets. The bigBed file remains on your local web-accessible
server (http, https, or ftp), not on the UCSC server, and only the portion that is needed for the
currently displayed chromosomal position is locally cached as a "sparse file".
Additional indices can be created for the items in a bigBed file to support item search in track hubs. See Example #3 below for an example of how to build an additional index.
See this wiki page for help in selecting the graphing track data format that is most approriate for your type of data.
Note that the
bedToBigBed utility uses a substantial amount of memory:
approximately 25% more RAM than the uncompressed BED input file.
To create a bigBed track, follow these steps:
Create a BED format file following the directions
here. When converting a BED file to a bigBed file,
you are limited to one track of data in your input file; therefore, you must create a separate BED
file for each data track. Your BED file must be sorted first on the
chrom field, and
secondarily on the
chromStart field. You can use the following UNIX
command to do this:
sort -k1,1 -k2,2n unsorted.bed > input.bed
Step 2. Remove any existing "track" or "browser" lines from your BED file so that it contains only data.
bedToBigBed program from the
binary utilities directory.
fetchChromSizes script from the
to create the chrom.sizes file for the UCSC database you are working with (e.g., hg19).
bedToBigBed utility to create a bigBed file from your sorted BED file, using
the input.bed file and chrom.sizes files created in Steps 1 and
bedToBigBed input.bed chrom.sizes myBigBed.bb
Step 6. Move the newly created bigBed file (myBigBed.bb) to a web-accessible http, https, or ftp location.
Step 7. If the file name ends with a .bigBed or .bb suffix, you can paste the URL of the file directly into the custom track management page, click "submit" and view the file as a track in the Genome Browser. By default, the file name will be used to name the track. To configure the track name and descriptions, you must create a "track line", as shown in Step 8.
Step 8. Construct a custom track using a single track line. Note that any of the track attributes listed here are applicable to tracks of type bigBed. The most basic version of the track line will look something like this:
track type=bigBed name="My Big Bed" description="A Graph of Data from My Lab" bigDataUrl=http://myorg.edu/mylab/myBigBed.bb
Paste this custom track line into the text box on the custom track management page.
bedToBigBed program can be run with several additional options. Some of these,
such as the
-type options, are used in examples below. For a full
list of the available options, type
bedToBigBed (with no arguments) on the command line
to display the usage message.
In this example, you will create a bigBed custom track using an existing bigBed file, bigBedExample.bb, on the UCSC http server. This file contains chromosome 21 data on the human hg19 assembly.
To create a custom track using this bigBed file:
http://genome.ucsc.edu/goldenPath/help/examples/bigBedExample.bbinto the custom track management page for the human assembly hg19 (Feb. 2009).
Alternatively, you can customize the track display by including track and browser lines that define certain parameters:
track type=bigBed name="bigBed Example One" description="A bigBed file" bigDataUrl=http://genome.ucsc.edu/goldenPath/help/examples/bigBedExample.bb
browser position chr21:33,031,597-33,041,570
In this example, you will create your own bigBed file from an existing bed file.
bedToBigBedutility (Step 3, above).
bedToBigBed bedExample.txt hg19.chrom.sizes myBigBed.bb
In this example, you will create your own bigBed file from a fully featured existing BED file that contains the standard BED fields up to and including the color field (field 9), plus two additional non-standard fields (two alternate names for each item in the file). BigBed files can store extra fields in addition to the predefined BED fields. If you add extra fields to your bigBed file, you must include an AutoSQL format (.as) file describing the fields. For more information on AutoSql, see Kent and Brumbaugh, 2002, as well as examples of .as files in this directory. This example also demonstrates how to create extra indices on the name field, and the first of the extra fields to be used for track item search.
bedToBigBedutility (Step 3, above).
bedToBigBed -as=bedExample2.as -type=bed9+2 -extraIndex=name,geneSymbol bedExample2.bed hg18.chrom.sizes myBigBed2.bb
itemRgbattribute in the track line. It will look somewhat similar to this (note that you must insert the URL specific to your own bigBed file):
track type=bigBed name="bigBed Example Three" description="A bigBed File with Color and two Extra Fields" itemRgb="On" bigDataUrl=http://yourWebAddress/myBigBed2.bb
bedToBigBedutility with the option
-extraIndex=name, you will be able to search on the "name" field by adding the line
searchIndex nameto the stanza about your bigBed in the hub's trackDb.txt file.
If you would like to share your bigBed data track with a colleague, learn how to create a URL by looking at Example #11 on this page.
Because the bigBed files are indexed binary files, it can be difficult to extract data from them. UCSC has developed the following programs to assist in working with bigBed formats, available from the binary utilities directory:
bigBedToBed— converts a bigBed file to ASCII BED format.
bigBedSummary— extracts summary information from a bigBed file.
bigBedInfo— prints out information about a bigBed file.
These programs accept either file names or URLs to files as input. As with all UCSC Genome Browser programs, simply type the program name (with no parameters) on the command line to view the usage statement.
If you get an error when you run the
bedToBigBed program, check your input BED file for
data coordinates that extend past the end of the chromosome. If these are present, run the
(available here) to remove the problematic
row(s) in your input BED file before using the