randomIRanges {biocDatasets} | R Documentation |
Create random IRanges
randomIRanges(n, width, from, to, replace = TRUE)
n |
number of IRanges |
width |
width for the IRanges |
from |
starting index value for the sequence to be covered by IRanges |
to |
ending index value for the sequence to be covered by IRanges |
replace |
sampling with replacement if TRUE (see Details) |
The from
and to
parameters describe the underlying
sequence to be covered by the ranges. To prevent having ranges outside
the sequence, the end
of the IRanges returned cannot be
greater than end
- width
.
If replace
is TRUE
, several IRanges can have the same
starting value.
An IRanges
object of length n
.
n <- 10 rir <- randomIRanges(n, 5, 1, 33) # ASCII-art view reference <- paste("|", paste(rep("-", 33-2), collapse=""), "|", sep = "") regions <- vector("character", length=n) for (i in 1:n) { regions[i] <- paste( paste(rep(" ", start(rir)[i]), collapse=""), paste(rep("-", width(rir)[i]), collapse=""), sep = "" ) } cat(reference, regions, sep="\n")