ranges-tile: Slide or tile over a Ranges object

Description Usage Arguments Details Value See Also Examples

Description

Slide or tile over a Ranges object

Usage

1
2
3

Arguments

x

a Ranges object

width

the maximum width of each window/tile (integer vector of length 1)

step

the distance between start position of each sliding window (integer vector of length 1)

Details

The tile_ranges() function paritions a Ranges object x by the given the width over all ranges in x, truncated by the sequence end. The slide_ranges() function makes sliding windows within each range of x of size width and sliding by step. Both slide_ranges() and tile_ranges() return a new Ranges object with a metadata column called "partition" which contains the index of the input range x that a parition belongs to.

Value

a Ranges object

See Also

IRanges::tile(), GenomicRanges::tile()

IRanges::slidingWindows(), GenomicRanges::slidingWindows()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 
gr <- data.frame(seqnames = c("chr1", rep("chr2", 3), rep("chr1", 2), rep("chr3", 4)),
                 start = 1:10,
                 end = 11,
                 strand = c("-", rep("+", 2), rep("*", 2), rep("+", 3), rep("-", 2))) %>%
      as_granges() %>%
      set_genome_info(seqlengths = c(11,12,13))

# partition ranges into subranges of width 2, odd width ranges
# will have one subrange of width 1              
tile_ranges(gr, width = 2)

# make sliding windows of width 3, moving window with step size of 2
slide_ranges(gr, width = 3, step = 2)

plyranges documentation built on Nov. 1, 2018, 3:58 a.m.