- Genome Browser
- My Data
- About Us
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. To see an example of turning a text-based bedDetail custom track
bigBed format, see this
How to make a bigBed file blog post.
Note that the
bedToBigBed utility uses a substantial amount of memory:
approximately 25% more RAM than the uncompressed BED input file.
The last step assumes that your ~/public_html/ directory is accessible from the internet. This may not be the case on your server. You may have to copy the file to another server and web-accessible location at your University. Once you know the URL to the file myBigBed.bb, you can paste this URL into the custom track box on the UCSC Genome Browser to display the file.
wget https://genome.ucsc.edu/goldenPath/help/examples/bedExample.txt wget https://genome.ucsc.edu/goldenPath/help/hg19.chrom.sizes wget http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/bedToBigBed chmod a+x bedToBigBed ./bedToBigBed bedExample.txt hg19.chrom.sizes myBigBed.bb mv myBigBed.bb ~/public_html/
To create a bigBed track, follow these steps (for concrete Unix commands, see the examples below on this page):
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.
If your BED file was originally a custom track, remove any existing
"track" or "browser" lines from your BED file so that it
contains only data. Also the input BED must be sorted, performed with this command:
sort -k1,1 -k2,2n unsorted.bed > input.bed
bedToBigBed program from the
binary utilities directory.
Example #2 below shows the exact Unix command.
bedToBigBed program can be run with several additional options. Some of these,
such as the
-type options, are used in examples below. The
-type option, describes the size of the bigBed file,
N is an integer between 3 and 12 and the optional
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.
For a full list of the available options, type
bedToBigBed (with no arguments) on the
command line to display the usage message.
fetchChromSizes script from the
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:
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 5. Move the newly created bigBed file (myBigBed.bb) to a web-accessible http, https, or ftp location. At this point you should have a URL to your data, such as "https://institution.edu/myBigBed.bb", and the file should be accessible outside of your institution/hosting providers network. For more information on where to host your data, please see the Hosting section of the Track Hub Help documentation.
Step 6. 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 Example 1 Configuration Step 1.
Alternatively, if you want to set the track labels and other options yourself, 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.
In this example, you will load an existing bigBed file, bigBedExample.bb, on the UCSC http server. This file contains data on chromosome 21 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).
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
Paste the browser and track lines into the custom track page, click the "submit" button and the "go" link to see the data.
browser position chr21:33,031,597-33,041,570 track type=bigBed name="bigBed Example One" description="A bigBed file" bigDataUrl=http://genome.ucsc.edu/goldenPath/help/examples/bigBedExample.bb
In this example, you will convert a sample BED file to bigBed format.
chromfield, and secondarily on the
chromStartfield. You can use the utility
bedSortavailable here or the following UNIX
sortcommand to do this:
sort -k1,1 -k2,2n unsorted.bed > input.bed
bedToBigBedutility (Step 2, above). Replace "linux" below with "macOSX" if your server is a Mac.
wget http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/bedToBigBed chmod a+x bedToBigBed
./bedToBigBed bedExample.txt hg19.chrom.sizes myBigBed.bb
At some Universities, this involves using the commands ftp, scp or rsync to copy the file to a different server, one that is accessible from the internet. We have documentation how to find such a server.
mv myBigBed.bb ~/public_html/
BigBed files can store extra fields in addition to the predefined BED fields. 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 called itemRgb (field 9), plus two additional non-standard fields (two alternate names for each item in the file). The standard BED column itemRgb contains an R,G,B color value (e.g. "255,0,0"). The resulting bigBed file will have nine standard BED columns and two additional non-standard user-defined columns.
If you add extra fields to your bigBed file, you must include an AutoSql format
(.as) file describing the fields.
In this file, all fields (standard and non-standard) are described with a short
internal name and also a human-readable description.
For more information on AutoSql, see
Kent and Brumbaugh, 2002, as
well as examples of .as files in
Then, the bedToBigBed program is run with the arguments
-type=bed9+2 and also
-as=bedExample2.as to help correctly interpret all the columns in the data.
This example also demonstrates how to create an extra search index 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-sensitive sorted (
sort -k1,1 -k2,2n), where newer versions of the tool bedToBigBed
(available here) are enhanced to catch
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. While searchIndex expects a search string with an exact match in the index, another setting for Track Hubs, searchTrix allows for a fast look-up of free text associated with a list of identifiers, when a
searchIndexhas also been created. See a Searchable Track Hub Quick Start Guide here.
If you would like to share your bigBed data track with a colleague, the best solution is to save your current view as a stable Genome Browser Session Link. This will save the position and all settings that you made, all track visibilities, filters, highlights, etc.
If you want to create URLs to your bigBed file programmatically from software, look 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
(available here) to remove the problematic
row(s) in your input BED file before using the