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

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Aug 18 05:01:39 CEST 2009


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



More information about the Bioconductor mailing list