For all pairwise distances, something simple based on outer() should
suffice. It might not be very space efficient, but speed should be somewhat
close to optimal.

What is the end goal of this? For example, the nearest() function finds
nearest neighbors efficiently.

You might be able to leverage findOverlaps(). For example, one can set the
maximum gap between ranges to be considered overlapping. That could be set
to a non-zero value representing some maximum allowable distance. The sparse
doublet matrix from as.matrix() would be pretty efficient for distance
calculation, via the pgap() function.

Michael

On Tue, Jun 8, 2010 at 8:51 AM, Kasper Daniel Hansen <
kasperdanielhansen@gmail.com> wrote:

> Assuming I have two IRanges, each with multiple ranges, like
>  ir1 = IRanges(start = 3:6, width = 2)
>  ir2 = IRanges(start = 10:17, width = 2)
>
> Is there a fast way to compute a pairwise distance matrix between the
> two sets, by which I mean
>  ii = 1
>  jj = 2
>  width(gaps(c(ir1[ii], ir2[jj])))
> where ii, jj would index into a result matrix.  Essentially this would
> be an expanded version of findOverlaps, since any two ranges with
> distance = 0, have an overlap.
>
> Is such functionality available in IRanges, in an efficient
> implementation (think of the case where the two IRanges have - say -
> 10,000 ranges or more)?
>
> Kasper
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

