Intra-range transformation on GPos-objects?
1
0
Entering edit mode
maltethodberg ▴ 180
@maltethodberg-9690
Last seen 58 minutes ago
Denmark

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 gpos granges • 1.2k views
ADD COMMENT
2
Entering edit mode
@herve-pages-1542
Last seen 15 hours ago
Seattle, WA, United States

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 COMMENT

Login before adding your answer.

Traffic: 972 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6