coverageByWindow {ORFik}R Documentation

Compute coverage for every GRangesList subset.

Description

This is similar to [GenomicFeatures::coverageByTranscript()], but it adds: automatic sorting of the windows, fix for some rare cases when subsetting fails on minus/plus strands and security that subseting of windows will always return values (zeros) istead of out of bounds error.

Usage

coverageByWindow(x, windows, ignore.strand = FALSE, is.sorted = FALSE,
  keep.names = TRUE)

Arguments

x

the cigar of the reads

windows

(GRangesList) of transcripts or CDS or other ranges that will be subseting coverage of 'x'

ignore.strand

(logical) Whether to consider all reads to be "*".

is.sorted

(logical), is windows already sorted.

keep.names

logical (T), keep names and meta cols

Details

Minus strand is already flipped so that the most 5' position on the window is the first position in the returned Rle.

Value

(RleList) of positional counts of 'x' ranges overlapping each consecutive position of the elements of 'windows'

Examples

cds <- GenomicRanges::GRangesList(
  GenomicRanges::GRanges(seqnames = "chr1",
                         ranges = IRanges::IRanges(100, 200),
                         strand = "+"))
reads <- GenomicRanges::GRanges(
  seqnames = "chr1",
  ranges =  IRanges::IRanges(c(100, 150), c(110, 160)),
  strand = "+")
ORFik:::coverageByWindow(reads, cds)


[Package ORFik version 1.2.1 Index]