GRanges object into bins of specified bin_sizeR/coord_ops.R
bin_granges.RdBins each region in a GRanges object into bins of specified bin_size
bin_granges(gr, bin_size = 1e+05)
| gr | GRanges; The |
|---|---|
| bin_size | integer; x > 0; The length of region in each bin |
GRangesList containing all the binned GRanges
Bins a single region in GRanges format into multiple regions with a specified bin_size. If length(gr) %% bin_size != 0, then the last GRange will have a length < bin_size. This is used instead of tile when you need consistently sized bins with the last bin being smaller
regions <- GenomicRanges::GRanges(seqnames = "chr1", ranges = IRanges(1,10000)) bin_granges(regions,bin_size=1000)#> GRanges object with 10 ranges and 0 metadata columns: #> seqnames ranges strand #> <Rle> <IRanges> <Rle> #> [1] chr1 1-1000 * #> [2] chr1 1001-2000 * #> [3] chr1 2001-3000 * #> [4] chr1 3001-4000 * #> [5] chr1 4001-5000 * #> [6] chr1 5001-6000 * #> [7] chr1 6001-7000 * #> [8] chr1 7001-8000 * #> [9] chr1 8001-9000 * #> [10] chr1 9001-10000 * #> ------- #> seqinfo: 1 sequence from an unspecified genome; no seqlengths