[BioC] IRanges findOverlaps potential bug?

Arunkumar Srinivasan aragorn168b at gmail.com
Thu Aug 28 22:09:32 CEST 2014


Hi BioC list,

I just came across something I believe is an unexpected result (potential bug) in IRanges. I'm using the development version, but the same happens in stable version as well. My sincerest apologies if it's a misunderstanding on my part.

In the example below, I'd expect the result for 'ans2' to be a vector of length 6, but with all values = 4L instead of 3L. By looking at `?findOverlaps`, it seems like `select` should work with all values of argument 'type'.

## code
require(IRanges)
ii = IRanges(start=3L, end=c(5L, 5L, 16L, 20L, 24L, 47L))
# IRanges of length 6
#     start end width
# [1]     3   5     3
# [2]     3   5     3
# [3]     3  16    14
# [4]     3  20    18
# [5]     3  24    22
# [6]     3  47    45

xx = IRanges(start=c(1L,2L,3L,3L,6L), end=c(646L, 481L, 672L, 1037L, 153L))
# IRanges of length 5
#     start  end width
# [1]     1  646   646
# [2]     2  481   480
# [3]     3  672   670
# [4]     3 1037  1035
# [5]     6  153   148

## works fine, as expected
ans1 = as.data.frame(findOverlaps(ii, xx, type="start", select="all"))
#    query subject
# 1      1       3
# 2      1       4
# 3      2       3
# 4      2       4
# 5      3       3
# 6      3       4
# 7      4       3
# 8      4       4
# 9      5       3
# 10     5       4
# 11     6       3
# 12     6       4

## potential bug?
ans2 = findOverlaps(ii, xx, type="start", select="last")
# [1] 3 3 3 3 3 3

This seems like a bug to me. If not, could you please explain? Thank you.

---

sessionInfo()
# R version 3.1.1 (2014-07-10)
# Platform: x86_64-apple-darwin10.8.0 (64-bit)

# locale:
# [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

# attached base packages:
# [1] parallel  graphics  grDevices datasets  stats     utils     methods   base     

# other attached packages:
# [1] IRanges_1.99.24     S4Vectors_0.1.2     BiocGenerics_0.11.4 bit64_0.9-4        
# [5] bit_1.1-12         

# loaded via a namespace (and not attached):
# [1] stats4_3.1.1 tools_3.1.1 

Arun


	[[alternative HTML version deleted]]



More information about the Bioconductor mailing list