I like the new GPos-class alot, specially since most GRanges methods work without any issue.
An exception to this is the "intra-range transformations", even though they still make sense for GPos objects. For example the promoters-function:
gpos1 <- GPos(c("chr1:44-53", "chr1:5-10", "chr2:2-5")) promoters(gpos1) Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘update_ranges’ for signature ‘"IPos"’
So I often find myself simply doing:
Wouldn't it make sense to have the promoters-method for GPos-objects simply do something like this automatically? Meaning that if some transformation is called on a GPos where the output is no longer bp-positions, it returns a GRanges instead of calling on error?
These functions would not require a conversion:
These functions would convert a GPos to a GRanges:
And I'm sure there are more functions I forgot about!