merge-bed
Quick Start
- Command:
mergeBed -i sorted.bed [options] - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/mergeBed - Full reference: See
references/help.md
When To Use This Tool
- Collapse overlapping or book-ended intervals into nonredundant merged regions.
- Merge nearby intervals within a maximum gap using
-d. - Keep strand-specific merged blocks with
-sor one chosen strand with-S. - Summarize columns across merged blocks with
-cand-o.
Common Patterns
# 1) Basic merge of sorted intervals
mergeBed \
-i peaks.sorted.bed
# 2) Merge intervals within 500 bp on the same strand
mergeBed \
-i exons.sorted.bed \
-s \
-d 500
# 3) Merge and summarize scores and names
mergeBed \
-i peaks.sorted.bed \
-c 4,5 \
-o collapse,max
Recommended Workflow
- Sort the input by chromosome and start coordinate before anything else.
- Decide whether book-ended features should merge as-is (
-d 0, the default) or whether you need a stricter / looser distance rule. - Add
-s/-Sonly when strand is biologically meaningful for the interval type. - Use
-cand-oexplicitly if you need metadata preserved, because raw merge output only reports merged coordinates.
Guardrails
- Sorted input is mandatory; unsorted files will produce wrong output.
-d 0merges both overlapping and directly book-ended intervals; many users forget the book-ended part.- Negative
-dvalues enforce a minimum required overlap rather than a gap tolerance. - If you provide multiple
-ccolumns and multiple-ooperations, their counts must align unless you intentionally rely on the single-column / single-op broadcast behavior. - Prefer
-hfor help;--versionis not cleanly supported on this wrapper.