subtract_bed: Subtract

View source: R/manipulation.R

subtract_bedR Documentation

Subtract

Description

This function searches for intervals in y that overlaps with x, and remove the overlapping portion of x.

Usage

subtract_bed(
  x,
  y,
  min_overlap = 1,
  min_overlap_type = c("bp", "frac1", "frac2")
)

Arguments

x

A GRanges object.

y

A GRanges object.

min_overlap

See intersect_bed().

min_overlap_type

intersect_bed().

Value

A GRanges after subtracting y from x

References

Manual page of bedtools subtract: https://bedtools.readthedocs.io/en/latest/content/tools/subtract.html

See Also

intersect_bed()

Examples

# Load BED tables
tbl_x <- read_bed(system.file("extdata", "example_merge.bed", package = "bedtorch"), use_gr = FALSE)
tbl_y <- read_bed(system.file("extdata", "example_intersect_y.bed", package = "bedtorch"), use_gr = FALSE)

# Basic usage
result <- subtract_bed(tbl_x, tbl_y)
head(result)

# Perform the mapping, requiring the minimum overlapping of 5bp
result <- subtract_bed(tbl_x, tbl_y, min_overlap = 5, min_overlap_type = "bp")
head(result)

haizi-zh/bedtorch documentation built on July 1, 2022, 10:40 a.m.