bed_window: Identify intervals within a specified distance.

View source: R/bed_window.r

bed_windowR Documentation

Identify intervals within a specified distance.

Description

Identify intervals within a specified distance.

Usage

bed_window(x, y, genome, ...)

Arguments

x

ivl_df

y

ivl_df

genome

genome_df

...

params for bed_slop and bed_intersect

Details

input tbls are grouped by chrom by default, and additional groups can be added using dplyr::group_by(). For example, grouping by strand will constrain analyses to the same strand. To compare opposing strands across two tbls, strands on the y tbl can first be inverted using flip_strands().

See Also

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

Other multiple set operations: bed_closest(), bed_coverage(), bed_intersect(), bed_map(), bed_subtract()

Examples

x <- tibble::tribble(
  ~chrom, ~start, ~end,
  "chr1", 25,     50,
  "chr1", 100,    125
)

y <- tibble::tribble(
  ~chrom, ~start, ~end,
  "chr1", 60,     75
)

genome <- tibble::tribble(
  ~chrom, ~size,
  "chr1", 125
)

bed_glyph(bed_window(x, y, genome, both = 15))

x <- tibble::tribble(
  ~chrom, ~start, ~end,
  "chr1", 10, 100,
  "chr2", 200, 400,
  "chr2", 300, 500,
  "chr2", 800, 900
)

y <- tibble::tribble(
  ~chrom, ~start, ~end,
  "chr1", 150,    400,
  "chr2", 230,    430,
  "chr2", 350,    430
)

genome <- tibble::tribble(
  ~chrom, ~size,
  "chr1", 500,
  "chr2", 1000
)

bed_window(x, y, genome, both = 100)


valr documentation built on Sept. 19, 2023, 1:07 a.m.