Return original entries in x that do not overlap with any intervals in y. Essentially, this function is just a short-hand for intersect_bed() in exclude mode.

exclude_bed(
  x,
  y,
  max_gap = -1L,
  min_overlap = 0L,
  min_overlap_type = c("bp", "frac1", "frac2")
)

Arguments

x

A GRanges object.

y

A GRanges object.

max_gap

The largest gap for two intervals to be considered as overlapping. Default is -1 (no gap allowed, adjacent intervals not allowd).

min_overlap

The smallest overlapping region for two intervals to be considered as overlapping. Default is 0.

min_overlap_type

A character value indicating how min_overlap is interpreted. bp means min_overlap is the number of base pairs. frac1 means min_overlap is the minimum overlap required as a fraction of x. Similarly, frac2 means min_overlap is the minimum overlap required as a fraction of y. Similar to bedtools intersect's -f and -F arguments.

Value

A GRanges.

References

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

See also

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 usages
head(exclude_bed(tbl_x, tbl_y))
#>    chrom start end score
#> 1:    21     3   6     8
#> 2:    21    10  16     5
#> 3:    21    12  17     4
#> 4:    21    15  22     5
#> 5:    22    27  36     3
#> 6:    22    30  33    10
#> -------
#> genome: unspecified.