expandGRanges: Expand a genomic interval

View source: R/GRanges-utils.R

expandGRangesR Documentation

Expand a genomic interval

Description

Expand a genomic interval by a user-specified number of basepairs.

Usage

expandGRanges(granges, size)

Arguments

granges

a GRanges object

size

a length-one numeric vector specifying the number of basepairs to subtract from the start and add to the ends of the intervals in object granges

Examples

library(GenomeInfoDb)
library(BSgenome.Hsapiens.UCSC.hg19)
library(GenomicRanges)
si <- keepSeqlevels(seqinfo(BSgenome.Hsapiens.UCSC.hg19), "chr1")
gr <- GRanges("chr1", IRanges(15e3, 20e3), seqinfo=si)
gr2 <- expandGRanges(gr, 5e3)
## will not go beyond the seqlengths
gr3 <- GRanges("chr1", IRanges(seqlengths(gr)-5000, seqlengths(gr)-2000),
               seqinfo=si)
gr4 <- expandGRanges(gr3, 10e3)
end(gr4) == seqlengths(gr) 



cancer-genomics/trellis documentation built on Feb. 2, 2023, 7:04 p.m.