View source: R/GRanges-utils.R
expandGRanges | R Documentation |
Expand a genomic interval by a user-specified number of basepairs.
expandGRanges(granges, size)
granges |
a |
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 |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.