Get the window ranges that overlap each read fragment
Source:R/getWinOverlapEachReadFragment.R
getWinOverlapEachReadFragment.Rd
Calculate the window ranges that overlap each read fragment
Usage
getWinOverlapEachReadFragment(
readInfo,
strand,
winWidth,
winStep,
readProp,
useCoverage = FALSE,
subset = NULL
)
Arguments
- readInfo
a list contains the read information
- strand
the considering strand
- winWidth
the width of the sliding window, 1000 by default.
- winStep
the step length to sliding the window, 100 by default.
- readProp
a read fragment is considered to be included in a window if and only if at least
readProp
percent of it is in the window.- useCoverage
either base on coverage or number of reads
- subset
if we consider only a subset of the input reads
Value
If useCoverage=FALSE
: an IRanges object which contains the
range of sliding windows that overlap each read fragment.
If useCoverage=TRUE
: a list of two objects, the first one is the
later IRanges object, the second one is an integer-Rle object which contains
the coverage of the input readInfo
Examples
library(Rsamtools)
file <- system.file('extdata','s2.sorted.bam',package = 'strandCheckR')
readInfo <- scanBam(file, param =
ScanBamParam(what = c("pos","cigar","strand")))
getWinOverlapEachReadFragment(readInfo[[1]],"+",1000,100,0.5)
#> $Win
#> IRanges object with 3310 ranges and 1 metadata column:
#> start end width | alignment
#> <integer> <integer> <integer> | <integer>
#> [1] 70370 70379 10 | 2
#> [2] 70370 70379 10 | 3
#> [3] 70370 70379 10 | 4
#> [4] 70370 70379 10 | 6
#> [5] 70371 70380 10 | 8
#> ... ... ... ... . ...
#> [3306] 73990 73990 1 | 7104
#> [3307] 73990 73990 1 | 7105
#> [3308] 73990 73990 1 | 7108
#> [3309] 73990 73990 1 | 7109
#> [3310] 73990 73990 1 | 7110
#>