The bigBed format stores annotation items that can either be simple, or a linked collection of
exons, much as BED files do. BigBed files are created
initially 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 the
portions of the files needed to display a particular region are transferred to UCSC, so for large
data sets bigBed is considerably faster than regular BED files. The bigBed 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".
Additional indices can be created for the items in a bigBed file. These indices can be used to support item search in track hubs. See Example 3 for an example of how to build an additional index.
See this page for help in selecting a 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:
sort -k1,1 -k2,2n unsorted.bed > input.bed
input.bed
in
step 5 below.bedToBigBed
program from the
directory of binary utilities.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.bedToBigBed
utility like so:
bedToBigBed input.bed chrom.sizes myBigBed.bb
myBigBed.bb
) to a http, https, or ftp
location. track type=bigBed name="My Big Bed" description="A Graph of Data from My Lab" bigDataUrl=http://myorg.edu/mylab/myBigBed.bb
The bedToBigBed
program can also be run with several additional options. Some of them,
like the -as
and -type
options, are used in examples below. A full list of
the available options can be seen by running bedToBigBed
by itself with no arguments
to display the usage message.
In this example, you will use an existing bigBed file to create a bigBed custom track. A bigBed file that contains data on chromosome 21 on the hg19 assembly has been placed on our http server.
You can create a custom track using this bigBed file by pasting the URL
http://genome.ucsc.edu/goldenPath/help/examples/bigBedExample.bb
into the
custom track management page, clicking submit and clicking the
chr21 link in the custom track listing.
Alternatively, you can construct a "track" line that references this file like so:
track type=bigBed name="bigBed Example One" description="A bigBed file" bigDataUrl=http://genome.ucsc.edu/goldenPath/help/examples/bigBedExample.bb
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 bigBed track in the Genome Browser.
In this example, you will create your own bigBed file from an existing bed file.
bedToBigBed
utility (see step 3). bedToBigBed bedExample.txt hg19.chrom.sizes myBigBed.bb
myBigBed.bb
) on a web-accessible server (see
step 6).
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 a .as
(AutoSQL) format file
describing the fields. See this
paper for information on AutoSQL. There are several sample .as
files
here. 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.
.as
file contains a description of the fields in the BED file. This is required when the BED file
contains a field for color.bedToBigBed
utility (see step 3). bedToBigBed -as=bedExample2.as -type=bed9+2 -extraIndex=name,geneSymbol bedExample2.bed hg18.chrom.sizes myBigBed2.bb
myBigBed2.bb
) on a web-accessible server
(see step 6).itemRgb
attribute in the
"track" line. It will look somewhat similar to this (note that you must insert the
correct URL to your 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
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, 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.
bigBedToBed
— this program converts a bigBed file to ASCII BED format.bigBedSummary
— this program extracts summary information from a bigBed
file.bigBedInfo
— this program prints out information about a bigBed file.These programs accept file names as input or alternatively also URLs to files. As with all UCSC Genome Browser programs, simply type the program name at the command line with no parameters to see the usage statement.
If you get an error when you run the bedToBigBed
program, it may be because your input
BED file has data off the end of a chromosome. In this case, use the bedClip
program
here before the bedToBigBed
program. It will remove the row(s) in your input BED file that are off the end of a chromosome.