Question: Intra-range transformation on GPos-objects?
0
5 months ago by
maltethodberg110
UCPH
maltethodberg110 wrote:

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:

promoters(as(gpos1, "GRanges"))

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:

• shift
• restrict
• trim
• disjoin

These functions would convert a GPos to a GRanges:

• resize
• flank
• promoters
• reduce
• gaps

And I'm sure there are more functions I forgot about!

genomicranges granges gpos • 172 views
modified 5 months ago by Hervé Pagès ♦♦ 13k • written 5 months ago by maltethodberg110
Answer: Intra-range transformation on GPos-objects?
2
5 months ago by
Hervé Pagès ♦♦ 13k
United States
Hervé Pagès ♦♦ 13k wrote:

Most of these transformations could indeed be supported on GPos objects. The intra-range transformations (shift, narrow, resize, flank, promoters, reflect, restrict, and trim) are generally expected to behave like endomorphisms (i.e. return an object of the same class as the input) so we would need to make exceptions (and document them) for resizeflank, and promoters.

I'm adding this to the TODO list: https://github.com/Bioconductor/GenomicRanges/issues/12

Cheers,

H.

ADD COMMENTlink modified 5 months ago • written 5 months ago by Hervé Pagès ♦♦ 13k