Get the sliding windows that overlap a GRanges object
Source:R/getWinOverlapGRanges.R
getWinOverlapGRanges.Rd
Get the sliding windows that overlap a GRanges object.
Arguments
- x
a GRanges object, which defines the coordinates of the ranges in the reference genome that all reads mapped to those ranges must be kept by the filtering method
filterDNA
.- seqInfo
a data frame that contains some key information of the sequences
- winWidth
the length of the sliding window, 1000 by default.
- winStep
the step length to sliding the window, 100 by default.
- nbOverlapBases
a window is considered to overlap with a range of
x
if it overlaps with at leastnbOverlapBases
bases.
Value
A list of two logical vectors (for positive and negative strand) defining which windows that overlap with the given GRanges object.
Details
This finds the windows that overlaps the positive/negative strand of a
GRanges object. The GRanges object, which is mustKeepRanges
in the
filterDNA
method, defines the coordinates of the ranges in the
reference genome that all reads mapped to those ranges must be kept by the
filtering method filterDNA
.
This method makes use of the method getWinOverlapEachIRange
by
pretending each given range as the range of a read. Since the widths of
x
are not necessarily the same (as normal read lengths), we
use nbOverlapBases
to specify the minimum number of bases that a
window should overlap with a range of x
, instead of using proprotion
as readProp
in getWinOverlapEachIRange
.
Examples
library(GenomicRanges)
x <- GRanges(seqnames = "10",ranges = IRanges(start = c(10000,15000),
end=c(20000,30000)),strand = c("+","-"))
seqInfo <- data.frame("Sequence"=10,"FirstBaseInPart"=1)
getWinOverlapGRanges(x,seqInfo)
#> $Positive
#> logical-Rle of length 200 with 2 runs
#> Lengths: 91 109
#> Values : FALSE TRUE
#>
#> $Negative
#> logical-Rle of length 300 with 2 runs
#> Lengths: 141 159
#> Values : FALSE TRUE
#>
seqInfo <- data.frame("Sequence"=10,"FirstBaseInPart"=10000000)
getWinOverlapGRanges(x,seqInfo)
#> $Positive
#> logical-Rle of length 100200 with 2 runs
#> Lengths: 100090 110
#> Values : FALSE TRUE
#>
#> $Negative
#> logical-Rle of length 100300 with 2 runs
#> Lengths: 100141 159
#> Values : FALSE TRUE
#>