[BioC] "unexpected" result from IRanges::intersect

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Aug 18 19:33:14 CEST 2009


Hi Patrick

Thanks for the quick response + fix. I just d/l'd + installed the  
package from svn, and it looks good.

Cheers,
-steve


On Aug 18, 2009, at 1:23 PM, Patrick Aboyoun wrote:

> Thanks Steve,
> You did indeed find a bug, which turned out to be in the gaps method  
> for IRanges objects. Back on August 6th, I fixed the corner case
>
> gaps(IRanges())
>
> and inadvertently broke the corner case
>
> gaps(IRanges(), start = <<int>>, end = <<int>>)
>
> I just check in a fix to svn (IRanges version 1.3.55) that corrects  
> this issue.
>
> > suppressMessages(library(IRanges))
> > i1 <- IRanges(start=c(1, 10, 20), width=10)
> > intersect(i1, i1)
> IRanges instance:
>   start end width
> [1]     1  29    29
> > sessionInfo()
> R version 2.10.0 Under development (unstable) (2009-08-05 r49073)
> i386-apple-darwin9.7.0
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> other attached packages:
> [1] IRanges_1.3.55
>
>
>
> Patrick
>
>
> Steve Lianoglou wrote:
>> Hi,
>>
>> [I'm using R 2.10-devel w/ latest IRanges (version info below)]
>>
>> I'm a bit confused to the behavior of intersect. Namely, the  
>> intersection with *some* IRanges object with itself returns a 0-row  
>> range, but I feel like it should return itself (no matter what).
>>
>> Some examples:
>>
>> 1. if the IRange "elements" represent a contiguous range, the  
>> `intersect`-ion with itself is empty, but its `pintersect`-ion isn't:
>>
>> R> i1 <- IRanges(start=c(1, 10, 20), width=10)
>> R> intersect(i1,i1)
>> IRanges instance:
>> [1] start end   width
>> <0 rows> (or 0-length row.names)
>>
>> R> pintersect(i1,i1)
>> IRanges instance:
>>    start end width
>> [1]     1  10    10
>> [2]    10  19    10
>> [3]    20  29    10
>>
>> 2. If the IRanges "elements" represent some disjoint range, both  
>> intersect and pintersect run as expected (to me):
>>
>> R> i2 <- IRanges(start=c(1,10,20), width=8)
>> R> i2
>> IRanges instance:
>>    start end width
>> [1]     1   8     8
>> [2]    10  17     8
>> [3]    20  27     8
>>
>> R> pintersect(i2,i2)
>> IRanges instance:
>>    start end width
>> [1]     1   8     8
>> [2]    10  17     8
>> [3]    20  27     8
>>
>> Is this the expected behavior? Or is the first example in (1) a bug?
>>
>> Thanks,
>> -steve
>>
>> R> > sessionInfo()
>> R version 2.10.0 Under development (unstable) (2009-08-01 r49053)
>> i386-apple-darwin9.7.0
>>
>> locale:
>> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] ShortRead_1.3.25   lattice_0.17-25    BSgenome_1.13.10    
>> Biostrings_2.13.32 IRanges_1.3.53     doMC_1.1.1          
>> multicore_0.1-3
>> [8] foreach_1.2.1      codetools_0.2-2    iterators_1.0.2     
>> ARE.utils_0.1.0
>>
>> loaded via a namespace (and not attached):
>> [1] Biobase_2.5.5 grid_2.10.0   hwriter_1.1   tools_2.10.0
>>
>> -- 
>> Steve Lianoglou
>> Graduate Student: Computational Systems Biology
>> | Memorial Sloan-Kettering Cancer Center
>> | Weill Medical College of Cornell University
>> Contact Info: http://cbio.mskcc.org/~lianos/contact
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the Bioconductor mailing list