- Home
- Genomes
- Genome Browser
- Tools
- Mirrors
- Downloads
- My Data
- Projects
- Help
- 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.
Note that the bedToBigBed
utility uses a substantial amount of memory:
approximately 25% more RAM than the uncompressed BED input 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/
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.
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
Step 2.
Download the bedToBigBed
program from the
binary utilities directory.
Example #2 below shows the exact Unix command.
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.
Step 3.
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 4.
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
3:
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 Step 8.
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 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).chr21:33,031,597-33,041,570
.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
chr21:33,031,597-33,041,570
.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
Paste the browser and track lines into the custom track
page, click the "submit" button and the "go" link to see the data.In this example, you will create your own bigBed file from an existing bed file.
wget https://genome.ucsc.edu/goldenPath/help/examples/bedExample.txt
wget https://genome.ucsc.edu/goldenPath/help/hg19.chrom.sizes
chrom
field, and secondarily on the chromStart
field. You can use the utility bedSort
available here
or the following UNIX sort
command to do this:
sort -k1,1 -k2,2n unsorted.bed > input.bed
bedToBigBed
utility (Step 3, 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
mv myBigBed.bb ~/public_html/
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.
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, 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 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
bedClip
program
(available here) to remove the problematic
row(s) in your input BED file before using the bedToBigBed
program.