[Bioc-devel] "nearest" & related methods for GRangesList & friends?

Ryan C. Thompson rct at thompsonclan.org
Fri May 23 20:20:23 CEST 2014

Here is my use case (relevant lines highlighted):


The idea is to annotate each peak with the Entrez ID of the nearest 
transcription start site. Each Entrez ID can have multiple transcripts, 
hence multiple TSS, so I basically want to call nearest with a GRanges 
of peaks against a GRangesList of TSS (each TSS is a range with a width 
of 1 containing the first base pair of a transcript). I don't personally 
need a method that works for a GRangesList query.


On Fri 23 May 2014 11:13:24 AM PDT, Hervé Pagès wrote:
> Hi Ryan,
> On 05/22/2014 03:38 PM, Ryan C. Thompson wrote:
>> Hello,
>> I recently found myself in want of a nearest method that handles
>> GRangesList objects. Is there any plan to add one?
> Not that I know of. I guess most of the times it's probably good enough
> to call range() on both GRangesList objects before passing them to
> nearest(). What's the use case for caring about "gaps" within each
> GRangesList element?
>> I just want to define
>> "nearest" for elements of a GRangesList by the shortest distance between
>> any query range and any subject range. Obviously I can do this by
>> unlisting the GRangesList, calling nearest, and then post-processing to
>> figure out which element of the original GRangesList includes the
>> nearest range, but it would be nice to have a function that already does
>> this for me.
> The easy one is a "nearest" method between a GRanges and a GRangesList.
> Is it what you need? That would cover finding the nearest gene or
> transcript for ChIPseq peaks when the exon structure actually matters
> (seems like it would matter only for peaks that fall inside more than
> 1 transcript).
> Or do you need a method that operates on 2 GRangesList objects? Can't
> think of a use case for that one. Finding the nearest gene or transcript
> for junction reads?
> Thanks,
> H.
>> -Ryan
>> _______________________________________________
>> Bioc-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel

More information about the Bioc-devel mailing list