Question: Intra-range transformation on GPos-objects?
gravatar for maltethodberg
8 months ago by
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"))


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 • 219 views
ADD COMMENTlink modified 8 months ago by Hervé Pagès ♦♦ 14k • written 8 months ago by maltethodberg110
Answer: Intra-range transformation on GPos-objects?
gravatar for Hervé Pagès
8 months ago by
Hervé Pagès ♦♦ 14k
United States
Hervé Pagès ♦♦ 14k 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:




ADD COMMENTlink modified 8 months ago • written 8 months ago by Hervé Pagès ♦♦ 14k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 247 users visited in the last hour