| intersect_bed | R Documentation |
intersect operation between two tablesApply intersect operation between two tables
intersect_bed(
x,
y,
mode = c("default", "exclude", "wa", "wb", "wo", "unique", "loj"),
max_gap = -1L,
min_overlap = 0L,
min_overlap_type = c("bp", "frac1", "frac2")
)
x |
A |
y |
A |
mode |
Mode of the intersect operation. Can be one of the following:
|
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 |
A GRanges representing the intersection of x and y
Manual page of bedtools intersect: https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html
GenomicRanges::findOverlaps()
# 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
result <- intersect_bed(tbl_x, tbl_y)
head(result)
# Exclude regions defined by tbl_y from tbl_x
result <- intersect_bed(tbl_x, tbl_y, mode = "exclude")
head(result)
# For each overlap, return the original entries in tbl_x. For a interval in
# tbl_x, it is considered as overlapping only if 50% of it overlaps with an
# interval in tbl_y.
result <- intersect_bed(tbl_x, tbl_y, mode = "wa", min_overlap = 0.5, min_overlap_type = "frac1")
head(result)
# For each overlap, return the original entries in both tbl_x and tbl_y, plus
# the number of overlapping base pairs. The minimum range for two intervals to
# be considered as overlapping is 5bp
result <- intersect_bed(tbl_x, tbl_y, mode = "wa", min_overlap = 5, min_overlap_type = "bp")
head(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.