[BioC] bug in IRanges::disjoin and strange behavior of c

Kasper Daniel Hansen khansen at stat.berkeley.edu
Fri Jan 29 19:31:39 CET 2010


Disjoin bug
========

It seems to have a bug when there are names on the IRanges:

library(IRanges)
ir = IRanges(start = 1:3, end = 2:4)
disjoin(ir) ## Correct

names(ir) = c("a", "b", "c")
disjoin(ir) ## Wrong

IRanges of length 3
    start end width names
[1]     1   1     1     a
[2]     2   2     1     b
[3]     3   3     1     c
Warning messages:
1: In x at start[] <- numeric2integer(value) :
  number of items to replace is not a multiple of replacement length
2: In width(x) + numeric2integer(value) :
  longer object length is not a multiple of shorter object length
3: In width(x) + numeric2integer(value) - end(x) :
  longer object length is not a multiple of shorter object length
4: In x at width[] <- width(x) + numeric2integer(value) - end(x) :
  number of items to replace is not a multiple of replacement length

The last range from 4 to 4 is not included in the output.


c behaviour
=========

It seems to behave strangely in connection with do.call and a named list:

ir = IRanges(start = 1:3, end = 2:4)
do.call(c, list(ir, ir))  ## What I expect, a single IRange with 6 entries.
do.call(c, list(ir1 = ir, ir2 = ir))  ## This I don't get

$ir1
IRanges of length 3
    start end width
[1]     1   2     2
[2]     2   3     2
[3]     3   4     2

$ir2
IRanges of length 3
    start end width
[1]     1   2     2
[2]     2   3     2
[3]     3   4     2

My guess is that this is something with c and method dispatching and do.call.

Using fresh IRanges 1.5.36 from devel.

Kasper



More information about the Bioconductor mailing list