Ranges
R/AllGenerics.R
, R/ranges-helpers.R
positionSequence.Rd
positionSequence
generates sequences of integer values
along the range information of x
. This can be used for navigating
specific positions on a range information.
positionSequence(x, order = FALSE, decreasing = FALSE)
# S4 method for Ranges
positionSequence(x, order = FALSE, decreasing = FALSE)
# S4 method for RangesList
positionSequence(x, order = FALSE, decreasing = FALSE)
# S4 method for Ranges
as.integer(x)
a Ranges
object, like a
GRanges
or
IRanges
, or a RangesList
object, like a GRangesList
or IRangesList
TRUE
or FALSE
: Should the position be ordered?
(default: order = FALSE
)
TRUE
or FALSE
: If order = TRUE
Should
the position be ordered in a decreasing order? (default: order =
FALSE
)
library(GenomicRanges)
# Returns an integer vector
gr <- GRanges("chr1:1-5:+")
positionSequence(gr)
#> [1] 1 2 3 4 5
gr2 <- GRanges("chr1:1-5:-")
positionSequence(gr)
#> [1] 1 2 3 4 5
# returns an IntegerList
grl <- GRangesList("1" = gr,"2" = gr,"3" = gr2) # must be named
positionSequence(grl)
#> IntegerList of length 3
#> [["1"]] 1 2 3 4 5
#> [["2"]] 1 2 3 4 5
#> [["3"]] 5 4 3 2 1