merge_bed: Merge overlapping intervals

Description Usage Arguments Value See Also Examples

View source: R/manipulation.R

Description

This operation is similar to bedtools merge.

Usage

1
merge_bed(x, max_dist = 0, operation = NULL)

Arguments

x

A data.table object.

max_dist

Maximum distance between features allowed for features to be merged. Default is 0. That is, overlapping and/or book-ended features are merged.

operation

Specify what operations should be applied to merged intervals. Default is NULL, i.e. do not apply any operation and only return the first three columns (chrom, start, end). Must be a list in the following format: list(col1 = func1, col2 = func2, ...), where col1 and col2 are column names, and func1 and func2 are univariate functions applied on the corresponding columns. For example: list(score = sum) means for all intervals merged into one group, take the sum of the score column. Similar to bedtools merge's -c and -o arguments.

Value

A data.table object containing merged intervals.

See Also

https://bedtools.readthedocs.io/en/latest/content/tools/merge.html

Examples

1
merge_bed(x, operation = list(score = mean))

haizi-zh/bioessentials documentation built on April 10, 2021, 2:34 p.m.