bedtools
Analyze and manipulate genomic interval data
TLDR
Intersect genomic intervals
SYNOPSIS
bedtools command [options]
DESCRIPTION
bedtools is a suite of utilities for analyzing genomic intervals in BED, BAM, VCF, and GFF formats. It provides fast operations on genome annotations including intersection, merging, counting, and statistical analysis.
The tool is essential for genomics research and comparative analysis of genomic features.
COMMANDS
intersect
Find overlapping intervalsmerge
Combine overlapping intervalscoverage
Compute coverage statisticssubtract
Remove overlapping intervalsclosest
Find nearest intervalswindow
Find nearby intervals within windowsort
Sort BED/GFF/VCF filesgenomecov
Compute genome-wide coveragegetfasta
Extract sequences from FASTAbamtobed
Convert BAM to BED
COMMON PARAMETERS
-a file
First input file-b file
Second input file-wa
Write original A entry-wb
Write original B entry-f fraction
Minimum overlap fraction-v
Report A entries without B overlap-s
Require same strand
WORKFLOW
bedtools intersect -a genes.bed -b snps.bed
# Merge nearby features
bedtools merge -i features.bed -d 100
# Count reads in regions
bedtools coverage -a regions.bed -b reads.bam
# Extract promoter regions
bedtools flank -i genes.bed -g genome.txt -l 2000 -r 0
CAVEATS
Some operations require sorted input. Large files consume significant memory. Coordinate systems (0-based vs 1-based) can cause off-by-one errors. Performance depends on file size and operation.
HISTORY
bedtools was created by Aaron Quinlan and Ira Hall, first released in 2010 as a comprehensive toolkit for genomic interval analysis.
