[Bioc-devel] "nearest" & related methods for GRangesList & friends?
On 05/23/2014 11:20 AM, Ryan C. Thompson wrote:
Here is my use case (relevant lines highlighted): https://gist.github.com/anonymous/0cd0c926fb21a8d62fcc#file-annotatepeaks-r-L49-L54 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.
Good. nearest() between a GRanges and a GRangesList is the easy one: togroup(subject, nearest(query, unlist(subject, use.names=FALSE))) Is this doing what you need? Cheers, H.
-Ryan 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
Herv? Pag?s Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpages at fhcrc.org Phone: (206) 667-5791 Fax: (206) 667-1319