这很简单.你可以使用start
和end
功能GenomicRanges
.
gr <- GRanges(c('chr1','chr1'), IRanges(start=c(20, 120), +') gr # GRanges object with 2 ranges and 0 metadata columns: # seqnames ranges strand ## [1] chr1 [ 20, 29] + # [2] chr1 [120, 129] + # ------- # seqinfo: 1 sequence from an unspecified genome; no seqlengths start(gr) <- start(gr) - 10 end(gr) <- end(gr) + 10 gr # GRanges object with 2 ranges and 0 metadata columns: # seqnames ranges strand # # [1] chr1 [ 10, 39] + # [2] chr1 [110, 139] + # ------- # seqinfo: 1 sequence from an unspecified genome; no seqlengths