BedGraph Track Format

The bedGraph format allows display of continuous-valued data in track format. This display type is useful for probability scores and transcriptome data. This track type is similar to the wiggle (WIG) format, but unlike the wiggle format, data exported in the bedGraph format are preserved in their original state. This can be seen on export using the table browser. For more details on data compression in wiggle tracks see the notes section of the wiggle track description page. If you have a very large data set and you would like to keep it on your own server, you should use the bigWig data format. In fact, an attempt to load a bedGraph custom track over 50,000,000 lines will result in an error message, but can be addressed by turning the bedGraph into a bigWig (see Example 3). Note that bedGraph files cannot easily be converted to wiggle files; converting bedGraph to bigWig and using bigWigToWig will return the original bedGraph file.

General Structure

The bedGraph format is line-oriented. BedGraph data are preceded by a track definition line, which adds a number of options for controlling the default display of this track.

Following the track definition line are the track data in four column BED format:

chromA  chromStartA  chromEndA  dataValueA
chromB  chromStartB  chromEndB  dataValueB

Parameters for bedGraph track definition lines

All options are placed in a single line separated by spaces:

track type=bedGraph name=track_label description=center_label
    visibility=display_mode color=r,g,b altColor=r,g,b
    priority=priority autoScale=on|off alwaysZero=on|off gridDefault=on|off
    maxHeightPixels=max:default:min graphType=bar|points viewLimits=lower:upper
    yLineMark=real-value yLineOnOff=on|off
    windowingFunction=maximum|mean|minimum smoothingWindow=off|2-16

Note: if you copy/paste the above example, you must remove the line breaks.

The track type is REQUIRED, and must be bedGraph:

type=bedGraph

The remaining values are OPTIONAL. The wiggle documentation contains details on these options. A functional description of these options can be seen in the track configuration description. (Custom tracks do not have interactive configuration options.)

Data Values

BedGraph track data values can be integer or real, positive or negative values. The chromosome coordinates are zero-based, half-open. This means that the first chromosome position is 0, and the last position in a chromosome of length N would be N - 1. The positions listed in the input data must be in numerical order, and only the specified positions will be graphed. bedGraph format has four columns of data:

chrom chromStart chromEnd dataValue

Example

This example specifies 9 separate data points in three tracks on chr19 in the region 49,302,001 to 49,304,701. To view this example as a custom track in the Genome Browser, copy the text and paste it into the browser annotation track text box.

browser position chr19:49302001-49304701
browser hide all
browser pack refGene encodeRegions
browser full altGraph
#	300 base wide bar graph, autoScale is on by default == graphing
#	limits will dynamically change to always show full range of data
#	in viewing window, priority = 20 positions this as the second graph
#	Note, zero-relative, half-open coordinate system in use for bedGraph format
track type=bedGraph name="BedGraph Format" description="BedGraph format" visibility=full color=200,100,0 altColor=0,100,200 priority=20
chr19 49302000 49302300 -1.0
chr19 49302300 49302600 -0.75
chr19 49302600 49302900 -0.50
chr19 49302900 49303200 -0.25
chr19 49303200 49303500 0.0
chr19 49303500 49303800 0.25
chr19 49303800 49304100 0.50
chr19 49304100 49304400 0.75
chr19 49304400 49304700 1.00

Note: The above example is a custom track that includes a track type= line that is specific for loading the data in the browser. This line will cause a raw bedGraph data file to fail validation by other tools, such as validateFiles, outside of the browser.