[BioC] distanceToNearest for GRanges?

Michael Muratet mmuratet at hudsonalpha.org
Fri Apr 20 16:52:21 CEST 2012


On Apr 11, 2012, at 11:12 AM, Valerie Obenchain wrote:

> This has been added to GenomicRanges 1.9.4. You will also need  
> IRanges 1.15.2.
Greetings

I need this functionality, but I only see GenomicRanges version on the  
Bioconductor site. I couldn't find it under the Developer links,  
either. Is it available and where can I get it?

Thanks

Mike

>
> Valerie
>
>
> On 03/27/2012 10:36 AM, Janet Young wrote:
>> Hi,
>>
>> thank you both - very helpful.
>>
>> Janet
>>
>>
>>
>> On Mar 27, 2012, at 6:35 AM, Valerie Obenchain wrote:
>>
>>> Hi Janet, Malcom,
>>>
>>> Yes, we can add distanceToNearest for GRanges. This will probably  
>>> happen after the release (i.e., next week). I'll post back here  
>>> when it's complete.
>>>
>>> Valerie
>>>
>>>
>>> On 03/26/12 16:26, Cook, Malcolm wrote:
>>>> Janet,
>>>>
>>>> In the mean time....
>>>>
>>>> distanceToNearest.GRanges<- function  
>>>> (query,subject=query,...,.AS=DataFrame) {
>>>>  ## PURPOSE: an implementation of distanceToNearest for GRanges in
>>>>  ## terms of 'nearest' and 'distance' whose return value is shaped
>>>>  ## like that of IRange's 'nearest', by default, but you can ask  
>>>> for
>>>>  ## the result .AS=data.table or .AS=data.frame if you prefer.
>>>>   if(missing(subject)) {
>>>>     nearestSubjectIndex<-nearest(query,...)
>>>>   } else {
>>>>     nearestSubjectIndex<-nearest(query,subject,...)
>>>>   }
>>>>   queryHasNearest<-! is.na(nearestSubjectIndex)
>>>>   queryIndex<-which(queryHasNearest)
>>>>   queryHavingNearest<-query[queryIndex]
>>>>   nearestSubjectIndex<-nearestSubjectIndex[queryIndex]
>>>>   nearestSubject<-subject[nearestSubjectIndex]
>>>>   d<-distance(queryHavingNearest,nearestSubject)
>>>>   .AS(query=queryIndex
>>>>              ,subject=nearestSubjectIndex
>>>>              ,distance=d)
>>>> }
>>>>
>>>> You've asked so many questions in this forum whose answer I made  
>>>> use of that I must owe you this tidbit....
>>>>
>>>> Lurkers, and fellow travelers, I welcome corrections and  
>>>> stylistic suggestions.
>>>>
>>>> Cheers,
>>>>
>>>> Malcolm Cook
>>>>
>>>>
>>>> ________________________________________
>>>> From: bioconductor-bounces at r-project.org [bioconductor-bounces at r-project.org 
>>>> ] On Behalf Of Janet Young [jayoung at fhcrc.org]
>>>> Sent: Monday, March 26, 2012 4:42 PM
>>>> To: bioconductor at r-project.org
>>>> Subject: [BioC] distanceToNearest for GRanges?
>>>>
>>>> Hi there,
>>>>
>>>> Any plans to implement distanceToNearest for GRanges objects?    
>>>> That would be really useful for me.
>>>>
>>>> thanks,
>>>>
>>>> Janet
>>>>
>>>>
>>>> -------------------------------------------------------------------
>>>>
>>>> Dr. Janet Young
>>>>
>>>> Tapscott and Malik labs
>>>>
>>>> Fred Hutchinson Cancer Research Center
>>>> 1100 Fairview Avenue N., C3-168,
>>>> P.O. Box 19024, Seattle, WA 98109-1024, USA.
>>>>
>>>> tel: (206) 667 1471 fax: (206) 667 6524
>>>> email: jayoung  ...at...  fhcrc.org
>>>>
>>>>
>>>> -------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> Bioconductor mailing list
>>>> Bioconductor at r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>>>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>>>> _______________________________________________
>>>> Bioconductor mailing list
>>>> Bioconductor at r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>>>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

Michael Muratet, Ph.D.
Senior Scientist
HudsonAlpha Institute for Biotechnology
mmuratet at hudsonalpha.org
(256) 327-0473 (p)
(256) 327-0966 (f)

Room 4005
601 Genome Way
Huntsville, Alabama 35806



More information about the Bioconductor mailing list