bed_makewindows: Divide intervals into new sub-intervals ("windows").

Description Usage Arguments Value Note See Also Examples

View source: R/bed_makewindows.r

Description

Divide intervals into new sub-intervals ("windows").

Usage

1
2
bed_makewindows(x, genome = NULL, win_size = 0, step_size = 0,
  num_win = 0, reverse = FALSE)

Arguments

x

tbl_interval()

genome

this argument has been deprecated and is not used

win_size

divide intervals into fixed-size windows

step_size

size to step before next window

num_win

divide intervals to fixed number of windows

reverse

reverse window numbers

Value

tbl_interval() with .win_id column that contains a numeric identifier for the window.

Note

The name and .win_id columns can be used to create new interval names (see 'namenum' example below) or in subsequent group_by operations (see vignette).

See Also

Other utilities: bed12_to_exons, bound_intervals, flip_strands, interval_spacing

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
x <- trbl_interval(
  ~chrom, ~start, ~end, ~name, ~score, ~strand,
  "chr1", 100,    200,  'A',   '.',    '+'
)

bed_glyph(bed_makewindows(x, num_win = 10), label = '.win_id')

# Fixed number of windows
bed_makewindows(x, num_win = 10)

# Fixed window size
bed_makewindows(x, win_size = 10)

# Fixed window size with overlaps
bed_makewindows(x, win_size = 10, step_size = 5)

# reverse win_id
bed_makewindows(x, win_size = 10, reverse = TRUE)

# bedtools 'namenum'
wins <- bed_makewindows(x, win_size = 10)
dplyr::mutate(wins, namenum = stringr::str_c(name, '_', .win_id))

rnabioco/valr documentation built on Jan. 6, 2019, 9:06 a.m.