Convert from BAM to BED

What it does

This tool converts a BAM file to a BED file. The end coordinate is computed by inspecting the CIGAR string. The QNAME for the alignment is used as the BED name field and, by default, the MAPQ is used as the BED score.

The "Report spliced BAM alignment..." option breaks BAM alignments with the "N" (splice) operator into distinct BED entries. For example, using this option on a CIGAR such as 50M1000N50M would, by default, produce a single BED record that spans 1100bp. However, using this option, it would create two separate BED records that are each 50bp in size and are separated by 1000bp (the size of the N operation). This is important for RNA-seq and structural variation experiments.

If using a custom BAM alignment TAG as the BED score, note that this must be a numeric tag (e.g., type "i" as in NM:i:0).

If creating a BEDPE output (see output formatting options), the BAM file should be sorted by query name.

This tool requires that bedtools has been installed on your system.


This tool is part of the bedtools package from the Quinlan laboratory. If you use this tool, please cite Quinlan AR, and Hall I.M. BEDTools: A flexible framework for comparing genomic features. Bioinformatics, 2010, 26, 6.