RangesR/AllGenerics.R, R/ranges-helpers.R
positionSequence.RdpositionSequence 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 class 'Ranges'
positionSequence(x, order = FALSE, decreasing = FALSE)
# S4 method for class 'RangesList'
positionSequence(x, order = FALSE, decreasing = FALSE)
# S4 method for class '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)
a integer vector if x is a
GRanges object and a
IntegerList if x is a
GRangesList
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