BED and Interval-Based Genomic Formats

  • BED (Browser Extensible Data) is a widely used text-based format in bioinformatics for representing genomic regions and intervals. It describes the locations of genomic features, such as genes, exons, promoters, enhancers, transcription factor binding sites, regulatory elements, sequencing peaks, and other regions of interest. BED and related interval-based formats are essential for genome browsing, genomic data integration, comparative genomics, epigenomics, ChIP-seq analysis, ATAC-seq analysis, variant interpretation, and many other applications involving genomic coordinates.
  • An interval is a continuous region of a reference genome defined by its starting and ending coordinates. For example, a genomic interval may represent a gene extending from one position to another on a chromosome, an exon within a transcript, or a regulatory region associated with gene expression. Interval-based formats allow researchers to describe, compare, overlap, merge, intersect, and manipulate genomic regions efficiently. These operations are fundamental to many bioinformatics workflows because biological questions often involve determining whether two genomic features occupy overlapping or nearby regions.
  • BED files are commonly used with the UCSC Genome Browser and many command-line bioinformatics tools. A standard BED record contains at least three columns: chromosome, start, and end. These columns identify the reference sequence and define the genomic interval. Additional columns can describe feature names, scores, strand orientation, display colours, coding regions, and the internal structure of complex features. BED is therefore flexible enough to represent both simple genomic intervals and more detailed structures such as genes and transcripts.
  • The most important characteristic of BED is its coordinate convention. BED uses a zero-based, half-open coordinate system. This means that the start coordinate is included, but the end coordinate is excluded. For example, a BED interval from position 100 to position 200 represents bases 101 through 200 when positions are described using one-based biological numbering. Its length is calculated by subtracting the start coordinate from the end coordinate, giving 100 bases. This convention differs from GFF3 and GTF, which use one-based inclusive coordinates. Confusing these coordinate systems can introduce off-by-one errors during data conversion, genomic overlap analysis, and interpretation of biological features.
  • A simple BED file containing three genomic intervals may look like this:

chr1    100    200

chr1    300    450

chr2    500    700

  • Each line represents an interval on a chromosome. The first interval covers 100 bases, the second covers 150 bases, and the third covers 200 bases. BED files are generally tab-delimited, and the first three columns are sufficient for basic interval operations. A file containing only these three columns is commonly called BED3.
  • BED supports up to twelve commonly defined columns. BED3 contains the chromosome, start, and end coordinates. BED4 adds a name for the feature. BED5 adds a score, usually represented by a numerical value between 0 and 1000 in traditional BED conventions. BED6 adds the strand, represented by +, -, or .. BED7 adds a thickStart coordinate, BED8 adds a thickEnd coordinate, and BED9 adds an RGB colour value for graphical display. BED10 introduces the number of blocks, BED11 contains the sizes of the blocks, and BED12 contains the relative starting positions of the blocks. These additional columns allow BED to represent more complex genomic features.
  • A BED6 record may look like this:

chr1    1000    2000    GeneA    850    +

chr1    3000    4500    GeneB    600    –

chr2    5000    6500    GeneC    950    +

  • Here, the fourth column contains feature names, the fifth contains scores, and the sixth indicates strand orientation. The score can be used to represent a feature’s relative strength or significance, depending on the analysis and the conventions of the data producer. It should not automatically be interpreted as a statistical probability or p-value.
  • BED12 is particularly useful for representing features composed of multiple separate genomic blocks, such as transcripts containing multiple exons. The block information describes the locations and lengths of the individual components within a larger genomic interval. The blockCount column indicates how many blocks are present, blockSizes specifies the length of each block, and blockStarts gives the starting position of each block relative to the beginning of the complete BED interval. For example, a transcript may span a genomic region containing three exons separated by two introns. The overall interval covers the transcript’s genomic span, while the blocks identify the exon regions.
  • An illustrative BED12 record is shown below:

chr1    1000    5000    Transcript1    900    +    1000    5000    0    3    500,400,600    0,1600,3400

  • This record describes a transcript spanning 4,000 bases, with three blocks of 500, 400, and 600 bases. The block starts are 0, 1,600, and 3,400 bases relative to the beginning of the transcript’s genomic interval. The blocks therefore represent separate regions within the transcript, while the intervening genomic regions correspond to gaps between those blocks. In typical transcript representations, the blocks correspond to exons. The thickStart and thickEnd columns identify the region displayed as the coding portion of the feature in genome browsers, while the RGB column controls display colour. A value of 0 in the RGB column is commonly used for black.
  • BED files can contain browser-specific display directives, such as track and browser lines, which control how features are displayed in genome browsers. For example, a track line can specify the name, colour, and display mode of a BED dataset. These lines are useful for visualization but are not genomic feature records themselves.

