Entering edit mode
In a running project I found it very convenient to have a local getSeq()
method for GRanges
, especially for interactive use.
getSeq_GRanges <- function(x, ...) {
genome <- unique(genome(x))
if (any(is.na(genome)))
stop("Can not getSeq objets where `genome` is not defined.")
# Maybe should also check that length(genome) == 1
getSeq(getBSgenome(genome), x)
}
setMethod("getSeq", "GRanges", getSeq_GRanges)
Would you consider adding such a method to the BSgenome
packages or wherever it makes sense ?
Have a nice day,
-- Charles