Get the ranges of sliding windows that overlap each range of an IRanges object.
Source:R/getWinOverlapEachIRange.R
getWinOverlapEachIRange.RdGet the ranges of sliding windows that overlap each range of an IRanges object.
Arguments
- x
an IRanges object containing the start and end position of each read fragment.
- winWidth
the width of the sliding window, 1000 by default.
- winStep
the step length to sliding the window, 100 by default.
- readProp
A read is considered to be included in a window if at least
readPropof it is in the window. Specified as a proportion.- maxWin
The maximum window ID
Details
This finds the windows that overlap each range of the input IRanges object. Each range corresponds to a read fragment. This allows the total number of read fragments within a window to be calculated simply using [IRanges::coverage()].
Examples
library(IRanges)
x <- IRanges(start=round(runif(100,1000,10000)),width=100)
getWinOverlapEachIRange(x)
#> IRanges object with 100 ranges and 0 metadata columns:
#> start end width
#> <integer> <integer> <integer>
#> [1] 14 23 10
#> [2] 64 73 10
#> [3] 17 26 10
#> [4] 85 94 10
#> [5] 57 66 10
#> ... ... ... ...
#> [96] 4 13 10
#> [97] 7 16 10
#> [98] 65 74 10
#> [99] 8 17 10
#> [100] 5 14 10