track name=”Example Regions” description=”Genomic intervals” itemRgb=”On”

chr1    1000    2000    RegionA    850    +    1000    1800    255,0,0

chr1    3000    4500    RegionB    600    –    3200    4400    0,0,255

  • BED is closely related to several other genomic interval formats. These formats represent different types of genomic information and are designed for particular analytical or visualization purposes. Some of the most important include bedGraph, bigBed, WIG, bigWig, narrowPeak, broadPeak, and BEDPE.
  • bedGraph is a text-based format used to represent numerical values across genomic intervals. Unlike a basic BED file, which primarily identifies genomic regions, bedGraph associates each interval with a quantitative value. These values may represent read coverage, signal intensity, chromatin accessibility, conservation scores, or other measurements. A bedGraph record contains four main columns: chromosome, start, end, and value.

chr1    1000    1500    12.5

chr1    1500    2000    18.7

chr1    2000    2500    9.3

chr2    3000    3500    22.1

  • Each record describes a genomic interval and its associated numerical value. The values may represent average signal intensity or another measurement defined by the data producer. bedGraph is useful for examining changes in genomic signals across chromosomes and for identifying regions with high or low measurements. It is commonly used as an intermediate format for generating bigWig files.
  • bigWig is a binary, indexed format designed for storing and displaying quantitative genomic data efficiently. It is particularly useful for large datasets containing coverage or signal values across entire genomes. Compared with text-based bedGraph files, bigWig files are generally more compact and support rapid retrieval of data from selected genomic regions. Genome browsers can retrieve only the portions required for display instead of loading the entire dataset. bigWig is therefore widely used for visualizing RNA-seq coverage, ChIP-seq signals, ATAC-seq accessibility, conservation scores, and other continuous genomic measurements.
  • WIG (Wiggle) is another format for representing quantitative values along genomic sequences. It supports variable-step and fixed-step representations. In a fixed-step WIG file, genomic positions are described using a starting coordinate, a step size, and a span. In a variable-step WIG file, individual positions are specified explicitly. WIG is useful for representing continuous genomic signals, although bigWig is generally preferred for efficient storage and genome-browser visualization of large datasets.
  • A simplified fixed-step WIG example is shown below:

fixedStep chrom=chr1 start=1001 step=10 span=10

5.2

7.8

9.1

6.4

  • This example represents consecutive genomic intervals with values assigned according to the specified starting position, step size, and span. A variable-step example uses explicit positions:
  • variableStep chrom=chr1 span=10

1001    5.2

1021    7.8

1041    9.1

  • In variable-step WIG, the first column after the header identifies the genomic position, and the second contains the associated numerical value. The exact coordinate interpretation should be checked against the WIG specification and the conventions of the software generating or consuming the file.
  • narrowPeak and broadPeak are specialized BED-derived formats commonly produced by peak-calling software in ChIP-seq and related epigenomic analyses. They are used to represent genomic regions enriched for sequencing signals, such as transcription factor binding sites or histone modifications. Both formats extend BED6 with additional columns describing peak-related information.
  • narrowPeak is generally used for relatively narrow enrichment regions, such as transcription factor binding sites. It contains ten columns: chromosome, start, end, name, score, strand, signal value, p-value, q-value, and peak position. The final column identifies the position of the peak summit relative to the beginning of the interval. A value of -1 indicates that the summit position is not available.

chr1    1000    1200    Peak1    850    .    12.5    8.2    6.7    95

chr1    3000    3150    Peak2    720    .    9.8     6.5    5.1    70

  • broadPeak is designed for wider enrichment regions, such as some histone modification signals that extend across large genomic intervals. It contains nine columns: chromosome, start, end, name, score, strand, signal value, p-value, and q-value. Unlike narrowPeak, broadPeak does not include a separate peak-summit position.

chr1    5000    8500    BroadPeak1    900    .    15.7    10.2    8.4

chr2    2000    6000    BroadPeak2    750    .    11.3    7.8     6.1

  • The score, signal value, p-value, and q-value have specific meanings determined by the peak-calling conventions. They should not be treated as interchangeable measurements. For example, the score is often a display-oriented value, while p-value and q-value represent statistical evidence under the peak caller’s model. The exact interpretation should be taken from the software documentation and analysis settings.
  • BEDPE (BED Paired-End) is a format designed to represent pairs of genomic intervals. It is useful for describing genomic interactions, paired-end sequencing events, chromosomal rearrangements, structural variation, and other relationships involving two genomic locations. A BEDPE record typically contains at least six columns: chromosome 1, start 1, end 1, chromosome 2, start 2, and end 2. Additional columns may describe feature names, scores, strands, and other properties.

