[Bioc-devel] is.unsorted method for GRanges objects
becker.gabe at gene.com
Tue Nov 3 01:55:28 CET 2015
What does sorted mean for granges? If the starts are sorted but the ends
aren't does that count? What if only the ends are but the ranges are on the
Do we consider seqlevels to be ordinal in the order the levels are returned
from seqlevels ()? That usually makes sense, but does it always?
In essence I'm asking if sortedness is a well enough defined term for an
is.sorted method to make sense.
On Nov 2, 2015 4:27 PM, "Peter Hickey" <peter.hickey at gmail.com> wrote:
> Hi all,
> I sometimes want to test whether a GRanges object (or some object with
> a GRanges slot, e.g., a SummarizedExperiment object) is (un)sorted.
> There is no is.unsorted,GRanges-method or, rather, it defers to
> is.unsorted,ANY-method. I'm unsure that deferring to the
> is.unsorted,ANY-method is what is really desired when a user calls
> is.unsorted on a GRanges object, and it will certainly return a
> (possibly unrelated) warning - "In is.na(x) : is.na() applied to
> non-(list or vector) of type 'S4'".
> For this reason, I tend to use is.unsorted(order(x)) when x is a
> GRanges object. This workaround is also used, for example, by minfi
> However, this is slow because it essentially sorts the object to test
> whether it is already sorted.
> So, to my questions:
> 1. Have I overlooked a fast way to test whether a GRanges object is sorted?
> 2a. Could a is.unsorted,GenomicRanges-method be added to the
> GenomicRanges package? Side note, I'm unsure at which level to define
> this method, e.g., GRanges vs. GenomicRanges.
> 2b. Is it possible to have a sensible definition and implementation
> for is.unsorted,GRangesList-method?
> 2c. Could a is.unsorted,RangedSummarizedExperiment-method be added to
> the SummarizedExperiment package?
> I started working on a patch for 2a/2c, but wanted to ensure I hadn't
> overlooked something obvious. Also, I'm sure 2a/2b/2c could be written
> much more efficiently at the C-level but I'm afraid this might be a
> bit beyond my abilities to integrate nicely with the existing code.
> Bioc-devel at r-project.org mailing list
[[alternative HTML version deleted]]
More information about the Bioc-devel