Great. My point was that the "integer quad" algorithm could be generalized
to any number of vectors and made part of base R. But maybe that's too much
work for now.
Michael
On Tue, Nov 3, 2015 at 3:50 AM, Peter Hickey wrote:
> Hi Michael,
>
> Sorry, I took this off-list with Hervé. I've written
Hi Michael,
Sorry, I took this off-list with Hervé. I've written a prototype
is.unsorted,GenomicRanges-method.
I structured it following the lead of order,GenomicRanges-method, so
there's an outer R-level that "translates" the GenomicRanges object to
4 integer vectors (actually the slowest part o
If we're going to do that, it brings up the question of whether
is.unsorted() could be made to handle multiple vectors like order(). It
would be nice to implement that logic only once. Suggestions for the API?
New function? Additional argument? Patches welcome ;)
Michael
On Mon, Nov 2, 2015 at 10
OK. Thanks Pete for the timings. The fact that the relative difference
in speed is larger for small n in your brief tests is because one
performs roughly in n*log(n) (quicksort-based) and the other one is
linear in time. Which is why I assumed (but without doing any testing)
that the latter was go
Thanks for everyones' input.
@Hervé FWIW, the below benchmark suggests that unfortunately this is a
fair bit slower than is.unsorted(order(gr)) when the length of the
GRanges object is < 10,000,000 (the relative difference in speed is
larger for small n in my brief tests; I didn't check above n >
On Mon, Nov 2, 2015 at 6:39 PM, Hervé Pagès wrote:
> Hi,
>
> @Pete:
>
> 2a- I would just compare pairs of adjacent elements, taking
> advantage of the fact that <= is vectorized and cheap. So something
> like:
>
> setMethod("is.unsorted", "Vector",
> function(x, na.rm=FALSE, strictly=FALSE)
Hi,
@Pete:
2a- I would just compare pairs of adjacent elements, taking
advantage of the fact that <= is vectorized and cheap. So something
like:
setMethod("is.unsorted", "Vector",
function(x, na.rm=FALSE, strictly=FALSE)
{
if (length(x) <= 1L)
return(FALSE)
genoset has an is.unsorted for GenomicRanges. I profiled a bit and found a
pretty quick way to do it. My version ignores strand, so it is only proper
in some cases. But, maybe it's a head start on a fully general function.
Pete
Peter M. Haverty, Ph.D.
Genentech, Inc.
phave.
The notion of sortedness is already formally defined, which is why we have
an order method, etc.
The base is.unsorted implementation for "objects" ends up calling
base::.gt() for each adjacent pair of elements, which is likely too slow to
be practical, so we probably should add a custom method.
T
Pete,
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
negative strand?
Do we consider seqlevels to be ordinal in the order the levels are returned
from seqlevels ()? That usually makes sense, but
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
11 matches
Mail list logo