chr1    1000    1100    chr1    5000    5100    Interaction1    900    +    –

chr2    2000    2100    chr5    8000    8100    Interaction2    750    –    +

  • Each record describes two genomic regions that are associated with one another. BEDPE is particularly useful in Hi-C and other chromatin interaction analyses, as well as in the representation of paired genomic breakpoints. It should not be confused with BED12, which represents multiple blocks within a single genomic feature rather than a pair of independently located intervals.
  • Another important distinction is between interval formats and sequence or variant formats. BED, bedGraph, and related formats describe genomic regions and associated measurements, whereas FASTA represents nucleotide or protein sequences, FASTQ represents sequencing reads and their quality scores, and VCF represents genetic variants with their associated information. GFF3 and GTF describe annotated genomic features, including their biological relationships. These formats can be combined in bioinformatics workflows, but their coordinate systems, data structures, and biological meanings must be respected.
  • A central operation in interval-based genomic analysis is determining whether two genomic regions overlap. For example, researchers may want to identify which genes overlap a set of regulatory regions, whether a genetic variant lies within an exon, or which sequencing peaks occur near promoters. Other common operations include merging overlapping intervals, finding regions unique to one dataset, calculating the distance between features, identifying nearest genes, and measuring the percentage of overlap between genomic regions.
  • BEDTools is one of the most widely used command-line software suites for performing genomic interval operations. It supports operations such as intersect, merge, subtract, closest, coverage, and window. These operations allow researchers to compare genomic regions, identify shared intervals, remove unwanted regions, calculate coverage, and locate nearby features.
  • For example, the following command identifies overlaps between a set of peaks and a gene annotation file:

bedtools intersect \

    -a peaks.bed \

    -b genes.bed \

    -wa \

    -wb \

    > overlapping_regions.txt

  • The -a and -b options specify the two input files. The -wa and -wb options retain the original records from both files for each overlap. The output can be used to identify which peaks intersect particular genes or other annotated features.
  • The following command merges overlapping or directly adjacent intervals:

bedtools merge \

    -i sorted_regions.bed \

    > merged_regions.bed

  • The input BED file should be sorted by chromosome and start coordinate before merging. The command combines overlapping or adjacent intervals into larger regions. If gaps are to be allowed between intervals, the -d option can specify the maximum distance within which intervals should be merged.

bedtools merge \

    -i sorted_regions.bed \

    -d 100 \

    > merged_regions_100bp.bed

The closest operation identifies the nearest feature in one dataset for each interval in another dataset:

bedtools closest \

    -a peaks.bed \

    -b genes.bed \

    > nearest_genes.txt

  • This is useful for associating regulatory regions with nearby genes. However, genomic proximity does not necessarily establish a regulatory relationship. Enhancers can act over long distances, and the nearest gene is not always the gene regulated by a particular element.
  • In Python, genomic intervals can be analyzed using packages such as pybedtools and PyRanges. pybedtools provides a Python interface to BEDTools, while PyRanges offers efficient data structures and operations for genomic interval analysis. The following example uses pybedtools to identify overlapping regions.

pip install pybedtools

  • BEDTools must also be installed and accessible in the system environment.

import pybedtools

peaks = pybedtools.BedTool(“peaks.bed”)

genes = pybedtools.BedTool(“genes.bed”)

overlaps = peaks.intersect(genes, wa=True, wb=True)

overlaps.saveas(“peak_gene_overlaps.bed”)

for record in overlaps:

    print(record)

  • The following example uses PyRanges to identify overlapping genomic intervals:

pip install pyranges

import pyranges as pr

peaks = pr.read_bed(“peaks.bed”)

genes = pr.read_bed(“genes.bed”)

overlaps = peaks.join(genes)

print(overlaps.df.head())

  • PyRanges can also be used to merge intervals and calculate genomic overlaps. Its data structures are useful for working with large collections of genomic regions in Python, although memory requirements and performance depend on dataset size and the operations performed.

import pyranges as pr

regions = pr.read_bed(“regions.bed”)

merged_regions = regions.merge()

merged_regions.to_bed(“merged_regions.bed”)

  • In R, the Bioconductor package GenomicRanges provides a powerful framework for representing and manipulating genomic intervals. Its GRanges objects store genomic coordinates, strand information, and associated metadata. Functions such as findOverlaps, reduce, subsetByOverlaps, and nearest support many common interval operations.

if (!requireNamespace(“BiocManager”, quietly = TRUE)) {

    install.packages(“BiocManager”)

}

BiocManager::install(“GenomicRanges”)

BiocManager::install(“rtracklayer”)

library(GenomicRanges)

library(rtracklayer)

