- Home
- Genomes
- Genome Browser
- Tools
- My Data
- Help
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". If you do not have
access to a web-accessible server and need hosting space for your bigBed files, please see the
Hosting section of the Track Hub Help documentation.
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 appropriate 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:
Step 1.
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 utility bedSort
available here
or the following UNIX sort
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.
Step 3.
Download the bedToBigBed
program from the
binary utilities directory.
Step 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).
If the assembly genNom
is hosted by UCSC, chrom.sizes can be a URL like:
http://hgdownload.soe.ucsc.edu/goldenPath/genNom/bigZips/genNom.chrom.sizes
Step 5.
Use the 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
4:
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.
The bedToBigBed
program can be run with several additional options. Some of these,
such as the -as
and -type
options, are used in examples below. The
-type
option, describes the size of the bigBed file, -type=bedN[+[P]]
,
where N
is an integer between 3 and 12 and the optional +[P]
parameter
specifies the number of extra fields, not required, but preferred. Describing the size of the bigBed file
is needed for access to extra fields like name, itemRgb, etc.
Examples:-type=bed6
or -type=bed6+
or -type=bed6+3
.
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.bb
into
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.
bedToBigBed
utility (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). Since the resulting
bigBed file will have nine standard BED columns, which would include what is referenced as the
itemRgb field to inform the browser to display a R,G,B color value (e.g. 255,0,0), and two
additional non-standard user-defined columns, the bedToBigBed program is given -type=bed9+2
and a file called -as=bedExample2.as
to help correctly interpret all the
columns in the data. 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. The searchIndex setting requires the input BED data to be
case-senstive sorted (sort -k1,1 -k2,2n
), where newer versions of the tool bedToBigBed
(available here) are enhanced to catch
improper input.
bedToBigBed
utility (Step 3, above).bedToBigBed -as=bedExample2.as -type=bed9+2 -extraIndex=name,geneSymbol bedExample2.bed hg18.chrom.sizes myBigBed2.bb
itemRgb
attribute 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
bedToBigBed
utility with the option
-extraIndex=name
, you will be able to search on the "name" field by adding
the line searchIndex name
to 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 #6 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
bedClip
program
(available here) to remove the problematic
row(s) in your input BED file before using the bedToBigBed
program.