This function takes a given GRanges and returns another GRanges object. The new GRanges has the same number of ranges and the same chromosome, width and strand distributions than the original GRanges.
# S3 method for GRanges
sampleGRanges(
x,
n = NULL,
width = NULL,
exclude = FALSE,
avoid_overlap = FALSE
)
GRanges object
Integer, number of sampled GRanges
Integer, width of sampled GRanges
Boolean, should the original GRanges be excluded?
Boolean, should the sampled GRanges not be overlapping?
A GRanges object of length n
data(ce11_proms)
sampleGRanges(ce11_proms, 100)
#> GRanges object with 100 ranges and 0 metadata columns:
#> seqnames ranges strand
#> <Rle> <IRanges> <Rle>
#> [1] chrI 299998-300148 +
#> [2] chrI 4059565-4059715 +
#> [3] chrI 6350239-6350389 +
#> [4] chrI 11290093-11290243 +
#> [5] chrI 11578453-11578603 +
#> ... ... ... ...
#> [96] chrX 7542159-7542309 -
#> [97] chrX 8141320-8141470 -
#> [98] chrX 13845450-13845600 -
#> [99] chrX 15267074-15267224 -
#> [100] chrX 15937727-15937877 -
#> -------
#> seqinfo: 6 sequences from an unspecified genome; no seqlengths