peaks <- import(“peaks.bed”)

genes <- import(“genes.bed”)

overlaps <- findOverlaps(peaks, genes)

print(overlaps)

The following example extracts the genomic intervals that overlap between the two datasets:

shared_peaks <- subsetByOverlaps(

    peaks,

    genes

)

print(shared_peaks)

Overlapping intervals can also be reduced into merged regions:

merged_regions <- reduce(peaks)

print(merged_regions)

  • The rtracklayer package supports importing and exporting several genomic formats, including BED, GFF, GTF, bedGraph, and other supported representations. This makes it useful for converting genomic annotations and interval datasets into objects that can be analyzed using Bioconductor tools.
  • BED and related interval formats are also important in genome-browser visualization. The UCSC Genome Browser, Ensembl genome browser, and other genome visualization systems can display genomic intervals, quantitative signals, and peak regions. BED and BED12 are commonly used for displaying features, while bigBed supports indexed display of large collections of genomic features. bigWig is used for continuous quantitative signals. These formats allow researchers to examine genomic regions without downloading and loading entire datasets into memory.
  • bigBed is a compressed, indexed binary format derived from BED. It is designed to support rapid retrieval and visualization of genomic features, especially when working with large datasets. It preserves BED-style feature information while allowing genome browsers to retrieve selected genomic regions efficiently. bigBed is particularly useful for sharing large annotation tracks and displaying them in genome browsers. Conversion from BED to bigBed can be performed using UCSC utilities such as bedToBigBed, provided that the input is appropriately sorted and a chromosome sizes file is available.

sort -k1,1 -k2,2n regions.bed > regions.sorted.bed

bedToBigBed \

    regions.sorted.bed \

    chrom.sizes \

    regions.bb

  • The chromosome sizes file must correspond to the same genome assembly used by the BED file. The BED input must also meet the requirements of the selected bigBed format and its declared number of fields.
  • Data validation is essential when working with BED and related formats. Researchers should check that each record contains the required number of columns, coordinates are valid, start positions are not negative, and end positions are greater than start positions. Chromosome identifiers should match the reference genome, and intervals should be sorted when required by the selected tool. For BED12, the number of blocks should agree with the number of entries in the block-size and block-start lists. Block coordinates should also fall within the overall interval. For bedGraph and peak formats, numerical values should be checked for appropriate data types and valid ranges according to the relevant specification.
  • Genome assembly compatibility is another important consideration. A BED file created for one reference assembly cannot automatically be assumed to match another assembly. Chromosome naming conventions may differ, such as chr1 versus 1, and genomic coordinates may shift between assemblies. When intervals must be transferred between genome assemblies, tools such as UCSC liftOver and CrossMap can be used with suitable chain files. However, not all regions can be mapped successfully, and some intervals may map ambiguously or be split. The resulting coordinates should therefore be validated before downstream interpretation.
  • The relationship between BED and GFF3 or GTF is particularly important in genomic data processing. GFF3 and GTF use one-based inclusive coordinates and provide detailed annotation attributes and biological relationships. BED uses zero-based half-open coordinates and is particularly convenient for interval operations. When converting a GFF3 or GTF feature to BED, the start coordinate is reduced by one, while the end coordinate remains unchanged. For example, a GFF3 feature with coordinates 101 to 200 becomes a BED interval with coordinates 100 to 200. Both represent the same 100 genomic bases. Conversion should preserve strand and relevant feature identifiers whenever possible.
  • BED and interval-based formats are widely used in gene expression studies, epigenomics, chromatin biology, genome annotation, and comparative genomics. In ChIP-seq analysis, narrowPeak and broadPeak files represent enriched regions associated with transcription factor binding or histone modifications. In ATAC-seq analysis, BED files describe accessible chromatin regions. In RNA-seq analysis, BED and BED12 can represent genomic coverage and transcript structures. In variant analysis, genomic intervals can be used to identify variants located within genes, exons, regulatory regions, or other functional elements. In comparative genomics, interval operations can identify conserved regions or genomic segments shared between species, provided that coordinates have been appropriately mapped to comparable reference assemblies.
  • Overall, BED and related interval-based genomic formats provide an efficient and flexible way to represent genomic coordinates, features, and quantitative signals. Understanding BED3 through BED12, coordinate conventions, bedGraph, bigWig, WIG, narrowPeak, broadPeak, BEDPE, and bigBed is essential for handling genomic regions accurately. Their integration with tools such as BEDTools, PyRanges, pybedtools, and GenomicRanges enables researchers to perform reliable genomic interval operations, visualize biological features, and connect different types of genomic data in reproducible bioinformatics workflows.
Author:

Leave a Reply

Your email address will not be published. Required fields are marked *