bedtools/bedtools_merge
Merge
Overlapping
BED
GFF
VCF
Intervals
Description
Merges overlapping BED/GFF/VCF entries into single intervals.
This tool combines overlapping or book-ended features in BED, GFF, or VCF
files into single merged intervals. It provides extensive options for
controlling merge behavior, including strand-specific merging, distance
thresholds, and aggregation operations on additional columns.
Default behavior: Merges overlapping and adjacent features regardless of strand
Input requirements: Input file must be sorted by chromosome and start position
Inputs
Name | Type & Properties | Description |
|---|---|---|
--input -i | file required | Input file in BED, GFF, or VCF format to be merged. **Requirements:** - File must be sorted by chromosome and start position - Use `bedtools sort` if input is not sorted **Supported formats:** BED, GFF, VCF, or BAM (with --bed flag) |
Outputs
Name | Type & Properties | Description |
|---|---|---|
--output | file required output | Output file containing merged intervals. The output will contain merged intervals in BED format, with additional columns included if aggregation operations are specified via --columns and --operation parameters. |
Options
Name | Type & Properties | Description |
|---|---|---|
--strand -s | boolean_true | Force strandedness for merging operations. Only merge features that are on the same strand. Features on opposite strands will be treated as separate and not merged, even if they overlap. **Default:** Merging ignores strand information |
--specific_strand -S | string | Merge features from one specific strand only. **Options:** - "+" : Merge only forward strand features - "-" : Merge only reverse strand features Features from the opposite strand will be ignored entirely. |
--distance -d | integer | Maximum distance between features for merging. **Positive values:** Features within this distance will be merged **Negative values:** Minimum overlap required (in base pairs) **Zero (default):** Only overlapping and book-ended features merge **Examples:** - `-d 100` : Merge features within 100bp of each other - `-d -50` : Require at least 50bp overlap to merge |
--columns -c | string | Columns to aggregate during merging operations. Specify which columns from the input file should be included in the merged output with aggregation operations applied. **Format:** Single column (e.g., "5") or comma-separated list (e.g., "4,5,6") **Column numbering:** 1-indexed (column 1 = chromosome, etc.) |
--operation -o | string | Aggregation operations to apply to specified columns. **Numerical operations:** - sum, min, max, mean, median, mode - absmin, absmax, stdev, sstdev **List operations:** - collapse (comma-separated list with duplicates) - distinct (comma-separated unique values) - distinct_sort_num (unique values, numerically sorted) **Count operations:** - count (number of values) - count_distinct (number of unique values) **Positional operations:** - first (first value), last (last value) **Multiple operations:** Use comma-separated list (e.g., "sum,mean,count") |
--delimiter -delim | string | Custom delimiter for collapse/distinct operations. Character or string used to separate values in list-type operations like collapse, distinct, etc. |
--precision -prec | integer | Decimal precision for numerical output values. Controls the number of decimal places displayed for floating-point results from numerical operations. |
--bed | boolean_true | Output in BED format when using BAM input. When the input file is in BAM format, this flag ensures the output is written in standard BED format instead of the default BAM-specific output format. |
--header | boolean_true | Include header from input file in output. Preserves and prints any header lines from the input file (e.g., GFF version lines, VCF headers) before the merged results. |
--no_buffer -nobuf | boolean_true | Disable buffered output for real-time processing. **Default behavior:** Output is buffered for efficiency **With --no_buffer:** Each line printed immediately as generated **Use cases:** Real-time processing, piping to other tools **Performance:** Slower for large files but enables streaming |
Run this component
Run the following command to execute this component with Nextflow:
cat > params.yaml <<'EOM'
output: "$id.$key.output.bed"
distance: [ 0 ]
delimiter: [ "," ]
precision: [ 5 ]
id: "run"
publish_dir: "output/"
EOM
nextflow run https://packages.viash-hub.com/vsh/biobox.git \
-revision v0.4.1 \
-main-script target/nextflow/bedtools/bedtools_merge/main.nf \
-params-file params.yaml Relationships
Used by
0 relationships
No components use this component.
Current component
bedtools/bedtools_mergebiobox v0.4.1
Uses
0 relationships
No component dependencies found.